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 |
|---|---|---|---|---|---|---|---|
900df433a5d477a747b6048cff140b644be2c992 | Fix timezone warnings when running search index command. | reviewboard/reviews/management/commands/index.py | reviewboard/reviews/management/commands/index.py | from datetime import datetime
import os
import optparse
import sys
import time
from django.core.management.base import NoArgsCommand
from django.db.models import Q
from djblets.siteconfig.models import SiteConfiguration
from reviewboard.reviews.models import ReviewRequest
try:
import lucene
lucene.initVM(lu... | Python | 0.000003 | @@ -71,16 +71,32 @@
ort time
+%0Aimport settings
%0A%0Afrom d
@@ -173,16 +173,50 @@
import Q
+%0Afrom django.utils import timezone
%0A%0Afrom d
@@ -2100,16 +2100,270 @@
e, 'r')%0A
+ if timezone and settings.USE_TZ:%0A timestamp = timezone.make_aware(datetime.utcfromtimestamp(int(f... |
d4db402f884b9af212bc7ceece84e89e20eab060 | change to name pkgbuild | salt/modules/rpmbuild.py | salt/modules/rpmbuild.py | '''
Make rpm buld tree
get sources
get spec
make srpm
run mock on the srpm
git srpm a target location
run createrepo on a target location
deps rpmdevtools, createrepo, mock
'''
# Import python libs
import os
import tempfile
import shutil
from salt.ext.six.moves.urllib.parse import urlparse as _urlparse
# Import salt... | Python | 0.000001 | @@ -353,27 +353,27 @@
alname__ = '
-rpm
+pkg
build'%0A%0A%0Adef
@@ -1532,24 +1532,42 @@
else:%0A
+ lsrc = source%0A
shutil.c
@@ -1570,22 +1570,20 @@
il.copy(
+l
s
-ou
rc
-e
, dest)%0A
@@ -1589,21 +1589,27 @@
%0A%0A%0Adef m
-ksrpm
+ake_src_pkg
(dest_di
@@ -2772,13 +2772,19 @@
= m
-ksrpm
+ake_src... |
d159f6f39826d79ee386a8d43943a70f96ec2e84 | upgrade udocker test to v1.3.5 | tests/test_udocker.py | tests/test_udocker.py | """Test optional udocker feature."""
import copy
import os
import subprocess
import sys
from pathlib import Path
import pytest
from _pytest.tmpdir import TempPathFactory
from .util import get_data, get_main_output, working_directory
LINUX = sys.platform in ("linux", "linux2")
@pytest.fixture(scope="session")
def u... | Python | 0 | @@ -686,14 +686,13 @@
oad/
-v
1.3.
-1
+5
/udo
@@ -700,17 +700,17 @@
ker-1.3.
-1
+5
.tar.gz%22
|
de9e50ad91ca4af1932c7fc2b63ec1d138fc6bdf | Support url parameter without index.php. | tpmadmin.py | tpmadmin.py | #! /usr/bin/env python3
"""Team Password Manager administration via the API.
See http://teampasswordmanager.com/docs/api/ for specification.
Created 2015 by Mark Ruys <mark.ruys@peercode.nl>, Peercode BV
"""
__version__ = '1.0'
import json
import hmac
import hashlib
import time
import requests
class TPMException(E... | Python | 0 | @@ -3491,17 +3491,8 @@
com/
-index.php
')%0A
@@ -4170,16 +4170,138 @@
args.url
+ if args.url.endswith(%22/index.php%22) else (args.url + %22index.php%22) if args.url.endswith(%22/%22) else (args.url + %22/index.php%22)
, 'v4')%0A
|
937fcb43d43c81dcdb6f65344022e68bedcdb324 | Remove zip archive after extraction | kindred/utils.py | kindred/utils.py |
import os
import zipfile
import hashlib
import requests
import logging
import traceback
import time
def _calcSHA256(filename):
return hashlib.sha256(open(filename, 'rb').read()).hexdigest()
def _findDir(name, path):
if os.path.isdir(path):
for root, dirs, files in os.walk(path):
if name in dirs:
return os... | Python | 0 | @@ -2279,16 +2279,47 @@
.close()
+%0A%0A%09%09%09%09os.remove(downloadedPath)
%0A%09%0A%09#soc
|
37b00c5fb5afead3e793ee2677b4a910e90a4510 | split up into functions and handle token expiration | post-articles.py | post-articles.py | #!/usr/bin/env python3
import requests
import configparser
import csv
import sys
counter = 0
def printf(text):
print(text, end='', flush=True)
def main(args):
c = configparser.ConfigParser()
c.read('credentials.ini')
c = c.defaults()
hostname = c['host']
username = c['username']
passw... | Python | 0.000003 | @@ -98,151 +98,880 @@
def
-printf(text):%0A print(text, end='', flush=True)%0A%0A%0Adef main(args):%0A c = configparser.ConfigParser()%0A c.read('credentials.ini')%0A c = c
+main(args):%0A config = configparser.ConfigParser()%0A config.read('credentials.ini')%0A hostname, payload = extractCreds(c... |
e97b62425a8024ffcf447d1706aabebd5644a5ca | Update test_unicode.py | tests/test_unicode.py | tests/test_unicode.py | # coding: utf-8
import sys
import pytest
import jupytext
from .utils import list_all_notebooks
try:
unicode # Python 2
except NameError:
unicode = str # Python 3
@pytest.mark.parametrize('nb_file', list_all_notebooks('.ipynb') +
list_all_notebooks('.Rmd'))
def test_notebook_conte... | Python | 0.000001 | @@ -402,50 +402,8 @@
ls:%0A
- if sys.version_info %3C (3, 0):%0A
@@ -471,70 +471,8 @@
de)%0A
- else:%0A assert isinstance(cell.source, str)%0A
%0A%0Ade
|
baffee2d521963c510aea49e401535dae7b81fd3 | Make ARP responder test more robust. | dragonflow/tests/fullstack/test_l2_responder.py | dragonflow/tests/fullstack/test_l2_responder.py | # 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, software
# d... | Python | 0.002326 | @@ -1576,57 +1576,32 @@
ef _
-wait_for_flow_removal(self, flows_before, timeout
+get_arp_table_flows(self
):%0A
@@ -1655,50 +1655,13 @@
-while timeout %3E 0:%0A flows_after
+flows
= o
@@ -1695,23 +1695,13 @@
-
flows
-_after
= %5B
@@ -1726,19 +1726,9 @@
lows
-_after%0A
+%0A
... |
141acf950ee9ffc211028bf96cab31a68fffcbe3 | Add a way to show local scorecards #9 | tests/gen_makefile.py | tests/gen_makefile.py | import os
import glob
subdirs = ["tests/protoyping"] + glob.glob("tests/skl_datasets/*") + glob.glob("tests/skl_datasets_reg/*") + glob.glob("tests/issues/*")
build_tests = ['sample', 'tests_issues', 'iris', 'boston']
all_target = "";
build_target = "";
for subdir1 in subdirs:
test_target = "";
for filen... | Python | 0.000001 | @@ -156,16 +156,50 @@
ues/*%22)
++ glob.glob(%22tests/score_card/*%22)
%0A%0Abuild_
|
e4de59f76709db5c5e52eb711925fe6b17d5039a | Test extension | tests/testcallable.py | tests/testcallable.py | # Copyright (C) 2007-2011 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
from tests.support import is_instance, unittest2, X
from mock import (
Mock, MagicMock, NonCallableMagicMock,
NonCallableMock, patch, create_autospec
)
"""
Note th... | Python | 0.000001 | @@ -191,16 +191,27 @@
test2, X
+, SomeClass
%0A%0Afrom m
@@ -2248,32 +2248,339 @@
pass%0A%0A
+ class Sub(CallableX):%0A pass%0A%0A class Multi(SomeClass, Sub):%0A pass%0A%0A class OldStyle:%0A def __call__(self):%0A pass%0A%0A clas... |
c9c83550df63a1992755c6ff8bdc24fda28030b4 | remove empty headers from norm_headers | revproxy/utils.py | revproxy/utils.py |
import re
import logging
from wsgiref.util import is_hop_by_hop
try:
from http.cookies import SimpleCookie
COOKIE_PREFIX = ''
except ImportError:
from Cookie import SimpleCookie
COOKIE_PREFIX = 'Set-Cookie: '
#: List containing string constant that are used to represent headers that can
#: be igno... | Python | 0.00001 | @@ -3928,16 +3928,46 @@
' to '-'
+ of non empty required headers
%0A%0A :p
@@ -4189,24 +4189,34 @@
ader(header)
+ and value
:%0A
|
4ad76ef7e5193d0b88df24ca4b6f6f9cb58c3e3d | Add __init__.py | kong/__init__.py | kong/__init__.py | Python | 0.006636 | @@ -0,0 +1,609 @@
+# Copyright 2011 OpenStack LLC.%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22); you may%0A# not use this file except in compliance with the License. You may obtain%0A# a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0%0A#%0A# ... | |
1e4ec5d51c5998079c757c28211831dd3e51341e | fix doc string | salt/modules/win_path.py | salt/modules/win_path.py | '''
Module to interact with WatchDox application / solr-master instances
Note that not all the Windows application will rehash the PATH environment variable,
Only the ones that listens to the WM_SETTINGCHANGE message
http://support.microsoft.com/kb/104011
'''
# Python Libs
import logging
import re
# Third party lib... | Python | 0.000018 | @@ -2,75 +2,37 @@
''%0AM
-odule to interact wi
+anage
th
+e
W
-atchDox application / solr-master instances
+indows System PATH
%0A%0ANo
|
369df1c985286da8ef5d365d69811b76f3fc9341 | Remove unneeded mode | kopytka/admin.py | kopytka/admin.py | from django.contrib import admin
from . import models
class PageAdmin(admin.ModelAdmin):
list_display = ('url', 'parent', 'order', 'template', 'is_published')
list_filter = ('is_published',)
ordering = ('parent', 'order',)
class Media:
css = {
'all': (
'codemirror... | Python | 0.000002 | @@ -1791,56 +1791,8 @@
s',%0A
- 'codemirror/addon/mode/overlay.js',%0A
|
ff43e2f730b17d6f04e252bffb154e4efc1ca37b | remove docstring | logreg/logreg.py | logreg/logreg.py | import random
from numpy import zeros, sign
from math import exp, log
from collections import defaultdict
import argparse
kSEED = 1701
kBIAS = "BIAS_CONSTANT"
random.seed(kSEED)
def sigmoid(score, threshold=20.0):
"""
Note: Prevents overflow of exp by capping activation at 20.
:param score: A real val... | Python | 0.003725 | @@ -1498,98 +1498,51 @@
ram
-step: A function that takes the iteration as an argument (the default is a constant value)
+learning_rate: How big of a SG step we take
%0A
@@ -2475,165 +2475,8 @@
to%0A
- :param iteration: The current iteration (an integer)%0A :param use_tfidf: A boolean to switch bet... |
5c36a9ac14fdfecdd933545ea0d405c2fa51e9c6 | Improve reference handling | webtool/server/models/reference.py | webtool/server/models/reference.py | # -*- coding: utf-8 -*-
import re
from django.core.validators import MaxValueValidator
from django.db import models
from server.models import Season
from .category import Category
from .mixins import SeasonMixin
from .time_base import TimeMixin
from . import defaults
class ReferenceManager(models.Manager):
def... | Python | 0.000001 | @@ -2057,200 +2057,8 @@
%22)%0A%0A
- try:%0A category = Category.objects.get(code=code)%0A except Category.DoesNotExist:%0A raise Reference.DoesNotExist(%22Reference matching query does not exist.%22)%0A%0A
@@ -2089,16 +2089,16 @@
, str):%0A
+
@@ -2336,89 +2336,135 ... |
9a2be554d8618e86648d595c0b3558727cfa5918 | remove the version explicit language | luxafor-linux.py | luxafor-linux.py | #!/usr/bin/env python3.8
import usb.core
import usb.util
import sys
import argparse
DEVICES = []
ACTION = None
LED = None
HEX = None
RED = None
GREEN = None
BLUE = None
SPEED = None
REPEAT = None
WAVE = None
PATTERN = None
def main():
global RED
global GREEN
global BLUE
setupDevices()
setupArgs(... | Python | 0.998267 | @@ -18,11 +18,8 @@
thon
-3.8
%0Aimp
|
daf6c1f381bcefe6e94523cba5027d4e3c2debd5 | Add methods to retrieve Valued Images | wm_metrics/analyse_commons_dump.py | wm_metrics/analyse_commons_dump.py | # -*- coding: utf-8 -*-
import xml.dom.minidom
import re
import datetime
class DumpMediaCollection(dict):
"""Representation of a MediaCollection, dump style."""
def __init__(self):
super(DumpMediaCollection, self).__init__()
def init_from_xml_dump(self, xml_dump):
"""Initialise the obj... | Python | 0.0024 | @@ -386,16 +386,236 @@
dump))%0A%0A
+ def get_valued_images(self):%0A %22%22%22Return a list of valued images in the collection.%22%22%22%0A return %5Bpage_id for (page_id, page) in self.items()%0A if page.get_top_revision().is_valued_image()%5D%0A%0A
%0Aclass C
@@ -1525,16 +1525,260 @... |
a1a8eb31b881cc7f2fbc7c1725354e950adee246 | fix startup bug when ES is empty | active_data/actions/save_query.py | active_data/actions/save_query.py | # encoding: 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/.
#
# Author: Kyle Lahnakoski (kyle@lahnakoski.com)
#
from __future__ import absolute_import
from __fut... | Python | 0.000002 | @@ -6188,43 +6188,8 @@
alse
-,%0A %22store%22: True
%0A
|
56af45ebbc5c2411212322b7662b10b547d416e0 | Use git.is_bare_repository(); git.bare does not exist | cvsgit/command/clone.py | cvsgit/command/clone.py | """Command to clone a CVS repository or module as a Git repository."""
import os.path
import sys
import time
from cvsgit.cmd import Cmd
from cvsgit.cvs import CVS
from cvsgit.git import Git
from cvsgit.meta import MetaDb
from cvsgit.i18n import _
class Progress(object):
def __init__(self, enabled):
self... | Python | 0.00068 | @@ -3570,12 +3570,28 @@
git.
+is_
bare
+_repository()
:%0A
|
25fa9d5efb78d24da48f6c0cc050eab693f462cd | Update Travis CI test script to match RMQ CI | travisci.py | travisci.py | #!/usr/bin/env python
import time
import random
import re
import subprocess
import signal
import sys
import os
multiplier = float(os.environ.get('SLOWNESS', 1))
def run(cmd, **kwargs):
p = subprocess.Popen(cmd.split(),
stdout=subprocess.PIPE,
stderr=subprocess.PIP... | Python | 0 | @@ -417,16 +417,200 @@
read()%0A%0A
+ # compensate for slow Clojure examples startup:%0A # lein trampoline run + clojure.core recompilation%0A if kwargs.get(%22cwd%22) == %22clojure%22:%0A x = 4%0A else:%0A x = 1%0A
time
@@ -624,32 +624,36 @@
0.2 * multiplier
+ * x
)%0A return p.r
@... |
a345d932f568220ed70961f70fa759afe6e32f92 | Fix GoodRevisions (LKGR). | scripts/master/build_utils.py | scripts/master/build_utils.py | # Copyright (c) 2010 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Mixed bag of anything."""
import re
from twisted.python import log
from buildbot.status.web.base import IBox
def getAllRevisions(build):
"""Help... | Python | 0.000001 | @@ -636,16 +636,172 @@
hanges%5D%0A
+ try:%0A return build.getProperty('got_revision')%0A except KeyError:%0A pass%0A try:%0A return build.getProperty('revision')%0A except KeyError:%0A pass%0A
%0A%0Adef ge
|
1cdba0298bae8e9895662eccdb1858828c4a0258 | Make secure cookies configurable | bps/settings.py | bps/settings.py | import os, sys
from six.moves import configparser
from django.core.exceptions import ImproperlyConfigured
from .utils import read
CONFIG_FILE = '/etc/bps/config.ini'
try:
cfg = configparser.RawConfigParser()
cfg.read(CONFIG_FILE)
static_dir = cfg.get('locations', 'static_dir')
uploads_dir = cfg.g... | Python | 0.000003 | @@ -711,21 +711,21 @@
-https_only
+allowed_hosts
= c
@@ -744,73 +744,106 @@
', '
-https_only')%0A allowed_hosts = cfg.get('misc', 'allowed_hosts')
+allowed_hosts')%0A https_only = cfg.get('misc', 'https_only') in %5B'true', 'True', 'on', 'yes'%5D
%0A
@@ -883,16 +883,49 @@
'debug')
+ in %5B'tru... |
d635fc9129bc4ccfd5384be6958ae1c14e9916ec | Add persona merging to translation merge script | scripts/merge_translations.py | scripts/merge_translations.py | import sys
import yaml
def main(base_file, new_file, overwrite_language):
old = yaml.load(file(base_file).read())
new = yaml.load(file(new_file).read())
assert len(overwrite_language) == 2
for o, n in zip(old, new):
if overwrite_language in n['text']:
o['text'][overwrite_languag... | Python | 0 | @@ -27,32 +27,24 @@
def
-main(base_file, new_file
+persona(old, new
, ov
@@ -73,52 +73,40 @@
old
+_t
=
-yaml.load(file(base_file).read())
+old%5B'translations'%5D
%0A new
= y
@@ -105,60 +105,220 @@
new
+_t
=
-yaml.load(file(new_file).read())%0A%0A assert len(
+new%5B'translations'%5D%0A%0A for ... |
4c5894376f5efcf0eb95342b11740e0b039d14b8 | Fix carbon implicit reconnection limit | bucky/carbon.py | bucky/carbon.py | # -*- coding: utf-8 -
#
# 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, software
... | Python | 0 | @@ -1083,16 +1083,17 @@
nnects %3C
+=
0:%0A
|
59891c76620bcc0630f0d56bfac94040c8651233 | remove create key hook | profiles/apps.py | profiles/apps.py | from django.apps import AppConfig
def create_key_for_verified_user(sender, **kwargs):
from simplekeys.models import Key, Tier
email = kwargs["email_address"]
try:
Key.objects.get(email=email.email)
except Key.DoesNotExist:
Key.objects.create(
tier=Tier.objects.get(slug="de... | Python | 0.000001 | @@ -33,398 +33,8 @@
g%0A%0A%0A
-def create_key_for_verified_user(sender, **kwargs):%0A from simplekeys.models import Key, Tier%0A%0A email = kwargs%5B%22email_address%22%5D%0A try:%0A Key.objects.get(email=email.email)%0A except Key.DoesNotExist:%0A Key.objects.create(%0A tier=Tier... |
a3525ca5e11b37a1bc76b2bebd84cf0d3b93a0c2 | fix lightsource hotkeys | acq4/devices/LightSource/LightSource.py | acq4/devices/LightSource/LightSource.py | # -*- coding: utf-8 -*-
from __future__ import print_function
from acq4.devices.Device import *
from acq4.util import Qt
import acq4.util.Mutex as Mutex
from collections import OrderedDict
class LightSource(Device):
"""Device tracking the state and properties of multiple illumination sources.
"""
# emitte... | Python | 0.000009 | @@ -937,20 +937,23 @@
ressed,
+(
name
+,)
)%0A%0A d
|
cd9ead9ace60eef623a6d805d4be6721e94b3684 | Version 2.1.4 | main/__init__.py | main/__init__.py | # coding: utf-8
"""
gae-init
~~~~~~~~
Google App Engine with Bootstrap, Flask and tons of other cool features.
https://github.com/gae-init
http://gae-init.appspot.com
Copyright (c) 2012-2015 by Panayiotis Lipiridis.
License MIT, see LICENSE for more details.
"""
__version__ = '2.1.2'
| Python | 0 | @@ -280,11 +280,11 @@
= '2.1.
-2
+4
'%0A
|
30d8a42c8227775e27ab22bc7a119ea911060213 | Version 5.3.0 | main/__init__.py | main/__init__.py | # coding: utf-8
"""
gae-init
~~~~~~~~
Google App Engine with Bootstrap, Flask and tons of other cool features.
https://github.com/gae-init
https://gae-init.appspot.com
"""
__version__ = '5.2.1'
| Python | 0.000001 | @@ -190,9 +190,9 @@
'5.
-2.1
+3.0
'%0A
|
3a783f91a3cbb7e126af3f84969f92eb00a9a13d | Update dependency bazelbuild/bazel to latest version | third_party/bazel.bzl | third_party/bazel.bzl | # Copyright 2019 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | Python | 0.000011 | @@ -655,128 +655,128 @@
= %22
-c809cfce9212f6286353b47068add670f6a401dc%22%0Abazel_sha256 = %2295be88e25cacb58c05814c815eb4220b28588043f4a5017f378f3d8a26adbf14
+52fb54d6f62e3f5bf22d16e8e396878246a64584%22%0Abazel_sha256 = %2294285222af3fa6a068f8f325207781886fe35090bd561a2603cb3279d1fdef07
%22%0A
|
50e8cddf423e48c2b8a7c6d38e10ff9a634e198a | add some better checkingto do_put | lacli/command.py | lacli/command.py | import os
import cmd
import glob
from lacli.upload import pool_upload
class LaCommand(cmd.Cmd):
""" Our LA command line interface"""
prompt='lacli> '
def __init__(self, tokens, *args, **kwargs):
cmd.Cmd.__init__(self, *args, **kwargs)
self.tokens=tokens
def do_tvmconf(self, line):
... | Python | 0.000001 | @@ -487,16 +487,70 @@
lf, f):%0A
+ %22%22%22Upload a file to LA %5Bfilename%5D%0A %22%22%22%0A
@@ -557,32 +557,32 @@
fname=f.strip()%0A
-
if not f
@@ -652,16 +652,79 @@
if not
+fname:%0A print %22Argument required.%22%0A elif not
os.path.
@@ -791,17 +791,20 @@
... |
27025194263dd3f8ed734a3fb58c96616129af3a | update task time | gdc/grab.py | gdc/grab.py | #!/usr/bin/python
# coding=utf-8
import time, datetime
import sys, json
import random
import traceback
from datakit.mysql.suit import withMysql, dbpc
from hawkeye import initDB
from webcrawl.handleRequest import PROXY
from webcrawl.work import Workflows
import task
WDB = 'local'
RDB = 'local'
LIMIT = 600
initDB()
@w... | Python | 0.000007 | @@ -3480,16 +3480,37 @@
atus%60=%25s
+, %60update_time%60=now()
where i
|
03a78a509c0213f8f95223a7926a1bce547f05fe | Initialize parent_pid in the Proc class init. | rotterdam/proc.py | rotterdam/proc.py | import logging
import os
import signal
from setproctitle import setproctitle
class Proc(object):
signal_map = {}
def __init__(self):
self.logger = logging.getLogger(self.__module__)
self.pid = None
@property
def name(self):
return self.__class__.__name__.lower()
def s... | Python | 0 | @@ -220,16 +220,47 @@
d = None
+%0A self.parent_pid = None
%0A%0A @p
|
27768a69784f267af822b6b763a5c526285c7ba2 | print out evaluation data. | predictor.py | predictor.py | #!/usr/bin/python
import util
import chordKMeans
import sys
import random
import numpy as np
np.set_printoptions(formatter={'float': lambda x: '%.2f\t'%x})
# part 1
if len(sys.argv) == 1:
midiFileName = 'default.mid'
else:
midiFileName = sys.argv[1]
barLists = util.getNGramBarList(midiFileName)
for x in barLis... | Python | 0.000003 | @@ -486,18 +486,38 @@
ids%5B1%5D%0A%0A
-#
+for i in range(20) :%0A%09
featureC
@@ -571,16 +571,140 @@
FileName
+, 12)%0A%09print %22for k = %25s%22%25i%0A%09print chordKMeans.evaluateKmeansClusters(midiFileName, featureCentroids%5B0%5D, featureCentroids%5B1%5D
)%0A%0A%0A# wa
|
3f6b85b912c8819b362db5b37533c0810d7ce45d | Add tests for Varsh rule 8.7.2 (4) | tests/nuclear_test.py | tests/nuclear_test.py | """Tests for special utilities related to nuclear problems."""
import pytest
from sympy import Symbol, simplify, latex
from drudge import NuclearBogoliubovDrudge
from drudge.nuclear import JOf, TildeOf, MOf, NOf, LOf, PiOf, TOf
@pytest.fixture(scope='module')
def nuclear(spark_ctx):
"""Set up the drudge to test... | Python | 0 | @@ -112,16 +112,41 @@
y, latex
+, symbols, KroneckerDelta
%0A%0Afrom d
@@ -181,16 +181,23 @@
ovDrudge
+, Range
%0Afrom dr
@@ -254,16 +254,20 @@
iOf, TOf
+, CG
%0A%0A%0A@pyte
@@ -1009,20 +1009,903 @@
1) ** (i * 2)) == 1%0A
+%0A%0Adef test_varsh_872_4(nuclear: NuclearBogoliubovDrudge):%0A %22%22%22Test simplifi... |
ee6224bce1336bd0cf812033737a1a8c61c6323d | Update pydocs feature clean up (owner of the feature/application) (Lead: Kunal) | build/org.csstudio.validation.scripts/check_feature.py | build/org.csstudio.validation.scripts/check_feature.py | '''
Created on Sep 17, 2014
A simple script which scans all feature.xml files under the directory it was invoked from to ensure that none of them explicitly define JRE container
@author: Kunal Shroff
'''
import os.path
import sys
import xml.etree.ElementTree as ET
defaultDesc = "[Enter Feature Description here.]"... | Python | 0 | @@ -122,16 +122,20 @@
ensure
+%0A1.
that non
@@ -175,16 +175,189 @@
ontainer
+%0A2. All features have a provider%0A3. All features have a description or description URL%0A4. No features have required plugins, tycho should take care of dependency resolution.
%0A%0A@aut
|
1f418a7b6aa2f7879e32dc6857a3cb376485f1fc | Disable schema version update until FCS | csmserver/schema/base.py | csmserver/schema/base.py | # =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# Redistributions of sour... | Python | 0 | @@ -1819,32 +1819,34 @@
.version%0A
+ #
db_session.comm
|
142cfbae484ce6c83429929ded8457da476a5b43 | replace or no replace option | scripts/queue_deep_harvest.py | scripts/queue_deep_harvest.py | #! /bin/env python
# -*- coding: utf-8 -*-
import sys
import logbook
from rq import Queue
from redis import Redis
from harvester.config import parse_env
JOB_TIMEOUT = 172800 # 48 hrs
def queue_deep_harvest(redis_host,
redis_port,
redis_password,
r... | Python | 0.000017 | @@ -394,24 +394,62 @@
lection_id,%0A
+ replace=False,%0A
@@ -477,24 +477,24 @@
B_TIMEOUT):%0A
-
'''Queue
@@ -839,16 +839,33 @@
ction_id
+, replace=replace
),%0A
@@ -988,32 +988,47 @@
eout=JOB_TIMEOUT
+, replace=False
):%0A ''' Queue
@@ -1490,24 +1490,53 @@
ion_id=... |
aec70e8fdc3006dba78254ecab3dcfcf35541cc2 | Add es hosts to dev_settings.py | dev_settings.py | dev_settings.py | """
This is a home for shared dev settings. Feel free to add anything that all
devs should have set.
Add `from dev_settings import *` to the top of your localsettings file to use.
You can then override or append to any of these settings there.
"""
import os
LOCAL_APPS = (
'django_extensions',
'kombu.transpor... | Python | 0 | @@ -2768,16 +2768,193 @@
ROCESSED = True%0A
+%0AELASTICSEARCH_HOST_PROD = 'hqes0.internal-va.commcarehq.org'%0AELASTICSEARCH_HOST_STAGING = 'hqes0-staging.internal-va.commcarehq.org'%0AELASTICSEARCH_HOST_INDIA = '10.162.36.221'%0A
|
364bee25b8861e5caaa33adbaf2f2f2be6260958 | Use has_header instead of has_key here. | tinymce/compressor.py | tinymce/compressor.py | """
Based on "TinyMCE Compressor PHP" from MoxieCode.
http://tinymce.moxiecode.com/
Copyright (c) 2008 Jason Davies
Licensed under the terms of the MIT License (see LICENSE.txt)
"""
from datetime import datetime
import os
from django.conf import settings
from django.core.cache import cache
from django... | Python | 0 | @@ -4363,19 +4363,22 @@
nse.has_
-key
+header
(header)
|
496dbc1745379d122710641fcf872c2b2e70ed2c | validate nicknames | mammon/events.py | mammon/events.py | #!/usr/bin/env python
# mammon - a useless ircd
#
# Copyright (c) 2015, William Pitcock <nenolod@dereferenced.org>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in... | Python | 0.999999 | @@ -1087,16 +1087,66 @@
ersion__
+%0Afrom .utility import validate_nick, validate_chan
%0A%0Aclass
@@ -3077,24 +3077,149 @@
params'%5D%5B0%5D%0A
+ if not validate_nick(new_nickname):%0A cli.dump_numeric('432', %5Bnew_nickname, 'Erroneous nickname'%5D)%0A return%0A
if new_n
|
7f31192c0936224dc0810d84ac6bd6131376e61e | Bump to version 0.10.0 | titlecase/__init__.py | titlecase/__init__.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Original Perl version by: John Gruber http://daringfireball.net/ 10 May 2008
Python version by Stuart Colville http://muffinresearch.co.uk
License: http://www.opensource.org/licenses/mit-license.php
"""
import argparse
import re
import sys
__all__ = ['titlecase']
__v... | Python | 0 | @@ -331,9 +331,10 @@
'0.
-9
+10
.0'%0A
|
b3b7161bc15bdc9f37a3bdd0cebce139ba1ba70a | use current directory | titles/fill-titles.py | titles/fill-titles.py | #!/usr/bin/python3
# add a title to any functal without one
import os
#import re
#import sys
# import json
#import random
#import collections
import time
import subprocess
from pprint import pprint
# pp = pprint.PrettyPrinter(indent=4)
import pymongo
client = pymongo.MongoClient(os.getenv('mongo_functal'))
db_topi... | Python | 0.000001 | @@ -1095,24 +1095,26 @@
cess.call(%5B'
+./
get-tweets.p
@@ -1165,16 +1165,18 @@
.call(%5B'
+./
get-titl
|
235de58b16995b610ec06c28e6340e81fbc46b7b | Remove unused import | custom/ewsghana/forms.py | custom/ewsghana/forms.py | from corehq import toggles
from corehq.apps.reminders.forms import BroadcastForm
from corehq.apps.reminders.models import (RECIPIENT_USER_GROUP,
RECIPIENT_LOCATION)
from crispy_forms import layout as crispy
from django import forms
from django.core.exceptions import ValidationError
from django.utils.translation imp... | Python | 0.000001 | @@ -1,31 +1,4 @@
-from corehq import toggles%0A
from
|
351b59f0abeb0057840f54076a7fcb1f757068d9 | fix bz2 API usage | tools/apache_count.py | tools/apache_count.py | import sys, os, re, psycopg, ConfigParser, urlparse, gzip, bz2
from mx.DateTime import DateTime
from mx.DateTime.Timezone import utc_offset
logre=re.compile(r"\[(?P<day>..)/(?P<month>...)/(?P<year>....):"
r"(?P<hour>..):(?P<min>..):(?P<sec>..) "
r'(?P<zone>.*)\] "GET (?P<path>[^ "... | Python | 0.000004 | @@ -1154,20 +1154,23 @@
f = bz2.
-open
+BZ2File
(filenam
|
06cd9e70c2af1633b4a597020d7d5ffa8cdc6b46 | Change some names | cyder/base/eav/fields.py | cyder/base/eav/fields.py | from django import forms
from django.core.exceptions import ValidationError
from django.db import models
from south.modelsinspector import add_introspection_rules
from cyder.base.eav import validators
from cyder.base.eav.constants import (ATTRIBUTE_TYPES, ATTRIBUTE_INFORMATIONAL,
... | Python | 0.967353 | @@ -3476,34 +3476,24 @@
if '
-attribute_
type_choices
@@ -3595,26 +3595,16 @@
kwargs%5B'
-attribute_
type_cho
@@ -3749,34 +3749,24 @@
kwargs.pop('
-attribute_
type_choices
@@ -3987,16 +3987,22 @@
(choices
+_query
=self.re
@@ -4020,16 +4020,50 @@
ices_to,
+%0A
**kwarg
... |
88ebd80f6c1abde038cc2c31105be67a142883b5 | Modify example for consistency and ease of viewing | examples/inverse/plot_lcmv_beamformer_volume.py | examples/inverse/plot_lcmv_beamformer_volume.py | """
===================================================================
Compute LCMV inverse solution on evoked data in volume source space
===================================================================
Compute LCMV inverse solution on an auditory evoked dataset in a volume source
space with three different setti... | Python | 0 | @@ -686,16 +686,49 @@
rt lcmv%0A
+from mne.viz import tight_layout%0A
%0A%0Adata_p
@@ -2176,13 +2176,12 @@
ze=(
-17, 5
+9, 3
))%0Af
@@ -2209,33 +2209,33 @@
plots(nrows=
-1
+3
, ncols=
3, figsize=(
@@ -2214,33 +2214,33 @@
(nrows=3, ncols=
-3
+1
, figsize=(18, 5
@@ -2238,13 +2238,12 @@
ze=(
-1
8,
-5
+6
))%0A... |
5fb72b988f4d0348d1f449a795bedc6ecb56ed76 | Remove lasagne.utils.concatenate. Closes #151. | lasagne/utils.py | lasagne/utils.py | import numpy as np
import theano
import theano.tensor as T
def floatX(arr):
"""
Shortcut to turn a numpy array into an array with the
correct dtype for Theano.
"""
return arr.astype(theano.config.floatX)
def shared_empty(dim=2, dtype=None):
"""
Shortcut to create an empty Theano shared ... | Python | 0 | @@ -1693,612 +1693,8 @@
t%0A%0A%0A
-def concatenate(tensor_list, axis=0):%0A %22%22%22%0A This function was used to work around a deficiency in Theano's%0A %60theano.tensor.concatenate%60 (the inverse operation, splitting, was not%0A available on GPU). As of 2015-02-25, this deficiency has been removed,%0A... |
a85ac73dd423fed34f1815a908730f62caec6787 | Work around user agents with commas. | tools/apache_stats.py | tools/apache_stats.py | import os
import csv
import bz2
import gzip
import re
import urllib2
import socket
from apache_reader import ApacheLogReader
# dictionary key structure: filename, user_agent, package_name
class LocalStats(object):
"""Base class that writes the log file
"""
def _get_logs(self, logfile, file_urls):
... | Python | 0 | @@ -4091,16 +4091,168 @@
reader:%0A
+ # work around user agents with commas%0A while len(line) %3E 4:%0A line%5B2%5D += ',' + line%5B3%5D%0A del line%5B3%5D%0A
|
86fea752c68ff5786556f5555ca580f2d0a9de85 | fix bug with debug handling | latvm/session.py | latvm/session.py | from latvm.tvm import MyTvm
from boto import config as boto_config
from boto.exception import NoAuthHandlerFound
class NoCredentialsException(Exception): pass
class UploadSession(object):
def __init__(self, uid=None, secs=3600, bucket='lastage', retries=0, debug=0):
self.uid=uid
self.secs=3600
... | Python | 0.000001 | @@ -520,16 +520,22 @@
ocessing
+ as mp
%0A
@@ -540,30 +540,17 @@
m
-ultiprocessing
+p
.util.lo
|
ecfa10c8240ad41fba563efacb9d5ca5c8c1e2b9 | Improve output | downloader/downloader.py | downloader/downloader.py | #!/usr/bin/env python
GOOGLE_LOGIN = GOOGLE_PASSWORD = AUTH_TOKEN = None
from humanfriendly import parse_size
from googleplay import GooglePlayAPI
from contextlib import closing
from argparse import ArgumentParser
from colorama import init, Fore
from config import *
import sqlite3
import os
init(autoreset=True)
cre... | Python | 0.999999 | @@ -1483,17 +1483,16 @@
g %25s ...
-
' %25 pkg,
@@ -1598,19 +1598,20 @@
'%5BS
-ize
+KIP:
too big
: (%25
@@ -1610,16 +1610,8 @@
big
-: (%25s) %3E
(%25s
@@ -1616,31 +1616,20 @@
%25s)%5D' %25
-(
size
-, maxsize)
%0A
@@ -1971,17 +1971,21 @@
EEN + '%5B
-D
+OK: d
ownloade
|
df5fb87b8fa92e32ea0230fc4623e0144dc67e7d | Fix get cluster vlans | fuelweb_test/nailgun_client.py | fuelweb_test/nailgun_client.py | import logging
from fuelweb_test.helpers import HTTPClient
from fuelweb_test.integration.decorators import debug, json_parse
logger = logging.getLogger(__name__)
logwrap = debug(logger)
class NailgunClient(object):
def __init__(self, ip):
self.client = HTTPClient(url="http://%s:8000" % ip)
super... | Python | 0 | @@ -3902,32 +3902,44 @@
orks(cluster_id)
+%5B'networks'%5D
:%0A am
@@ -3952,27 +3952,16 @@
network
-%5B'network'%5D
.get('am
@@ -4014,35 +4014,24 @@
ge(network%5B'
-network'%5D%5B'
vlan_start'%5D
@@ -4084,19 +4084,8 @@
rk%5B'
-network'%5D%5B'
vlan
|
ce6a3a3833d498fa32a5317fd95e206cad9d5a83 | Add importing from __future__ & revise main() | alg_gcd.py | alg_gcd.py | def gcd(m, n):
"""Greatest Common Divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while n != 0:
m, n = n, m % n
return m
def main():
print(gcd(4, 2))
print(gcd(2, 4))
print(gcd(10, 4))
print(gcd(4, 10))
print(gcd(10, 1))
print(gcd(1, 10))
if _... | Python | 0.000001 | @@ -1,12 +1,123 @@
+from __future__ import absolute_import%0Afrom __future__ import division%0Afrom __future__ import print_function%0A%0A%0A
def gcd(m, n
@@ -292,24 +292,25 @@
:%0A print(
+'
gcd(4, 2))%0A
@@ -306,16 +306,39 @@
cd(4, 2)
+: %7B%7D'.format(gcd(4, 2))
)%0A pr
@@ -337,24 +337,25 @@
)%0A pri... |
6357d5e9e255b14ceb5f2905d4782837e4761738 | Revise gcd algorithm | alg_gcd.py | alg_gcd.py | def compute_gcd(m, n):
"""Compute the greatest common divisor (GCD) by Euclid's Algorithm.
Time complexity: O(m%n).
"""
while m % n != 0:
old_m = m
old_n = n
m = old_n
n = old_m % old_n
return n
| Python | 0.00018 | @@ -1,16 +1,8 @@
def
-compute_
gcd(
@@ -19,29 +19,17 @@
%22%22%22
-Compute the g
+G
reatest
comm
@@ -28,16 +28,16 @@
est
-c
+C
ommon
-d
+D
ivis
@@ -119,12 +119,8 @@
hile
- m %25
n !
@@ -136,89 +136,219 @@
-old_m = m%0A old_n = n%0A m = old_n%0A n = old_m %25 old_n%0A return... |
cafd5d4a97b21ebf55d31c545028cd0b1554145a | Simplify if statement check | gaphor/services/copyservice.py | gaphor/services/copyservice.py | """
Copy / Paste functionality
"""
from typing import Dict, Set
import gaphas
from gaphor.UML import Element
from gaphor.UML.collection import collection
from gaphor.core import _, event_handler, action, transactional
from gaphor.abc import Service, ActionProvider
from gaphor.ui.event import DiagramSelectionChange
... | Python | 0.001149 | @@ -1637,36 +1637,24 @@
action_group
- is not None
:%0A
@@ -4669,20 +4669,8 @@
roup
- is not None
:%0A
|
c52b92c4f977bbb7eede968fad98113a5fe6c441 | Bump gtk-sharp to a newer build | packages/gtk-sharp-2.12-release.py | packages/gtk-sharp-2.12-release.py | class GtkSharp212ReleasePackage (Package):
def __init__ (self):
Package.__init__ (self, 'gtk-sharp', '2.12.12', sources = ['http://files.xamarin.com/~alan/gtk-sharp-2.12.12.tar.gz'])
# self.configure = './bootstrap-2.12 --prefix="%{prefix}"'
self.make = 'make CSC=gmcs'
GtkSharp212ReleasePackage ()
| Python | 0 | @@ -103,18 +103,18 @@
, '2.12.
-1
2
+1
', sourc
@@ -150,10 +150,12 @@
om/~
-al
+dunc
an/g
@@ -168,18 +168,18 @@
rp-2.12.
-1
2
+1
.tar.gz'
|
0b45ec48955f73a0e88422660af82ff6fd89333b | Use Tuesday branch on Tuesdays | tools/crons/newwoz.py | tools/crons/newwoz.py | import os
import django
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "museum.settings")
django.setup()
print("NEW WOZZT TEST")
from museum_site.wozzt_queue import WoZZT_Queue # noqa: E402
def main():
entry = WoZZT_Queue.objects.all().order_by("-priority", "id")[0]
entry.send_tweet()
entry.delete_... | Python | 0 | @@ -19,16 +19,47 @@
django%0A%0A
+from datetime import datetime%0A%0A
os.envir
@@ -137,33 +137,8 @@
()%0A%0A
-print(%22NEW WOZZT TEST%22)%0A%0A
from
@@ -217,41 +217,217 @@
-entry = WoZZT_Queue.objects.all()
+now = datetime.now()%0A%0A if now.weekday() == 1: # Tuesday%0A entry = WoZZT_Queue.objects.... |
b9fdcc06123e3703da3681fda8b89e2ad37b737f | make it compatible with Windows | tests/test_anitopy.py | tests/test_anitopy.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import TestCase
import anitopy
from tests.fixtures.table import table
FAILING_CASES = [
4, 13, 21, 28, 38, 63, 68, 69, 70, 75, 77, 80, 81, 82, 87, 90, 92, 97, 100,
102, 110, 111, 112, 114, 120, 123, 128, 129, 136, 137, 142, 143, 1... | Python | 0.000001 | @@ -1351,32 +1351,53 @@
ions(entry%5B1%5D)%0A%0A
+ try:%0A
prin
@@ -1434,16 +1434,113 @@
lename))
+%0A except:%0A print(('Index %25d %22%25s%22' %25 (index, filename)).encode(%22utf-8%22))
%0A%0A
|
bd9e73cf96d623f62ef1bdd5439377a95a94f5bb | Fix index helper function to use real index generator | tests/test_data_io.py | tests/test_data_io.py | def help_first_n_indices_of_generator_are_correct(data_point_generator, number_of_points, correct_index):
from itertools import islice
from utils.data_io import data_points
from utils.data_paths import ALL_DATA_FILE_PATH, ALL_INDEX_FILE_PATH
all_data = data_points(ALL_DATA_FILE_PATH)
all_indices = d... | Python | 0.000002 | @@ -165,32 +165,41 @@
port data_points
+, indices
%0A from utils.
@@ -321,26 +321,22 @@
dices =
-data_point
+indice
s(ALL_IN
@@ -507,20 +507,16 @@
index =
-int(
next(all
@@ -528,12 +528,8 @@
ces)
-%5B0%5D)
%0A
|
ed89c92ac56e89648bf965ea3aa8963e840e3a5c | Fix the unit test :) | tests/test_excuses.py | tests/test_excuses.py | # Copyright 2017 Starbot Discord Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0.000014 | @@ -834,37 +834,33 @@
xcuse%22%0A%0A
-fullE
+e
xcuseList = %5B%5D%0A%0A
@@ -860,85 +860,673 @@
= %5B
-%5D%0A%0A for sorry in excuses.sorryList:%0A for excuse in
+%22I have an appointment with a robot.%22, %0A %22I was abducted by robots.%22, %0A %22I didn%E2%80%99t know what ... |
1c96f5f79535c046eec021a22170fa16ca9a36e3 | Remove set/get_data tests. Those methods are deprecated in pygobject. | tests/test_objects.py | tests/test_objects.py | # Copyright 2012 Christoph Reiter
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
import unittest
class ObjectTest(unittest.TestCase):
def test_classes(self):
g = GOb... | Python | 0 | @@ -462,398 +462,8 @@
))%0A%0A
- def test_gobject(self):%0A c = Gtk.AccelMap()%0A c.set_data(%22xx%22, 3)%0A%0A g = GObject.Object()%0A g.set_data(%22xx%22, 42)%0A self.assertEqual(g.get_data(%22xx%22), 42)%0A%0A a = GObject.Object()%0A a.set_data(%22xx%22, 24)%0A ... |
38749a0033c2acc6c9fd8971749c68f93cb9c0db | Add virtualenv.create function to enable easy virtualenv creation | virtualenv/__init__.py | virtualenv/__init__.py | from __future__ import absolute_import, division, print_function
from virtualenv.__about__ import (
__author__, __copyright__, __email__, __license__, __summary__, __title__,
__uri__, __version__
)
__all__ = [
"__title__", "__summary__", "__uri__", "__version__", "__author__",
"__email__", "__license... | Python | 0.000001 | @@ -200,16 +200,51 @@
ion__%0A)%0A
+from virtualenv.core import create%0A
%0A%0A__all_
@@ -370,10 +370,24 @@
ght__%22,%0A
+ %22create%22,%0A
%5D%0A
|
3e9b66236fa6896b197c34fe18f221fd32955937 | Print syntax. | tests/test_scripts.py | tests/test_scripts.py | # encoding: utf-8
import logging
from pprint import pformat
from unittest import TestCase
from marrow.util.compat import IO, unicode
from marrow.script.core import *
from marrow.script import annotate, describe
def simple():
"A simple function that takes no arguments."
print "Hello world!"
def retval(... | Python | 0.000001 | @@ -12,16 +12,55 @@
utf-8%0A%0A
+from __future__ import print_function%0A%0A
import l
@@ -319,25 +319,25 @@
.%22%0A print
-
+(
%22Hello world
@@ -338,16 +338,17 @@
world!%22
+)
%0A%0A%0Adef r
@@ -445,17 +445,17 @@
print
-
+(
%22Farewel
@@ -469,16 +469,17 @@
world!%22
+)
%0A ret
@@ -703,38 +703,3... |
613b3fbae8444d085a02531cb80fd9da10ae9b7e | Fix bug in dot-style attention | seq2seq/decoders/attention.py | seq2seq/decoders/attention.py | """ Implementations of attention layers.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from seq2seq.graph_module import GraphModule
import tensorflow as tf
from tensorflow.python.framework import function
from tensorflow.python.ops import math_ops
@f... | Python | 0 | @@ -811,25 +811,25 @@
ce_sum(keys
-+
+*
tf.expand_d
|
65a3c3c28a673e1924441fbf42f172aba410921b | use print and catch keyboard interrupt | dusty/commands/client.py | dusty/commands/client.py | import subprocess
import logging
def call_command_from_client(shell_args, env=None):
logging.info("Running command: {}".format(' '.join(shell_args)))
subprocess.call(shell_args, env=env)
| Python | 0.000002 | @@ -87,21 +87,14 @@
-logging.info(
+print
%22Run
@@ -139,18 +139,30 @@
l_args))
-)
%0A
+ try:%0A
subp
@@ -194,8 +194,98 @@
nv=env)%0A
+ except KeyboardInterrupt:%0A print %22KeyboardInterrupt; terminating%22%0A pass%0A
|
67ee63136e69d0c326be81e1ace72168af3dc2b3 | update try to nocaptcha packages | dynaform/forms/fields.py | dynaform/forms/fields.py | # *-* coding:utf-8 *-*
import json
from django import forms
from dynaform.forms import widgets as custom_widgets
# Try importing ReCaptchaField
try:
import ReCaptchaField
except ImportError:
try:
from captcha.fields import ReCaptchaField
except ImportError:
print 'ReCaptchaField was not loa... | Python | 0 | @@ -268,24 +268,178 @@
mportError:%0A
+ try: %0A from nocaptcha_recaptcha.fields %5C%0A import NoReCaptchaField as ReCaptchaField%0A except ImportError:%0A
prin
|
deb446e5da18815ac22890a855502d989a2663e7 | Add passing tilemap render test | tests/test_tilemap.py | tests/test_tilemap.py | import os
import textwrap
import pygame
from .. import sappho
from ..sappho.tilemap import Tile
class TestTile(object):
def test_tile_instantiation(self):
surface = pygame.surface.Surface((1, 1))
tile = Tile(0, surface)
assert(tile.id_ == 0)
assert(tile.solid_block == False) # d... | Python | 0 | @@ -1822,11 +1822,11 @@
5,
-4,3
+3,4
%0A
@@ -2318,16 +2318,24 @@
MAP_CSV)
+.strip()
%0A
@@ -2777,16 +2777,16 @@
0, 0)) %0A
-
@@ -2831,16 +2831,1015 @@
ight == (1, 1))%0A
+%0A def test_render(self):%0A csv = textwrap.dedent(self.TILEMAP_CSV).strip()%0A tilemap = sappho.TileMa... |
69573b07009f09eebba551db7d151f56660029b0 | Update time_selfies.py | tests/time_selfies.py | tests/time_selfies.py | import os
import random
import time
from rdkit.Chem import Kekulize, MolFromSmiles, MolToSmiles
import selfies as sf
from selfies.encoder import _parse_smiles
from selfies.kekulize import kekulize_parser
def time_roundtrip(file_path: str, sample_size: int = -1):
"""Tests the amount of time it takes to encode an... | Python | 0.000002 | @@ -372,18 +372,8 @@
ings
- %3Cn%3E times
. If
|
52366b97b4102e4295a053b93e414ace6aa1aaf3 | optimize code | urlfetch.py | urlfetch.py | #coding: utf8
import httplib
import socket
import urllib
import urlparse
from uas import randua
def setcookie2cookie(setcookie):
cookies = setcookie.split("\n")
result = []
for ck in cookies:
frags = ck.split(";")
i = frags[0].index("=")
name = frags[0][:i]
value = frags[0... | Python | 0.999117 | @@ -1364,1216 +1364,85 @@
-scheme, netloc, path, query, fragment = urlparse.urlsplit(url)%0A %0A if ':' in netloc:%0A host, port = netloc.rsplit(':', 1)%0A port = int(port)%0A else:%0A host, port = netloc, 80%0A %0A if scheme == 'https':%0A h = httplib.HTTPSConnection(ho... |
7508d48b12c88b37247ceeac9d3e15eb6c1fbfaa | Refactor and simplify parser | metatab/_meta.py | metatab/_meta.py | __version__ = '0.0.8'
__author__ = 'eric@civicknowledge.com' | Python | 0.000017 | @@ -16,9 +16,9 @@
0.0.
-8
+9
'%0A__
|
20f9bbab583dea200a38da2578fbb9bc7bafaf92 | add 'dask_client_create()' to pyxrf.api package | pyxrf/api.py | pyxrf/api.py | from .model.fileio import (stitch_fitted_results, spec_to_hdf, create_movie, # noqa: F401
combine_data_to_recon, h5file_for_recon, export_to_view, # noqa: F401
make_hdf_stitched) # noqa: F401
from .model.load_data_from_db import make_hdf, export1d # noqa: F401
... | Python | 0.000001 | @@ -576,55 +576,59 @@
401%0A
-%0A#
from .
-model.command_tools import pyxrf_batch
+core.map_processing import dask_client_create
#
@@ -1884,16 +1884,114 @@
S maps%0A%0A
+ Dask client:%0A dask_client_create - returns Dask client for use in batch scripts%0A%0A
|
775c536de5e110163d960782d986a3a85b62746d | Fix vlc lowering volume while not playing. | mycroft/audio/services/vlc/__init__.py | mycroft/audio/services/vlc/__init__.py | # Copyright 2017 Mycroft AI Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | Python | 0 | @@ -1449,32 +1449,92 @@
al_volume = None
+%0A self.low_volume = self.config.get('low_volume', 30)
%0A%0A def track_
@@ -2653,16 +2653,45 @@
is None
+ and self.player.is_playing()
:%0A
@@ -2798,25 +2798,18 @@
elf.
-normal
+low
_volume
- / 5
)%0A%0A
|
a1bcb852fa84fa8d15cd7411751180f6a6ad1e79 | Fix default implementation | docido_sdk/core.py | docido_sdk/core.py |
class DocidoError(Exception):
pass
class Interface(object):
"""Marker base class for extension point interfaces."""
class ExtensionPoint(property):
"""Marker class for extension points in components."""
def __init__(self, interface):
"""Create the extension point.
:param interface:... | Python | 0.000003 | @@ -6241,16 +6241,36 @@
%22%22%22
+%0A return True
%0A%0A de
|
b4cb37cf7e08a328c80e560d6a13d69730c5df3d | Remove the TODO - this is completed | nflpool/services/new_season_service.py | nflpool/services/new_season_service.py | from nflpool.data.seasoninfo import SeasonInfo
from nflpool.data.dbsession import DbSessionFactory
import requests
import pendulum
import nflpool.data.secret as secret
from requests.auth import HTTPBasicAuth
class NewSeasonService:
@staticmethod
def get_install():
return []
'''After first time in... | Python | 0.000002 | @@ -1214,112 +1214,8 @@
%22%5D%0A%0A
- # TODO Refactor the first game date and time in the database and change ID in the template%0A%0A
|
38c094b23d455ea48178d7705f402822dfc7b727 | Check opt group and type for nova.conf.service.py | nova/conf/service.py | nova/conf/service.py | # needs:fix_opt_description
# needs:check_deprecation_status
# needs:check_opt_group_and_type
# needs:fix_opt_description_indentation
# needs:fix_opt_registration_consistency
# Copyright 2015 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# ... | Python | 0.000004 | @@ -58,41 +58,8 @@
tus%0A
-# needs:check_opt_group_and_type%0A
# ne
@@ -1599,27 +1599,26 @@
'),%0A cfg.
-Str
+IP
Opt('osapi_c
@@ -1746,34 +1746,35 @@
ten.'),%0A cfg.
-In
+Por
tOpt('osapi_comp
@@ -1824,56 +1824,8 @@
74,%0A
- min=1,%0A max=65535,%0A
@@ -2284,35 +2284,34 @@
... |
f7f1ba45834c007c2559b1f45ec8b6143c134b81 | Fix python3 syntax in lang_HE | num2words/lang_HE.py | num2words/lang_HE.py | # -*- encoding: utf-8 -*-
# Copyright (c) 2003, Taro Ogawa. All Rights Reserved.
# Copyright (c) 2013, Savoir-faire Linux inc. All Rights Reserved.
# 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... | Python | 0.99997 | @@ -909,16 +909,32 @@
literals
+, print_function
%0A%0AZERO =
@@ -3682,17 +3682,17 @@
print
-
+(
num, yo.
@@ -3707,10 +3707,11 @@
nal(num)
+)
%0A%0A
|
731c83fd5ebe79a7643465e68310c11387b427e8 | Remove unused imports | setuptools/tests/test_develop.py | setuptools/tests/test_develop.py | """develop tests
"""
import os
import shutil
import site
import sys
import tempfile
import pytest
from setuptools.command.develop import develop
from setuptools.dist import Distribution
from . import contexts
SETUP_PY = """\
from setuptools import setup
setup(name='foo',
packages=['foo'],
use_2to3=True,
)
... | Python | 0.000001 | @@ -36,52 +36,22 @@
rt s
-hutil%0Aimport site%0Aimport sys%0Aimport tempfile
+ite%0Aimport sys
%0A%0Aim
|
2c17eac88106749344281686e7f83929d5883120 | add test for Pathhelper | server/Mars/Lib/PathHelper.py | server/Mars/Lib/PathHelper.py | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
#
# Copyright (c) 2016 ASMlover. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyrig... | Python | 0.000002 | @@ -2027,24 +2027,203 @@
Path(path)%0A return 1%0A
+%0A%0Aif __name__ == '__main__':%0A import sys%0A print('current sys.path %3E%3E%3E %25s' %25 sys.path)%0A print()%0A addPathes('./', '../')%0A print('current sys.path %3E%3E%3E %25s' %25 sys.path)%0A
|
2c50903030c8a00ce253acfd5ce3353f89ea039a | Update embed function | thinc/layers/embed.py | thinc/layers/embed.py | from typing import Callable, Tuple, Optional
from ..model import Model
from ..config import registry
from ..types import Array2d
from ..initializers import uniform_init
from ..util import get_width
InT = Array2d
OutT = Array2d
@registry.layers("Embed.v0")
def Embed(
nO: Optional[int] = None,
nV: int = 1,
... | Python | 0 | @@ -1720,27 +1720,16 @@
.ops
-.alloc_f2d(*
+,
shape)
-)
%0A
|
1d356aa98af97894cb4c16e32d83bc3c774c840a | Bump up the version to 2.1 | thingflow/__init__.py | thingflow/__init__.py | # Copyright 2016 by MPI-SWS and Data-Ken Research.
# Licensed under the Apache 2.0 License.
"""
This is the main package for antevents. Directly within this package you fill
find the following module:
* `base` - the core abstractions and classes of the system.
The rest of the functionality is in sub-packages:
* `a... | Python | 0.999673 | @@ -564,13 +564,13 @@
__ = %222.
-0
+1
.0%22%0A
|
0f47282af3845eafabb36f3cfa41557aef2445ed | Bump version to 1.2.7 | oioswift/__init__.py | oioswift/__init__.py | __version__ = '1.2.4'
| Python | 0 | @@ -16,7 +16,7 @@
1.2.
-4
+7
'%0A
|
50029c6b5aff74d71e6b6d3ae17a371cba3833b2 | Fix broken creation of database in previous commit - d'oh | openerp/loglevels.py | openerp/loglevels.py | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | Python | 0 | @@ -4866,16 +4866,41 @@
treated
+ when converting a string
: 'stric
@@ -4925,16 +4925,24 @@
eplace'.
+%0A
Passing
@@ -4950,24 +4950,16 @@
anything
-%0A
other t
@@ -4991,16 +4991,24 @@
he first
+%0A
encodin
@@ -5023,22 +5023,14 @@
will
-%0A succe
+ be us
ed,
@@ -5057,16 +5057,2... |
afbad0107b28c4d6ff678df8c2206dd941696b05 | version bumped to 1.5.0 | openlego/__init__.py | openlego/__init__.py | __version__ = '1.4.0'
name = 'openlego'
| Python | 0 | @@ -14,9 +14,9 @@
'1.
-4
+5
.0'%0A
|
92d8083277ca46fa42fa728c98db16e3325cd976 | Format ping data display in chart | parser.py | parser.py | import os
import re
class Parser(object):
"""Parse output from Speedtest CLI into JSON"""
def parse_all(self):
# needs:
# labels (timestamps)
# data (ping/dl/ul speed)
records = []
labels = []
download_speeds = []
upload_speeds = []
for file in o... | Python | 0 | @@ -284,32 +284,57 @@
oad_speeds = %5B%5D%0A
+ ping_speeds = %5B%5D%0A
for file
@@ -353,24 +353,24 @@
ir(%22data%22):%0A
-
@@ -694,32 +694,83 @@
cord%5B%22upload%22%5D)%0A
+ ping_speeds.append(record%5B%22ping%22%5D)%0A
datasets
@@ -1604,24 +1604,441 @@
187,205,... |
6d9dbc7e99ff8dabd26bc8ee323bce4bee3c5fb4 | bump version | elephantblog/__init__.py | elephantblog/__init__.py | from __future__ import absolute_import, unicode_literals
VERSION = (0, 3, 2)
__version__ = '.'.join(map(str, VERSION))
| Python | 0 | @@ -72,9 +72,9 @@
3,
-2
+3
)%0A__
|
e98469887a8714c90b505cb519a87d4025599584 | Check for no filename | lcapy/circuit.py | lcapy/circuit.py | """This module provides circuit analysis using modified nodal analysis
(MNA).
The circuit is described using netlists, similar to SPICE, but with
arbitrary node names (except for the ground node which is labelled 0).
The netlists can be loaded from a file or created at run-time. For
example:
>>> from lcapy import Ci... | Python | 0.000058 | @@ -3331,16 +3331,41 @@
if
+filename is not None and
'%5Cn' in
|
a8b35ad546e435e9b23e66adfc7ad59a50724b03 | Allow to skip patch_name parameter | quilt/add.py | quilt/add.py | # vim: fileencoding=utf-8 et sw=4 ts=4 tw=80:
# python-quilt - A Python implementation of the quilt patch system
#
# Copyright (C) 2012 Björn Ricks <bjoern.ricks@googlemail.com>
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as ... | Python | 0 | @@ -2691,32 +2691,37 @@
name, patch_name
+=None
):%0A %22%22%22 A
@@ -3644,16 +3644,21 @@
tch_name
+=None
):%0A
|
9c04a952dba1198e7b94beb99d6dcef3e0653ed3 | use utils.retry.with_delay | simpleflow/swf/process/poller.py | simpleflow/swf/process/poller.py | import abc
import logging
import os
import signal
import swf.actors
import swf.exceptions
from simpleflow import utils
from simpleflow.process import NamedMixin, with_state
from simpleflow.swf.helpers import swf_identity
logger = logging.getLogger(__name__)
__all__ = ['Poller']
class Poller(swf.actors.Actor, Nam... | Python | 0 | @@ -4754,45 +4754,37 @@
-try:%0A response = self.poll
+poll = utils.retry.with_delay
(%0A
@@ -4797,248 +4797,171 @@
-
- task_list,%0A identity=identity,%0A )%0A except swf.exceptions.PollTimeout:%0A logger.debug('%7B%7D: PollTimeout'.format(self))... |
d427dd23c43ba0dde43fcbbb4239f4d32262ef4a | Add docstring. | rancidcmd.py | rancidcmd.py | # -*- coding: utf-8 -*-
"""RancidCmd."""
from subprocess import Popen
from subprocess import PIPE
import os
import stat
class RancidCmd(object):
"""The :class:`RancidCmd <RancidCmd>` object.
RancidCmd
"""
def __init__(self, **kwargs):
"""Constructor Parameters.
login, user, pass... | Python | 0 | @@ -154,20 +154,14 @@
%22%22%22
-The :c
+C
lass
-:%60
+
Ranc
@@ -169,194 +169,1257 @@
dCmd
- %3CRancidCmd%3E%60 object.%0A%0A R
+.%0A%0A Attributes:%0A%0A :login (str): RANCID login command(clogin, jlogin, etc).%0A :user (str): Login username.%0A :password (str): Login password.%0A ... |
a7a68a5f7e4825888ae1ec166afc00df6fc72b0e | Fix docstring | mir/anidb/api.py | mir/anidb/api.py | # Copyright (C) 2016, 2017 Allen Li
#
# 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.00003 | @@ -1046,32 +1046,47 @@
%22%22Request titles
+ asynchronously
.%0A%0A https://w
|
df35c2bd6a5a78469870f5bc5ca822b197451b9d | Update test.py | learning/test.py | learning/test.py | print(120)
| Python | 0.000001 | @@ -1,11 +1,11 @@
-print(120)
+import cv2
%0A
|
284a208c5bd42324e3b346a9ecd7b687a409ed5e | Remove comments. | leather/ticks.py | leather/ticks.py | #!/usr/bin/env python
from decimal import Decimal
import math
import sys
from leather.utils import isclose
# Shorthand
ZERO = Decimal('0')
TEN = Decimal('10')
#: Normalized intervals to be tested for ticks
INTERVALS = [
Decimal('0.1'),
Decimal('0.15'),
Decimal('0.2'),
Decimal('0.25'),
Decimal('0... | Python | 0 | @@ -3940,218 +3940,8 @@
%22%22%22%0A
- # if isclose(t, int(t)):%0A # return int(t)%0A #%0A # for r in range(1, 4):%0A # rounded = round(t, r)%0A #%0A # if isclose(t, rounded):%0A # return rounded%0A #%0A # return t%0A%0A
|
c58ddb58e6c35142eba077f86654d2a69a04504a | Fix astrobin_apps_notifications tests | astrobin_apps_notifications/tests.py | astrobin_apps_notifications/tests.py | # Django
from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
# This app
from astrobin_apps_notifications.utils import *
from astrobin_apps_notifications.templatetags.astrobin_apps_notifications_tags import *
class NotificationsTest(TestCase):
... | Python | 0.000006 | @@ -1772,16 +1772,24 @@
lf.user2
+, -1, -1
)%0A
|
3c43368c836ff4d1cc48d3e04badabf3131c3eb8 | add infor to parse_tweets.py | tools/parse_tweets.py | tools/parse_tweets.py | from tweet_parser.tweet import Tweet
from tweet_parser.tweet_parser_errors import NotATweetError, NotAvailableError
import argparse
import fileinput
import sys
try:
import ujson as json
JSONDecodeError = ValueError
except ImportError:
import json
JSONDecodeError = json.JSONDecodeError
parser = argparse... | Python | 0.000001 | @@ -1,28 +1,75 @@
+#!/usr/bin/env python%0A# -*- coding: UTF-8 -*-%0A%0A
from tweet_parser.tweet impo
|
1eb4d00e005f22ae452ce9d36b9fce69fa9b96f7 | Drop extra trailing slash from notices_url | astrobin_apps_notifications/utils.py | astrobin_apps_notifications/utils.py | # Python
import simplejson
import urllib2
# Django
from django.conf import settings
from django.template.loader import render_to_string
# Third party
from gadjo.requestprovider.signals import get_request
from notification import models as notification
from persistent_messages.models import Message
import persistent_m... | Python | 0 | @@ -439,14 +439,8 @@
_URL
- + '/'
%7D)%0A%0A
|
5e94741d1bdc8491f88272837859dbefcc9622a1 | Remove version from pyNaCl import warning, state consequences. | leekspin/ntor.py | leekspin/ntor.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""ntor ― Functionality for creating NTOR keys.
For a description of the NTOR handshake protocol, as well as its requisite
keys, see §5.1.4 of the tor-spec_, as well as the NTOR handshake proposal_.
**Module Overview:**
::
createNTORSecretKey - Create a NTOR (Curve25... | Python | 0 | @@ -864,41 +864,14 @@
t py
-nacl%3E=0.1.0 %22%5C%0A %22
+NaCl:
http
@@ -884,17 +884,17 @@
thub.com
-:
+/
pyca/pyn
@@ -896,17 +896,76 @@
a/pynacl
-%22
+. %22%5C%0A %22NTOR key generation will be disabled.
)%0A%0A%0Aclas
|
b67ffeb943656842b995dc5d81499679a330e433 | Add glob filtering to mmash and slightly break backward compat | mmstats/mmash.py | mmstats/mmash.py | """mmash - Flask JSON Web API for publishing mmstats"""
from collections import defaultdict
import glob
import json
import operator
import os
import sys
import flask
from mmstats import reader as mmstats_reader
app = flask.Flask(__name__)
app.config.from_object('mmstats.mmash_settings')
if 'MMASH_SETTINGS' in os.en... | Python | 0 | @@ -101,20 +101,8 @@
lob%0A
-import json%0A
impo
@@ -366,24 +366,39 @@
iter_stats(
+stats_glob=None
):%0A %22%22%22Yi
@@ -471,28 +471,48 @@
-for fn in glob.
+if not stats_glob:%0A stats_
glob
-(
+ =
app.
@@ -533,16 +533,158 @@
S_GLOB'%5D
+%0A elif '..' in stats_glob:%0A # Don't allow ... |
bacb62a0f19f121dc838008a770da4e0ee7bbf74 | set gc enable as false in callable | packages/syft/src/syft/ast/callable.py | packages/syft/src/syft/ast/callable.py | """This module contains `Callable`, an AST node representing a method (can be static),
global function, or constructor which can be directly executed."""
# stdlib
from types import ModuleType
from typing import Any
from typing import Callable as CallableT
from typing import List
from typing import Optional
from typing... | Python | 0.000639 | @@ -3349,24 +3349,40 @@
wncast_args,
+%0A
kwargs=down
@@ -3393,16 +3393,32 @@
_kwargs,
+%0A
client=
@@ -3428,16 +3428,51 @@
f.client
+,%0A gc_enabled=False,
%0A
|
b3fae9017dc7b36c7815ff3d1685de3235340a60 | Fix the reference in the git sensor. | packs/git/sensors/git_commit_sensor.py | packs/git/sensors/git_commit_sensor.py | #!/usr/bin/env python
# Requirements
# pip install gitpython
# Also requires git CLI tool to be installed.
import datetime
import os
import time
from git.repo import Repo
class GitCommitSensor(object):
def __init__(self, container_service, config=None):
self._container_service = container_service
... | Python | 0.000001 | @@ -643,20 +643,20 @@
trigger_
-name
+pack
, self._
@@ -663,20 +663,20 @@
trigger_
-pack
+name
%5D)%0A%0A
|
3da20cfd6b2ccee343d2bab8e2cb82dc12ff9a8a | Revert coulomb_matrix changes | pande_gas/features/coulomb_matrices.py | pande_gas/features/coulomb_matrices.py | """
Generate coulomb matrices for molecules.
See _Montavon et al., New Journal of Physics_ __15__ (2013) 095003.
"""
__author__ = "Steven Kearnes"
__copyright__ = "Copyright 2014, Stanford University"
__license__ = "BSD 3-clause"
import numpy as np
from rdkit import Chem
from pande_gas.features import Featurizer
f... | Python | 0 | @@ -250,32 +250,8 @@
np%0A%0A
-from rdkit import Chem%0A%0A
from
@@ -1431,122 +1431,8 @@
s.%0A%0A
- Since Coulomb matrices are symmetric, only the (flattened) upper%0A triangular portion is returned.%0A%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.