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 |
|---|---|---|---|---|---|---|---|
b13ecb2e802f832d028e246f5edc88ec36844da2 | Bump minor version | metafunctions/__init__.py | metafunctions/__init__.py | __version__ = '0.2.0'
| Python | 0 | @@ -12,11 +12,11 @@
= '0.2.
-0
+1
'%0A
|
d4c6293b70691ccf52c57bf1c4b153c6b4aa1507 | if no id, make up a good one, not an empty string | objavi/epub_utils.py | objavi/epub_utils.py | """Module for dealing with booki -> epub conversions."""
import os, sys
from pprint import pprint
#import zipfile
from cStringIO import StringIO
import lxml, lxml.html, lxml.cssselect
from lxml import etree
from objavi.cgi_utils import log
from objavi.config import DC, XHTML, XHTMLNS, NAVPOINT_ID_TEMPLATE
from book... | Python | 0.997984 | @@ -1241,46 +1241,17 @@
ap)%0A
-%0A
-for name, content in (('dtb:uid',
+ids =
get
@@ -1286,23 +1286,180 @@
ier'
-, default=%5B''%5D)
+)%0A if not ids: #workaround for one-time broken booki%0A ids = %5Btime.strftime('http://book.cc/UNKNOWN/%25Y.%25m.%25d-%25H.%25M.%25S')%5D%0A%0A for name, content... |
170accfdd35284fa4a23b699938e11bbf3b2ee4f | Add back in data shuffling for training | perceptron.py | perceptron.py | from random import random
from random import shuffle
MAX_EPOCHS = 10
class Perceptron(object):
def __init__(self, weight_keys):
self.weights = {weight_key: random()
for weight_key in weight_keys}
self.threshold = random()
self.learning_rate = random()
sel... | Python | 0 | @@ -854,24 +854,26 @@
response = 0
+.0
%0A for
@@ -4935,17 +4935,16 @@
()%0A%0A
-#
shuffle(
@@ -5344,28 +5344,28 @@
data, train_
-data
+test
)%0A be
|
f64263f92d719b20f29744e56adba86a1f7d8161 | Handle non-INT primary keys | sandman2/__init__.py | sandman2/__init__.py | """*sandman2*'s main module."""
# Third-party imports
from flask import Flask, current_app, jsonify
from sqlalchemy.ext.automap import automap_base
from sqlalchemy.ext.declarative import declarative_base
# Application imports
from sandman2.exception import (
BadRequestException,
ForbiddenException,
NotFou... | Python | 0 | @@ -2843,14 +2843,8 @@
type
-='int'
):%0A
@@ -4951,16 +4951,725 @@
%7D)%0A
+ %0A # inspect primary key %0A keys = list(cls().__table__.primary_key.columns)%0A %0A # composite keys not supported (yet)%0A if len(cols) != 1:%0A primary_key_type = None%0A else:%0A col_type = c... |
633bab975d7ecd55cad7c6a3b93822c3901f9403 | Fix cuda on model conversion again | metal/mmtl/metal_model.py | metal/mmtl/metal_model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
from metal.classifier import Classifier
from metal.end_model.em_defaults import em_default_config
from metal.end_model.identity_module import IdentityModule
from metal.end_model.loss import SoftCrossEntropyLoss
from metal.utils import (
MetalDatase... | Python | 0 | @@ -1106,18 +1106,18 @@
or calc
-l
u
+l
ate_loss
@@ -1239,16 +1239,29 @@
self.to(
+torch.device(
f%22cuda:%7B
@@ -1284,16 +1284,17 @@
ice'%5D%7D%22)
+)
%0A%0A
|
ad6f07b7cf9fea368a3c5a6d9f152bbcf3a3f530 | use requests library in post requests. | meetup/api.py | meetup/api.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
PURPOSE: Tools to access the Meetup.com API
AUTHOR: dylangregersen
DATE: Mon Sep 15 00:12:21 2014
"""
# ########################################################################### #
from __future__ import print_function, division, unicode_literals
import json
import os... | Python | 0 | @@ -372,16 +372,33 @@
rlopen%0A%0A
+import requests%0A%0A
%0Aclass M
@@ -2538,100 +2538,44 @@
t =
-urlopen(url, urlencode(kwargs)).read()%0A content = unicode(content, 'utf-8', 'ignore')
+requests.post(url, data=kwargs).text
%0A
@@ -2595,16 +2595,17 @@
son.load
+s
(content
|
b68930f32355579d46eadc590e05b0dae9237a2c | Change the wkhtmltopdf url | wkhtmltopdf/utils.py | wkhtmltopdf/utils.py | from __future__ import absolute_import
from copy import copy
from itertools import chain
import os
import re
import sys
try:
from urllib.request import pathname2url
from urllib.parse import urljoin
except ImportError: # Python2
from urllib import pathname2url
from urlparse import urljoin
from django... | Python | 0.000755 | @@ -877,26 +877,8 @@
p://
-code.google.com/p/
wkht
@@ -884,16 +884,20 @@
tmltopdf
+.org
/.%0A%0A
|
ae8c3b4817dfd9d47275c8ddfe9240ae1825b4e2 | Fix argument | lightning/types/three.py | lightning/types/three.py | from lightning.types.base import Base
from lightning.types.decorators import viztype
from lightning.types.utils import vecs_to_points_three, add_property
from numpy import ndarray, asarray
from lightning.types.utils import array_to_im
@viztype
class Scatter3(Base):
_name = 'scatter-3'
_func = 'scatter3'
... | Python | 0.000019 | @@ -362,21 +362,21 @@
r=None,
-label
+group
=None, a
@@ -711,21 +711,21 @@
-label
+group
: array
@@ -1255,21 +1255,21 @@
ct,
-label, 'label
+group, 'group
')%0A
|
a1c6ab53460a85c25f9a19f84462e9f95c94b51e | Update signature to include kwargs | cms/wizards/wizard_base.py | cms/wizards/wizard_base.py | # -*- coding: utf-8 -*-
from django.contrib.contenttypes.models import ContentType
from django.core.exceptions import ImproperlyConfigured
from django.forms.models import ModelForm
from django.utils.encoding import python_2_unicode_compatible
from django.utils.translation import (
override as force_language,
f... | Python | 0 | @@ -1981,16 +1981,26 @@
lf, user
+, **kwargs
):%0A
|
224dec2f90350c7fd8266a8421a0df199084c7ce | Read site configuration file in wmt-script | wmtexe/cmd/script.py | wmtexe/cmd/script.py | """Launch a WMT simulation using `bash` or `qsub`."""
from __future__ import print_function
import sys
import os
from ..launcher import BashLauncher, QsubLauncher, SbatchLauncher
_LAUNCHERS = {
'bash': BashLauncher,
'qsub': QsubLauncher,
'sbatch': SbatchLauncher,
}
def main():
import argparse
... | Python | 0 | @@ -174,16 +174,56 @@
auncher%0A
+from ..config import load_configuration%0A
%0A%0A_LAUNC
@@ -899,237 +899,620 @@
('--
-run', action='store_true',%0A help='Launch simulation')%0A%0A args = parser.parse_args()%0A%0A launcher = _LAUNCHERS%5Bargs.launcher%5D(args.uuid,%0A ... |
8bbcd20e119a3241cfb022945bfbe59ebb0f6cf3 | Fix bad function call in memoization | basis_set_exchange/memo.py | basis_set_exchange/memo.py | '''
Class/decorator for memoizing BSE functionality
'''
import functools
import pickle
import inspect
# If set to True, memoization of some internal functions
# will be used. Generally safe to leave enabled - it
# won't use that much memory
memoize_enabled = True
def _make_key(args_spec, *args, **kwargs):
left_... | Python | 0.000576 | @@ -544,99 +544,81 @@
#
-We got an error in the function call. Let's simply trigger it%0A func(*args, **kwargs)
+Return None to signal an issue with the argument list%0A return None
%0A%0A
@@ -1473,32 +1473,218 @@
rgs, **kwargs)%0A%0A
+ if arg_key is None:%0A # There was a proble... |
597e9e6f9f7e2982a767d7b987dd11a68259b2fb | output correct | permsplain.py | permsplain.py | #!/usr/bin/env python
from __future__ import print_function # Force use print()
import subprocess
import sys
if len(sys.argv) > 1:
argument = sys.argv[1]
#print("argument was {0}".format(argument))
popen_call = ["ls", "-l", str(argument)]
else:
popen_call = ["ls", "-l"]
#list_output = subprocess.Pope... | Python | 1 | @@ -473,16 +473,18 @@
cate()%0A%0A
+#
print(li
@@ -518,32 +518,34 @@
st(list_output)%0A
+#
print(%22%22)%0Alist_o
@@ -569,16 +569,18 @@
ut%5B:-1%5D%0A
+#
print(li
@@ -590,16 +590,18 @@
output)%0A
+#
print(%22%22
@@ -607,40 +607,8 @@
%22)%0A%0A
-#list_output = list_output%5B:-1%5D%0A
list
@@ -662,22 +662,1... |
01563ffbff5894647996143d5841a785615b19f4 | Add sudo on systemctl commands | dbaas/physical/commands.py | dbaas/physical/commands.py | class HostCommands(object):
def __new__(cls, host):
if host.is_ol6:
return HostCommandOL6(host)
if host.is_ol7:
return HostCommandOL7(host)
class HostBaseCommands(object):
def __init__(self, host):
self.host = host
self.infra = host.infra
self.e... | Python | 0.000001 | @@ -3523,16 +3523,21 @@
tmpl = '
+sudo
systemct
|
75f1f5891b0e5dbe5562dac7b488ed731dbab3fb | Add CAN_DETECT | bears/rest/reSTLintBear.py | bears/rest/reSTLintBear.py | from restructuredtext_lint import lint
from coalib.bears.LocalBear import LocalBear
from coalib.bears.requirements.PipRequirement import PipRequirement
from coalib.results.Result import Result
from coalib.results.RESULT_SEVERITY import RESULT_SEVERITY
class reSTLintBear(LocalBear):
LANGUAGES = {"reStructuredText... | Python | 0.000314 | @@ -504,16 +504,58 @@
GPL-3.0'
+%0A CAN_DETECT = %7B'Formatting', 'Syntax'%7D
%0A%0A de
|
4e2cf9e56c42301e703579d01b88f656ddbd8362 | Indent printed timings. | llvm-datalog/__main__.py | llvm-datalog/__main__.py | import argparse
import contextlib
import copper
import logging
import os
from logging.handlers import RotatingFileHandler, SysLogHandler
from utils import contextlib2
from utils.timer import Timer
from utils.contextlib2 import stdout_redirected
def main():
with setup_logging():
# Create CLI parser
... | Python | 0 | @@ -1456,17 +1456,17 @@
2s ... %25
-2
+6
.2fs%22 %25
|
0c50fc402f4234a516266c23029bbbec2029fff8 | Fix test | tests/cli_tests.py | tests/cli_tests.py | import logging
import mock
import os
import re
import responses
import unittest
import esridump.cli
class TestEsriDumpCommandlineHelpers(unittest.TestCase):
def test_collect_headers(self):
self.assertDictEqual(
esridump.cli._collect_headers(['Content-Type: application/json']),
{
... | Python | 0.000004 | @@ -3305,9 +3305,8 @@
Dbar
-&
', s
|
27288a3169658a406ae1724e9524bdacdad91c44 | update odtbrain/_version.py with git_cast_file2repos.py | odtbrain/_version.py | odtbrain/_version.py | #!/usr/bin/env python
"""
Determine package version for git repositories.
Each time this file is imported it checks if the ".git" folder is
present and if so, obtains the version from the git history using
`git describe`. This information is then stored in the file
`_version_save.py` which is not versioned by git, but... | Python | 0 | @@ -2685,18 +2685,16 @@
data=%22
-%22%22
#!/usr/b
@@ -2706,21 +2706,36 @@
v python
-%0A
+%5Cn%22+%5C%0A %22
# This f
@@ -2763,22 +2763,36 @@
atically
-.%0A
+%5Cn%22+%5C%0A %22
longvers
@@ -2795,17 +2795,17 @@
version=
-%22
+'
%7BVERSION
@@ -2809,16 +2809,9 @@
ION%7D
-%22%0A ... |
b989041041ab314625e4bd708bc8903a5bfd4c56 | Add call to get worksheet IDs | app/query.py | app/query.py | #!/usr/bin/python
import json
import requests
import Image
import ImageOps
import urllib
import os
from bs4 import BeautifulSoup as Soup
from datetime import datetime
from cStringIO import StringIO
from google_spreadsheet.api import SpreadsheetAPI
from config import NPR_API_KEY, ABSOLUTE_PATH, GOOGLE_SPREADSHEET
def ... | Python | 0 | @@ -325,16 +325,25 @@
_sheets(
+key=False
):%0A %22
@@ -623,24 +623,121 @@
eadsheets()%0A
+ if key:%0A worksheets = api.list_worksheets(key)%0A print worksheets%0A else:%0A
for shee
@@ -755,16 +755,20 @@
sheets:%0A
+
|
b8638ab2befa55029f2aeb8a907acb1a94aba3a9 | Decrease sensitivity of dark ground checking. | app/rules.py | app/rules.py |
class Rule(object):
def __init__(self, trigger, actions):
self.trigger = trigger
print "trigger: %s" % trigger
self.code = []
time = 0
for a in actions:
print "action: %s" % a
if a == 'back':
action = ('reverse', 40)
elif... | Python | 0 | @@ -904,17 +904,17 @@
color %3C
-1
+4
0) %5C%0A
@@ -980,10 +980,11 @@
or %3E
- 1
+= 4
0):%0A
|
7b73732d3a252213d28abddbc37813376247622b | Set the subprocess command dir. | app/tasks.py | app/tasks.py | import os
import subprocess
from app import celery, app
from controller import Controller
@celery.task()
def start_daemon(process, project, collector_id=None, network=None):
"""
Calls a Controller to daemonize and start a STACK process
"""
if process == 'collect':
c = Controller(
p... | Python | 0.000001 | @@ -1759,16 +1759,52 @@
start '
+%0A os.chdir(app.config%5B'BASEDIR'%5D)
%0A%0A #
|
191ce55833aee3f9b313da78918bc3a9a4fe8f58 | Test #84 | colorlog/tests/conftest.py | colorlog/tests/conftest.py | """Fixtures that can be used in other tests."""
from __future__ import print_function
import inspect
import logging
import sys
import pytest
import colorlog
class TestingStreamHandler(logging.StreamHandler):
"""Raise errors to be caught by py.test instead of printing to stdout."""
def handleError(self, r... | Python | 0 | @@ -416,16 +416,24 @@
message(
+capsys,
log_func
@@ -447,21 +447,20 @@
essage,
-capsy
+*arg
s):%0A
@@ -548,16 +548,23 @@
(message
+, *args
)%0A ou
@@ -772,16 +772,23 @@
message
+%25 args
in err,
@@ -1101,24 +1101,32 @@
log_message(
+capsys,
logger.debug
@@ -1139,33 +1139,31 @@
ebug message
-%22,... |
4e824356c1bb3e6d44125a529791a6a1f76ca51f | Fix for Python 2.6 | tinydb/queries.py | tinydb/queries.py | """
Contains the querying interface.
Starting with :class:`~tinydb.queries.Query` you can construct complex
queries:
>>> ((where('f1') == 5) & (where('f2') != 2)) | where('s').matches(r'^\w+$')
(('f1' == 5) and ('f2' != 2)) or ('s' ~= ^\w+$ )
Queries are executed by using the ``__call__``:
>>> q = where('val') == 5... | Python | 0.000143 | @@ -1054,16 +1054,17 @@
'Query%7B
+0
%7D'.forma
|
120822fe10326fad9e7b9e82a2ac9a6d4f09821b | Set version for next tag | toast/_version.py | toast/_version.py | __version__ = '2.0'
| Python | 0 | @@ -11,10 +11,11 @@
_ = '2.0
+1
'%0A
|
5ba54bcea283361bdd97cd35354a8490f2ee6c7b | Work around a docutils bug. | tools/demodata.py | tools/demodata.py | #!/usr/bin/python
import sys, os, urllib
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(root)
import admin, store, config
cfg = config.Config(root+'/config.ini')
st = store.Store(cfg)
# classifiers
for c in urllib.urlopen("http://pypi.python.org/pypi?%3Aaction=list_classifiers").r... | Python | 0 | @@ -124,16 +124,96 @@
d(root)%0A
+# Work around http://sourceforge.net/p/docutils/bugs/214/%0Aimport docutils.utils%0A
import a
|
da48827efd87a60386316d835aa1d79aaf366da3 | fix name | nikola/plugins/task_render_sources.py | nikola/plugins/task_render_sources.py | import os
from nikola.plugin_categories import Task
from nikola import utils
class Sources(Task):
"""Copy page sources into the output."""
name = "render_sources"
def gen_tasks(self):
"""Publish the page sources into the output.
Required keyword arguments:
translations
... | Python | 0.019891 | @@ -1462,16 +1462,22 @@
date': %5B
+utils.
config_c
|
2d4063e936b3e739d03145891135fa0349e9a53d | fix spelling of `render_admin_panel` in the definition of the `IAdminPanelProvider` interface | trac/admin/api.py | trac/admin/api.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 ... | Python | 0.007087 | @@ -914,17 +914,16 @@
min_pane
-e
l(req, c
|
a4b60951b46f5f1d940c8779a32631254c838fcf | Removing print statement from authzperm.py, closes #675. | trac/authzperm.py | trac/authzperm.py | # -*- coding: iso8859-1 -*-
#
# Copyright (C) 2004 Edgewall Software
# Copyright (C) 2004 Francois Harvey <fharvey@securiweb.net>
#
# Trac is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of th... | Python | 0.912422 | @@ -2045,39 +2045,8 @@
'):%0A
- print path_ele%0A
%09%09if
|
4c345e959ff5e39f2b1aefbd949cfb53e83c3c91 | Extend `EnvironmentTestCase` to check object identity. Refs #11245. | trac/tests/env.py | trac/tests/env.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2003-2013 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 consi... | Python | 0.000006 | @@ -1538,32 +1538,306 @@
est.TestCase):%0A%0A
+ if not hasattr(unittest.TestCase, 'assertIs'):%0A def assertIs(self, expr1, expr2, msg=None):%0A if expr1 is not expr2:%0A raise self.failureException(msg or '%25r is not %25r'%0A %25 (... |
790de15cc1a1eb680af319346ef8f90cfe8caffc | Add basic models. | tracker/models.py | tracker/models.py | from django.db import models
# Create your models here.
| Python | 0 | @@ -26,32 +26,330 @@
els%0A
-%0A# Create your models here.
+from django.contrib.auth.models import User%0A%0A%0Aclass Task(models.Model):%0A name = models.DateTimeField()%0A user = models.ForeignKey(User)%0A%0A%0Aclass WorkSession(models.Model):%0A task = models.ForeignKey('Task')%0A user = models.ForeignK... |
3214f9ab9ca35ca227377459eed77a9e97d8997a | Remove unused module | tracking/views.py | tracking/views.py | import logging
import calendar
from datetime import timedelta
from django import forms
from django.shortcuts import render
from django.contrib.auth.decorators import permission_required
from django.utils.timezone import now
from tracking.models import Visitor, Pageview
from tracking.settings import TRACK_PAGEVIEWS
... | Python | 0.000001 | @@ -11,24 +11,8 @@
ging
-%0Aimport calendar
%0A%0Afr
|
5a714bb3878890e5f4b36503585d361263103c7d | Remove dev only app | nodeconductor/server/test_settings.py | nodeconductor/server/test_settings.py | # Django test settings for nodeconductor project.
from nodeconductor.server.base_settings import *
SECRET_KEY = 'test-key'
DEBUG = True
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = ['127.0.0.1']
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': ':memory:',
}
}
INSTALLED_AP... | Python | 0 | @@ -430,39 +430,8 @@
nd,%0A
- 'test_without_migrations',%0A
)%0A%0AB
|
6731c07bfad38637ad4872da0d87c49cb576643f | Fix tests for 32 bit systems. | numba/tests/test_unsafe_intrinsics.py | numba/tests/test_unsafe_intrinsics.py | from __future__ import print_function
import random
import numpy as np
from .support import TestCase, captured_stdout
from numba import njit, types
from numba.unsafe.tuple import tuple_setitem
from numba.unsafe.ndarray import to_fixed_tuple, empty_inferred
from numba.unsafe.bytes import memcpy_region
from numba.unsaf... | Python | 0 | @@ -4908,17 +4908,8 @@
s =
-np.array(
%5B2,
@@ -4921,17 +4921,16 @@
26, 128%5D
-)
%0A%0A
@@ -5030,36 +5030,32 @@
for i in
-np.a
range(T.bitwidth
@@ -5367,20 +5367,16 @@
or i in
-np.a
range(T.
|
86b7276b08d7d5009cb49d80d39c2407cd66ec24 | Remove an irrelevant option | train_a3c_continuous.py | train_a3c_continuous.py | import argparse
import multiprocessing as mp
import chainer
from chainer import links as L
from chainer import functions as F
import cv2
import gym
import numpy as np
import policy
import v_function
import dqn_head
import a3c
import random_seed
import rmsprop_async
from init_like_torch import init_like_torch
import r... | Python | 0.999999 | @@ -2278,73 +2278,8 @@
ne)%0A
- parser.add_argument('--scenario', type=str, default='basic')%0A
|
26887135f1d8fcce669874f264b0c5ba4a0ddaad | Set version to 'dev' in master | transitland/__init__.py | transitland/__init__.py | """
Transitland Python Client.
This library implements an interface for the Transitland Feed Registry, Transitland Datastore, and working with Onestop IDs:
https://github.com/transit-land/onestop-id
Modules:
registry - Feed Registry reader
entities - Transitland entities
geom - Geometry utilities
util - ... | Python | 0.000001 | @@ -456,10 +456,8 @@
= '
-0.5.2
+dev
'
|
0056cb61210ec23bb4737ba8e9fa84cd82be117d | Remove duplicate log declaration | piper/step.py | piper/step.py | import logbook
import jsonschema
from piper.utils import DotDict
class Step(object):
"""
Definition of an execution step.
This base implementation will return the command line set in the
configuration.
"""
def __init__(self, key, config):
# Schema is defined here so that subclasses... | Python | 0.000002 | @@ -1653,32 +1653,8 @@
one%0A
- self.log = None%0A
|
ad0d43246ab135facdfa865b4c335ca2bb2db491 | write data in bulk and remove the path to the data file - require the arg instead in the script | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | portality/migrate/2966_add_oa_start_date_from_backup/add_oa_start_date_from_backup.py | import csv
from copy import deepcopy
from portality.models import Journal
from portality.settings import BASE_FILE_PATH
if __name__ == "__main__":
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("-o", "--out", help="output file path")
args = parser.parse_args()
if not arg... | Python | 0 | @@ -30,16 +30,102 @@
eepcopy%0A
+from datetime import datetime%0A%0Aimport esprit%0A%0Afrom portality.core import es_connection
%0Afrom po
@@ -319,18 +319,19 @@
t(%22-
-o
+d
%22, %22--
-out
+data
%22, h
@@ -335,32 +335,36 @@
, help=%22
-output file path
+csv with backup data
%22)%0A a
@@ -406,19 +406,20 @@
o... |
f5e5a5487a2a6628fe686d12524f39a01a7ce9a3 | fix bug opening magnet links | pirate-get.py | pirate-get.py | #!/usr/bin/env python
import webbrowser
import urllib
import urllib2
import re
from HTMLParser import HTMLParser
import argparse
# create a subclass and override the handler methods
class MyHTMLParser(HTMLParser):
title = ''
q = ''
state = 'looking'
results = []
def __init__(self, q):
HTM... | Python | 0 | @@ -2974,16 +2974,19 @@
%5Bchoice%5D
+%5B0%5D
)%0A
|
e5d7922a5ccfdaa0d3bc7240a99cb9fb2c9aedc3 | fix channel name correction | mypy/events.py | mypy/events.py | import numpy as np
import pandas as pd
# TODOs:
# - [ ] correct_egi_channel_names could live in a separate module
# - [ ] create_middle_events should be made more universal
def din_dataframe(eeg):
'''
Turns DIN1, DIN2, ... channels of an egi file
into a dataframe with latency as index and
DIN numbers as columns... | Python | 0.000001 | @@ -4743,16 +4743,17 @@
== 'EEG
+0
65':%0A%09%09%09
|
c6dd3a9a46381e075222da81bc54e75a2702bae1 | Fix variable name in write_head | playerhead.py | playerhead.py | #!/usr/bin/env python3
"""Get a Minecraft player's skin for Overviewer.
Usage:
playerhead [options] [<player>]
playerhead -h | --help
playerhead --version
Options:
-h, --help Print this message and exit.
-i, --use-person-id Save the image with the person's id instead of their Minecraft us... | Python | 0.998668 | @@ -3536,16 +3536,23 @@
ave(str(
+target_
dir / ((
|
da84d680ca271fd79027692eac127167c00fcee8 | Fix morning time span to be between 6 and 8 | service/src/state_scheduler/states/salon_entry_light_state/salon_entry_light_state.py | service/src/state_scheduler/states/salon_entry_light_state/salon_entry_light_state.py | import MAX
import time
import datetime
from .off_state import off_state
from .on_state import on_state
from .prio_off_state import prio_off_state
from .prio_on_state import prio_on_state
class salon_entry_light_state(object):
def __init__(self):
self._off_state = off_state(self)
self._on_state = on... | Python | 0.999999 | @@ -759,17 +759,17 @@
me.time(
-0
+6
) %3C= now
@@ -786,17 +786,17 @@
me.time(
-2
+8
))%0A
|
3f43163e0900aa6b830013f2ba3c6c6915f514aa | implement playMovie action | omxremote/backend.py | omxremote/backend.py | import os
import json
import hashlib
from flask import Flask, Response, request, jsonify
from omxremote.dbus_connection import OmxRemote
app = Flask(__name__)
#TODO
SUPPORTED_COMMANDS = ('pause', 'togglesubtitles', 'volumeup', 'volumedown', 'stop')
VIDEO_FILE_EXTENSIONS = ('.avi', '.mkv', '.mp4')
MOVIES_DIR = 'movi... | Python | 0.000021 | @@ -328,757 +328,833 @@
'%0A%0A%0A
-@app.route('/')%0Adef index():%0A return app.send_static_file('index.html')%0A%0A%0A@app.route('/api/status')%0Adef status():%0A progress, duration, playback = OmxRemote().status()%0A #TODO filename...%0A data = %7B'filename' : '', 'progress' : int(progress), 'duration' ... |
3954895594e42fa9914b7cfbef280a1033ee751e | Revert "Keep response headers in memory within a dict that defaults to list." | restea/adapters/base.py | restea/adapters/base.py | import restea.formats as formats
class BaseResourceWrapper(object):
'''
BaseResourceWrapper is added to have common interface between frameworks.
'''
def __init__(self, resource_class):
'''
:param resource_class: :class: `restea.resource.Resource` -- resource
object implementin... | Python | 0 | @@ -1598,59 +1598,8 @@
uest
-%0A self._response_headers = defaultdict(list)
%0A%0A
@@ -2421,848 +2421,4 @@
ror%0A
-%0A def set_header(self, name, value):%0A '''%0A Sets the given response header name and value.%0A%0A :param name: string -- header name%0A :param value: string -... |
d2102397528fc3789d12bfabbf27d5c1385df88c | address comments from reviewer | openmc/polynomial.py | openmc/polynomial.py | import numpy as np
import openmc
from collections.abc import Iterable
def legendre_from_expcoef(coef, domain=(-1, 1)):
"""Return a Legendre series object based on expansion coefficients.
Given a list of coefficients from FET tally and a array of down, return
the numpy Legendre object.
Parameters
... | Python | 0 | @@ -1,12 +1,24 @@
+import math%0A
import numpy
@@ -1346,83 +1346,8 @@
s 1.
-%0A r : float%0A Position to be evaluated, normalized on radius %5B0,1%5D
%0A%0A
@@ -1879,18 +1879,20 @@
+ 1) / (
-np
+math
.pi * ra
@@ -2363,32 +2363,33 @@
olynomial):%0A
+r
%22%22%22Create Zernik
@@ -2437,19 +2437,34 @@... |
95655e2dc094a72f6b9e25c2c44ac69f5fba6094 | Add search urls on articles | opps/article/urls.py | opps/article/urls.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
from django.conf.urls import patterns, url
from opps.article.views import OppsDetail, OppsList
urlpatterns = patterns(
'',
url(r'^$', OppsList.as_view(), name='home'),
url(r'^(?P<channel__long_slug>[\w//-]+)/(?P<slug>[\w-]+)$',
OppsDetail.as_view(),... | Python | 0.000001 | @@ -136,16 +136,24 @@
OppsList
+, Search
%0A%0A%0Aurlpa
@@ -224,24 +224,71 @@
me='home'),%0A
+ url(r'%5Esearch/', Search(), name='search'),%0A
url(r'%5E(
|
88937ebaed4cb1d4ab612a3ecf3a32a96cd59344 | Correct issue with cleaning reservations/node stats | bin/nova_database_prune.py | bin/nova_database_prune.py | #!/usr/bin/env python
import MySQLdb
import sys
import os
db_user = os.getenv('DB_USER')
db_pass = os.getenv('DB_PASS')
db_host = os.getenv('DB_HOST')
db_name = os.getenv('DB_NAME')
db = MySQLdb.connect(db_host, db_user, db_pass, db_name)
# days to keep
days = 14
# batch size for deletes
limit = 1000
print "Cleani... | Python | 0 | @@ -2682,24 +2682,31 @@
L %25s day)%22%22%22
+ %25 days
)%0A cursor
@@ -2822,16 +2822,23 @@
day)%22%22%22
+ %25 days
)%0A db
|
39eeca93f28ee6e452590041dee18ec853c761f2 | Use tf.contrib.rnn.LayerNormBasicLSTMCell | nn/rnn/cell.py | nn/rnn/cell.py | import tensorflow as tf
from ..assertion import is_sequence
from ..util import funcname_scope, static_shape, static_rank
from ..normalization import layer_normalization
class LNLSTMCell(tf.nn.rnn_cell.RNNCell):
def __init__(self, num_units, forget_bias=1.0, activation=tf.tanh):
self._num_units = num_units
... | Python | 0.000002 | @@ -29,36 +29,26 @@
m ..
-assertion import is_sequence
+flags import FLAGS
%0Afro
@@ -81,1239 +81,180 @@
cope
-, static_shape, static_rank%0Afrom ..normalization import layer_normalization%0A%0A%0A%0Aclass LNLSTMCell(tf.nn.rnn_cell.RNNCell):%0A def __init__(self, num_units, forget_bias=1.0, activation=tf.tanh):%0A ... |
d4318b9a79bc4ea5760729832bac3be2aa6ec2f9 | Fix if empty values to begin with | node/market.py | node/market.py | from protocol import shout, proto_page, query_page
from reputation import Reputation
from orders import Orders
import protocol
import sys
import json
import lookup
from pymongo import MongoClient
class Market(object):
def __init__(self, transport):
transport.log("[Market] Initializing")
... | Python | 0.000015 | @@ -3521,24 +3521,33 @@
s(self): %0A
+ %0A
sett
@@ -3581,16 +3581,23 @@
nd_one()
+
%0A
@@ -3676,16 +3676,58 @@
essage'%5D
+ if settings.has_key(%22bitmessage%22) else %22%22
, %0A
@@ -3763,16 +3763,53 @@
'email'%5D
+ if settings.has_key(%22email%22) else %22%22
,%0A
@@ ... |
0326076bd09abf0d820186dc883d4b6074919d01 | Extend extra_channels | bioconda_utils/pkg_test.py | bioconda_utils/pkg_test.py | import subprocess as sp
import tempfile
import tarfile
import os
import shlex
import logging
from . import utils
from conda_build.metadata import MetaData
logger = logging.getLogger(__name__)
def get_tests(path):
"Extract tests from a built package"
tmp = tempfile.mkdtemp()
t = tarfile.open(path)
t... | Python | 0 | @@ -1359,20 +1359,48 @@
hannels=
-None
+%5B%22r%22, %22defaults%22, %22conda-forge%22%5D
, mulled
|
8cbb3628fadb5fb9754f04f007f4c3375477ff86 | change 'amount' to 'size' in kraken.py #35 | bitex/interfaces/kraken.py | bitex/interfaces/kraken.py | """
https:/kraken.com/help/api
"""
# Import Built-Ins
import logging
# Import Third-Party
# Import Homebrew
from bitex.api.rest import KrakenREST
from bitex.utils import return_api_response
from bitex.formatters.kraken import KrknFormatter as fmt
# Init Logging Facilities
log = logging.getLogger(__name__)
class Kr... | Python | 0.000374 | @@ -1528,38 +1528,36 @@
r, side, price,
-amount
+size
, **kwargs):%0A
@@ -1650,23 +1650,19 @@
', '
-volume': amount
+size': size
,%0A
@@ -1843,38 +1843,36 @@
f, pair, price,
-amount
+size
, **kwargs):%0A
@@ -1911,38 +1911,36 @@
, 'buy', price,
-amount
+size
, **kwargs)%0A%0A
@@ -1995,38 +1995,36 @... |
8066722c06516da7700dcdd011f546fcfc2a1df1 | Merge with trunk upto revision no 1082. | openerp-web.py | openerp-web.py | #!/usr/bin/env python
import optparse
import os
import sys
import tempfile
import logging
import logging.config
import werkzeug.serving
path_root = os.path.dirname(os.path.abspath(__file__))
path_addons = os.path.join(path_root, 'addons')
if path_addons not in sys.path:
sys.path.insert(0, path_addons)
optparser ... | Python | 0 | @@ -129,16 +129,47 @@
.serving
+%0Aimport werkzeug.contrib.fixers
%0A%0Apath_r
@@ -374,153 +374,8 @@
r()%0A
-optparser.add_option(%22-p%22, %22--port%22, dest=%22socket_port%22, default=8002,%0A help=%22listening port%22, type=%22int%22, metavar=%22NUMBER%22)%0A
optp
@@ -1183,25 +1183,456 @@
%2... |
780bf8ee4bbe8936055ddc0e71042fc7736f0192 | Fix prime declaraion in make_tests | make_tests.py | make_tests.py | #!/bin/env python3
from field import FieldValue
from random import randint
import math
prime = 2**31 -1
n_chunks = math.ceil(math.log2(prime) / 2)
F = lambda i: FieldValue(i, prime)
h = lambda i: hex(i)[2:]
print("""
#include "ecc.c"
int main() {
""")
print('\tNumber p = parse("{}");'.format(prime))
print('\tNumber ... | Python | 0.000044 | @@ -289,23 +289,26 @@
.format(
+h(
prime))
+)
%0Aprint('
|
dd087d0820ffcfa0044b9b597ee49f95b881ab5a | Remove ConcreteForm models from wagtailforms | wagtail/wagtailforms/models.py | wagtail/wagtailforms/models.py | from django.conf import settings
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.shortcuts import render
from django.utils.translation import ugettext_lazy as _
from django.utils.text import slugify
from unidecode import unidecode
import json
import re
from wagtail.... | Python | 0 | @@ -6349,1002 +6349,4 @@
rue%0A
-%0A%0A# TEST%0Aclass ConcreteFormField(AbstractFormField):%0A page = ParentalKey('wagtailforms.ConcreteForm', related_name='form_fields')%0A%0A%0Aclass ConcreteForm(AbstractForm):%0A thank_you = models.CharField(max_length=255)%0A%0AConcreteForm.content_panels = %5B%0A FieldPa... |
c0c2c7d6a7cfa6a1298abb5875bc443fb5b975cf | Add bool for created files or not | waterbutler/github/provider.py | waterbutler/github/provider.py | import os
import json
import base64
import asyncio
from waterbutler.core import streams
from waterbutler.core import provider
from waterbutler.core import exceptions
from waterbutler.github import settings
from waterbutler.github.metadata import GithubRevision
from waterbutler.github.metadata import GithubFileMetadat... | Python | 0 | @@ -2479,32 +2479,48 @@
'%5D).serialized()
+, (not existing)
%0A%0A @asyncio.c
|
af07ecddad88e9202d4a7db9c340edf1486b9825 | Combine multiple categories from metadata into single list | scraper/documents.py | scraper/documents.py | from datetime import datetime
import re
import requests
import lxml
import lxml.html
import lxml.etree
def get_document_id_and_content(url):
print('get document id for url: ' + url)
page = requests.get(url)
tree = lxml.html.fromstring(page.content)
elements = tree.xpath('//ul/li/a[@id="technischeInfo... | Python | 0.999998 | @@ -1822,32 +1822,36 @@
%22%5D')%0A if
+not
elements:%0A
@@ -1860,177 +1860,341 @@
-if len(elements) %3E 1:%0A print('WARNING: more than 1 element found, using first, but more info available!')%0A # print(elements%5B0%5D.get('content'))%0A
+print('WARNING: ' + key + ' wa... |
b02d26fae8892775ad6ef306d80b02e6bc69d12e | remove redundant if statement | scrapy/utils/misc.py | scrapy/utils/misc.py | """Helper functions which don't fit anywhere else"""
import re
import hashlib
from importlib import import_module
from pkgutil import iter_modules
import six
from w3lib.html import replace_entities
from scrapy.utils.python import flatten, to_unicode
from scrapy.item import BaseItem
_ITERABLE_SINGLE_VALUES = dict, B... | Python | 0.999999 | @@ -3445,24 +3445,16 @@
return
-True if
rel is n
@@ -3494,19 +3494,8 @@
it()
- else False
%0A%0A%0Ad
|
ee5bc5d6d212e2bd8e0d60e6024c5180821f6a35 | Format test according to Black | tests/integration/services/ticketing/test_creation.py | tests/integration/services/ticketing/test_creation.py | """
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from unittest.mock import patch
from pytest import raises
from byceps.services.ticketing import (
event_service,
ticket_creation_service,
ticket_service,
)
def test_create_ticket(admin_app, category, tic... | Python | 0.000001 | @@ -541,16 +541,21 @@
%0A@patch(
+%0A
'byceps.
@@ -619,16 +619,17 @@
et_code'
+%0A
)%0Adef te
@@ -664,16 +664,21 @@
ng_code(
+%0A
generate
@@ -725,24 +725,25 @@
ticket_owner
+%0A
):%0A gener
@@ -839,32 +839,41 @@
e.create_ticket(
+%0A
category.id, tic
@@ -884,16 +884,21 @@
owner.id
+%0A ... |
f243d1b576a5b1d636114e2a490aa4c2d441667e | Add extra space for docker cmd | xdocker/worker/jobs.py | xdocker/worker/jobs.py | #!/usr/bin/env python
# encoding: utf-8
import os
import re
import time
import json
from fabric.context_managers import settings
from fabric.api import env, sudo, put
from rq import get_current_job
from providers import registry
from config import DEPS_FILE
from config import MAX_INSTALL_RETRY
from utils import decr... | Python | 0.000046 | @@ -2004,16 +2004,17 @@
=%7Bvalue%7D
+
%22.format
|
72ad004702813dd43ce695c85df815bca2ea4957 | Correct typo in create_holiday_calendar example. | tf_quant_finance/datetime/holiday_calendar_factory.py | tf_quant_finance/datetime/holiday_calendar_factory.py | # Lint as: python3
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agr... | Python | 0.999987 | @@ -2451,24 +2451,24 @@
index =
-holidays
+calendar
.holiday
|
076f12856c1f157ea90685755feba54b643ec2e4 | Refactor to keep results in dict | ormcache/queryset.py | ormcache/queryset.py | import logging
from django.core.cache import cache
from django.db.models.query import QuerySet
from ormcache.signals import cache_hit, cache_missed, cache_invalidated
log = logging.getLogger(__name__)
class CachedQuerySet(QuerySet):
__CACHE_FOREVER = 2592000 # http://ur1.ca/egyvu
def get(self, *args, **... | Python | 0 | @@ -1896,22 +1896,25 @@
-cached
+instances
= cache
@@ -1938,54 +1938,8 @@
eys)
-%0A cached_instances = %5Bi for i in cached
.val
@@ -1947,14 +1947,8 @@
es()
- if i%5D
%0A
@@ -1963,50 +1963,33 @@
hed_
-ids
+dict
= %7Bi
-nstance.pk for instance in cached_
+.id: i for i in
inst
@@ -1993,16 +... |
953cc442c6ca0a8cab6847740273bde51e3b686a | Fix error in name of orthomcl database | orthomcl_database.py | orthomcl_database.py | #!/usr/bin/env python
"""Module to create, configure and dispose separate database instances for individual OrthoMCL runs."""
from ConfigParser import SafeConfigParser
from datetime import datetime
from divergence import resource_filename
import MySQLdb
import logging as log
import os.path
import socket
__author__ = ... | Python | 0.000005 | @@ -1081,17 +1081,17 @@
%7Bt.year%7D
--
+_
%7Bt.month
@@ -1095,17 +1095,17 @@
nth%7D
--
+_
%7Bt.day%7D_
%7Bt.h
@@ -1104,16 +1104,19 @@
ay%7D_
+at_
%7Bt.hour%7D
-%7Bt.
@@ -1111,17 +1111,17 @@
%7Bt.hour%7D
--
+_
%7Bt.minut
@@ -1122,17 +1122,17 @@
.minute%7D
--
+_
%7Bt.secon
|
793bb2f2661efc3ff81144c61d99671533ec37b7 | Simplify available book counting | common/bookchooserwizard.py | common/bookchooserwizard.py | from abc import abstractmethod
from collections import defaultdict
import json
from django.conf.urls import url
from django.core.urlresolvers import reverse, reverse_lazy
from django.db import transaction
from django.forms import model_to_dict
from django.http import HttpResponseRedirect, HttpResponseBadRequest, Http... | Python | 0.000289 | @@ -48,27 +48,23 @@
import
-defaultdict
+Counter
%0Aimport
@@ -4595,112 +4595,59 @@
t =
-defaultdict(int)%0A for book in books_available:%0A countdict%5Bbook.book_type%5D += 1
+Counter(book.book_type for book in books_available)
%0A
|
784f58a27c6e010b87ff568fc8c0719e52c037a2 | Update disabled_print_settings_for_custom_print_format.py | frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py | frappe/patches/v7_1/disabled_print_settings_for_custom_print_format.py | # -*- coding: utf-8 -*-
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
frappe.db.sql("""
update
`tabPrint Format`
set
align_labels_left = 0, line_breaks =... | Python | 0.000002 | @@ -215,16 +215,55 @@
cute():%0A
+%09frappe.reload_doctype('Print Format')%0A
%09frappe.
@@ -419,8 +419,9 @@
1%0A%09%09%22%22%22)
+%0A
|
4aac0d6d1c5b253a8078316fc8ac5a4d735cd69f | Upgrade to Chrome 38.0.2125.102 | script/lib/config.py | script/lib/config.py | #!/usr/bin/env python
import platform
import sys
BASE_URL = 'https://gh-contractor-zcbenz.s3.amazonaws.com/libchromiumcontent'
LIBCHROMIUMCONTENT_COMMIT = '3245ef802fbf546f1a1d206990aa9d18be6bfbfe'
ARCH = {
'cygwin': '32bit',
'darwin': '64bit',
'linux2': platform.architecture()[0],
'win32': '32bit',
... | Python | 0 | @@ -155,48 +155,48 @@
= '
-3245ef802fbf546f1a1d206990aa9d18be6bfbfe
+70fe9677634a8f13fd5c67b8c83c056f2d9c8d46
'%0A%0AA
|
755d84761dc3a8375516f07a6ede940e123c4283 | Fix a variable name | wurstmineberg.45s.py | wurstmineberg.45s.py | #!/usr/local/bin/python3
import sys
sys.path.append('/opt/py')
from PIL import Image
import base64
import basedir
import collections
import io
import json
import os.path
import requests
import traceback
CONFIG = basedir.config_dirs('bitbar/plugins/wurstmineberg.json').json() or {}
CACHE = basedir.data_dirs('bitbar/... | Python | 0.999999 | @@ -2145,16 +2145,23 @@
eople =
+people_
response
|
27179c5ff66a055784cf2612539a47735a681980 | fix icons on OS X | script/sglib/icon.py | script/sglib/icon.py | # Copyright 2014 Dietrich Epp.
# This file is part of SGLib. SGLib is licensed under the terms of the
# 2-clause BSD license. For more information, see LICENSE.txt.
from d3build.source import _base, _join, TagSourceFile
from .path import _path
import os
_SIZES = [16, 32, 48, 64, 128, 256, 512, 1024]
_OSX_SIZES = [16... | Python | 0.000003 | @@ -3371,24 +3371,101 @@
indent=2)))%0A
+ mod.add_variables(%7B'ASSETCATALOG_COMPILER_APPICON_NAME': 'AppIcon'%7D)%0A
mod.
|
a45e91e80fa29e996ee7fbb8045a30e6fc4d70b5 | update with a more minimal fix and a better understanding of the problem. | riak/transports/pool.py | riak/transports/pool.py | """
Copyright 2012 Basho Technologies, Inc.
This file is provided to you 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 a... | Python | 0 | @@ -1439,85 +1439,8 @@
lse%0A
- %22%22%22Whether the object has been deleted.%22%22%22%0A self.tomb = False%0A
%0A%0Acl
@@ -2657,16 +2657,17 @@
reading.
+R
Lock()%0A
@@ -2709,16 +2709,25 @@
ndition(
+self.lock
)%0A
@@ -4659,40 +4659,8 @@
nt)%0A
- element.tomb = True%0A
@@ -4... |
1f2c3057d4fa5ec875c60297184c154ecd0fff39 | Bump reported version string to 1.3.1 | riak_mesos/constants.py | riak_mesos/constants.py | #
# Copyright (C) 2016 Basho Technologies, 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 a... | Python | 0.000001 | @@ -631,11 +631,11 @@
= '1.3.
-0
+1
'%0A
|
f3ab4f25797e59187807095ebc689616007b8c9e | add more test case | Regression/testKnearestRegression.py | Regression/testKnearestRegression.py | #-------------------------------------------------------------------------------
# Name: test Knearest Regression
# Purpose:
#
# Author: Nonlining
#
# Created: 23/03/2017
# Copyright: (c) Nonlining 2017
# Licence: <your licence>
#--------------------------------------------------------------------... | Python | 0.000001 | @@ -1833,16 +1833,364 @@
ice')%0A%0A%0A
+ features_train, norms = KNN.normalize_features(features_train) # normalize training set features (columns)%0A features_test = features_test / norms # normalize test set by training set norms%0A features_valid = features_valid / norms # normalize validation set by trai... |
81947f9907977f540d532de66499ef5a54de9118 | correct strip | apply_bpe.py | apply_bpe.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Author: Rico Sennrich
"""Use operations learned with learn_bpe.py to encode a new text.
The text will not be smaller, but use only a fixed vocabulary, with rare words
encoded as variable-length sequences of subword units.
Reference:
Rico Sennrich, Barry Haddow and Alexandra... | Python | 0.000015 | @@ -919,24 +919,16 @@
le(item.
-strip().
split())
@@ -1335,16 +1335,8 @@
nce.
-strip().
spli
@@ -1524,16 +1524,122 @@
ord%5B-1%5D)
+%0A print '!!!!!!!!!!!!!!'%0A print sentence%0A print output%0A print '!!!!!!!!!!!!!!'
%0A%0A
@@ -4403,16 +4403,24 @@
nt(line)
+.strip()
)%0A ... |
92b9a27ade884bb84dd06cf3af8295d5270773cc | make last.py and lastz.py interface similar | apps/last.py | apps/last.py | #!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Wrapper for LAST program.
<http://last.cbrc.jp>
"""
import sys
from optparse import OptionParser
from jcvi.utils.cbook import depends
from jcvi.apps.base import ActionDispatcher, debug, sh, set_outfile
debug()
def main():
actions = (
('last', 'run LA... | Python | 0 | @@ -212,26 +212,8 @@
port
- ActionDispatcher,
deb
@@ -246,180 +246,8 @@
)%0A%0A%0A
-def main():%0A%0A actions = (%0A ('last', 'run LAST by calling LASTDB, LASTAL and LASTEX'),%0A )%0A p = ActionDispatcher(actions)%0A p.dispatch(globals())%0A%0A%0A
@dep
@@ -414,20 +414,20 @@
)%0A%0A%0Ade... |
5d9cc4366ce0e21890edbefac66cd0dc9a0c00df | bugfix. joineddate fixed | lastavg.py | lastavg.py | #!/usr/bin/env python
# Shows all scrobbling info for the last 7, 30, 90, 180, 360 days as well as
# the scrobbled artist for that timeframe along with the average scrobbles
from datetime import datetime
import time
import re
import requests
from lxml import html
# set a few things like days and the integer for the f... | Python | 0.999938 | @@ -569,22 +569,16 @@
neddate(
-JOINED
):%0A %22
|
525f604a898967b2f07e53264479b5609173d2b7 | Add a BLT parser test. | openrcv/test/test.py | openrcv/test/test.py |
import unittest
def run_tests():
# TODO: discover all tests.
unittest.main(module=__name__)
class MainTestCase(unittest.TestCase):
def test(self):
self.assertEqual(1, 1)
| Python | 0.000001 | @@ -1,167 +1,744 @@
%0A
-import unittest%0A%0Adef run_tests():%0A # TODO: discover all tests.%0A unittest.main(module=__name__)%0A%0A%0Aclass MainTestCase(unittest.TestCase):%0A%0A def test(self):
+from io import StringIO%0Afrom textwrap import dedent%0Aimport unittest%0Afrom unittest import TestCase%0A%0Afro... |
5e549f3b0e92ffc2a4463b4222a0f8a0fe1320f1 | remove quality assessment from assembler module | scripts/assembler.py | scripts/assembler.py | import argparse
import os
import sys
from tasks_v2 import Supervisor, Task
import task_functions_v2 as tf
import time
def gen_unpaired_prinseq_supervisor(fastq1, fastq2, unpaired, dependency_set, rmdup):
tasks = []
prinseq_count = len(fastq1)
prinseq_opts = '--derep 14' if(rmdup) else ''
for input1 in... | Python | 0.000001 | @@ -1718,32 +1718,33 @@
(tasks=tasks)%0A%0A%0A
+#
def gen_assembly
@@ -2022,16 +2022,258 @@
False):%0A
+def gen_assembly_supervisor(fastq1, fastq2, unpaired, dependency_set, no_trim=False, rnaSPAdes=False, rmdup=False, subset_size=50000000, cpu=12, subset_seed='I am a seed value', normalize_flag=False, truncate_opt=... |
7b959ac0901471054ca551d05721dc80b2933086 | fix case with no ammofile | yandextank/core/cli.py | yandextank/core/cli.py | import logging
import sys
import traceback
from optparse import OptionParser
from .consoleworker import ConsoleTank, CompletionHelperOptionParser
def main():
parser = OptionParser()
parser.add_option(
'-c',
'--config',
action='append',
help="Path to INI file containing run opt... | Python | 0.00007 | @@ -2292,16 +2292,75 @@
_args()%0A
+ ammofile = ammofiles%5B0%5D if len(ammofiles) %3E 0 else None
%0A wor
@@ -2394,20 +2394,16 @@
ammofile
-s%5B0%5D
)%0A tr
|
c1ecf953ab285ab47e9ab5302bab1889a2fb92b1 | Version 1.2.1. | order/__version__.py | order/__version__.py | # coding: utf-8
"""
Pythonic class collection that helps you structure external data from LHC / HEP experiments.
"""
__author__ = "Marcel Rieger"
__email__ = "python-order@googlegroups.com"
__copyright__ = "Copyright 2018-2020, Marcel Rieger"
__credits__ = ["Marcel Rieger"]
__contact__ = "https://github.com/riga/orde... | Python | 0 | @@ -391,11 +391,11 @@
= %221.2.
-0
+1
%22%0A
|
30f8cffa84618171ed1c00a097992e2d716b1aa0 | increase coverage | vagrant/tradyfit/tests/unit/test_geolocation.py | vagrant/tradyfit/tests/unit/test_geolocation.py | # -*- coding: utf-8 -*-
from mock import patch
from base import UnitTestCase
from app.geolocation import Geolocation
VALID_IPv4_US = '76.102.12.224' #Mountain View IP
VALID_IPv4_ES = '80.28.239.170' #Madrid IP
VALID_IPv6 = 'FF01:0:0:0:0:0:0:101' #from RFC4291
LOCAL_IP = '127.0.0.1'
PROXY_IP = '221.10.40.238:80'
STRING... | Python | 0 | @@ -1372,32 +1372,488 @@
city == None)%0A%0A
+ def test_get_city_empty_value(self):%0A geo_obj = Geolocation(VALID_IPv4_US)%0A geo_obj.location%5B'city'%5D = %7B'names': %7B'en': ''%7D %7D%0A r, city = geo_obj.get_city()%0A self.assertTrue(r is False and city == None)%0A%0A def test_get_location_value_e... |
7428fc66f76a9c25ca924871e91c664a133d362e | update web site and git url for BMI package (#12036) | var/spack/repos/builtin/packages/bmi/package.py | var/spack/repos/builtin/packages/bmi/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Bmi(AutotoolsPackage):
"""a communications framework and network abstraction layer"""
... | Python | 0 | @@ -330,25 +330,31 @@
= 'http
+s
://
+x
git
-.mc
+lab.cel
s.anl.go
@@ -359,16 +359,15 @@
gov/
-bmi.git/
+sds/bmi
'%0A
@@ -379,20 +379,27 @@
= '
-git
+https
://
+x
git
-.mc
+lab.cel
s.an
@@ -404,19 +404,27 @@
anl.gov/
-bmi
+sds/bmi.git
'%0A%0A v
|
ca6e3b71bb48ccd6df39446103322d1c62054d8f | fix variable name | {{cookiecutter.extension_name}}/setup.py | {{cookiecutter.extension_name}}/setup.py | #!/usr/bin/env python
# coding: utf-8
# Copyright (c) {{ cookiecutter.author_name }}.
# Distributed under the terms of the Modified BSD License.
from __future__ import print_function
# the name of the project
name = '{{ cookiecutter.python_package_name }}'
#----------------------------------------------------------... | Python | 0.998523 | @@ -233,22 +233,17 @@
ter.
-python_package
+extension
_nam
|
daf0ef262aed3b678d154dbe0a0af3e017181cc4 | Allow queue derivation, be more careful about files | scripts/backup/ia.py | scripts/backup/ia.py | ###############################################################################
#
# This script controls the backup process to the Internet Archive.
#
# It's meant to be operated by Eric Mill, who as of 2014 manages the project
# and its collection on the Internet Archive.
#
# If you'd like to upload IG reports with yo... | Python | 0 | @@ -2383,16 +2383,145 @@
_path)%0A%0A
+ if len(to_upload) %3E 0:%0A logging.warn(%22%5B%25s%5D%5B%25s%5D%5B%25s%5D Sending %25i report files!%22 %25 (ig, year, report_id, len(to_upload)))%0A
succ
@@ -2572,16 +2572,18 @@
tions)%0A%0A
+
if not
@@ -2584,32 +2584,34 @@
if not success:%0A
+
log... |
b3fcfc1cb25884f668466816be08a2a68cee256a | Add lz4 1.9.2 (#13155) | var/spack/repos/builtin/packages/lz4/package.py | var/spack/repos/builtin/packages/lz4/package.py | # Copyright 2013-2019 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
import sys
class Lz4(Package):
"""LZ4 is lossless compression algorithm, providing compression s... | Python | 0.000013 | @@ -234,16 +234,24 @@
ass Lz4(
+Makefile
Package)
@@ -633,19 +633,19 @@
hive/v1.
-7.5
+9.2
.tar.gz%22
@@ -646,16 +646,114 @@
ar.gz%22%0A%0A
+ version('1.9.2', sha256='658ba6191fa44c92280d4aa2c271b0f4fbc0e34d249578dd05e50e76d0e5efcc')%0A
vers
@@ -1553,23 +1553,21 @@
def
-install
+build
(self, s
@@ ... |
cd70f6b89b1fff89c5c6a628c926365be9e3c95f | change scenario and for loop | preprocessing/python_scripts/renpass_gis/simple_feedin/results_to_oedb.py | preprocessing/python_scripts/renpass_gis/simple_feedin/results_to_oedb.py | """
Write results of simple_feedin.py into the openEnergy Database.
links:
https://www.shanelynn.ie/select-pandas-dataframe-rows-and-columns-using-iloc-loc-and-ix/
http://www.datacarpentry.org/python-ecology-lesson/02-index-slice-subset/
ToDo:
Insert capacity
move to odeb
update data_processing
"""
__co... | Python | 0.000001 | @@ -1076,32 +1076,84 @@
rows=1)%0A
-time_series%5B%5B1%5D%5D
+scenario_name = pd.read_csv(filename,header=None,nrows=1).iloc%5B0,0%5D%0A
%0A%0A# prep
@@ -1351,59 +1351,30 @@
ex)%0A
-db_data = pd.DataFrame(columns=columns,index=index)
+%0Atime_series.iloc%5B2,2%5D
%0A%0A#
@@ -1775,11 +1775,9 @@
ies%5B
-%5B1%5D
+k
... |
87846ebce6214b72f2445b929db49e7545ae2be5 | replace 1wire sensor with new one, change the id | scripts/send_temp.py | scripts/send_temp.py | #!/usr/bin/python
import time
import os
import json
import requests
#for adafruit dht22/AM2302 sensor lib
import sys
import Adafruit_DHT
outside_temp=os.path.join("/","mnt","1wire","10.E1B894020800","temperature")
floor_temp=os.path.join("/","mnt","1wire","10.04A794020800","temperature")
room_temp=os.path.join("/","mn... | Python | 0 | @@ -180,23 +180,23 @@
e%22,%22
-10.E1B894020800
+28.FF1521621603
%22,%22t
@@ -533,16 +533,29 @@
()),1)%0A%0A
+try:%0A
out = ge
@@ -579,16 +579,54 @@
e_temp)%0A
+except IOError, e:%0A out = %2299%22%0A
floor =
|
7962852f475e8ff070eb9734be93820919237c7f | number to string | numToString.py | numToString.py |
class num:
teens=['eleven','twelve','thirteen','fourteen','fifteen','sixteen','seventeen','eighteen','nineteen']
tens=['ten','twenty','thirty','forty','fifty','sixty','seventy','eighty','ninty']
ones=['one','two','three','four','five','six','seven','eight','nine']
bigs=['','thousand','million']
def __init__(sel... | Python | 0.999942 | @@ -476,16 +476,32 @@
n %3E 0:%0A
+%09%09%09print %22HERE%22%0A
%09%09%09if n%25
@@ -981,10 +981,11 @@
ing(
-3
1
+09
9)%0A%0A
|
e4990f65c08db3dbdf2dce0056d2b0b5102b3ee5 | Use relative imports | oxyfloat/__init__.py | oxyfloat/__init__.py | __all__ = ['exceptions', 'OxyFloat']
from oxyfloat.OxyFloat import OxyFloat
from oxyfloat.exceptions import RequiredVariableNotPresent, OpenDAPServerError
| Python | 0.000001 | @@ -36,24 +36,16 @@
%5D%0A%0Afrom
-oxyfloat
.OxyFloa
@@ -71,16 +71,8 @@
rom
-oxyfloat
.exc
|
1d71a5b8621943b64cfdebe238a4f53bb1382ad6 | Correct issues with openLog() method. | DataLog.py | DataLog.py | from collections import deque
import os
class DataLog:
"""
Class to contain saved data and save to json file when commanded.
All logged data are limited to self.__buffer_length unique records.
Exclusively uses jsonpickle library to read/write log data.
"""
def __init__(self,logDir = None, buf... | Python | 0 | @@ -4124,16 +4124,33 @@
ePath)%0A%0A
+ try:%0A
@@ -4172,32 +4172,32 @@
ath, 'r') as f:%0A
-
@@ -4254,179 +4254,8 @@
- return obj%0A%0A # try:%0A # with open(filePath, 'r') as f:%0A # obj = jsonpickle.decode(f.read(), backend = 'simplejson',... |
ea972c89cd7abe4fdb772ce359dd9acd83817242 | Add http_transport and websocket_transport methods | tests/test.py | tests/test.py | from devicehive import Handler
from devicehive import DeviceHive
class TestHandler(Handler):
"""Test handler class."""
def handle_connect(self):
if not self.options['handle_connect'](self):
self.api.disconnect()
def handle_event(self, event):
pass
class Test(object):
""... | Python | 0.000028 | @@ -618,16 +618,180 @@
t_name%0A%0A
+ def http_transport(self):%0A return self._transport_name == 'http'%0A%0A def websocket_transport(self):%0A return self._transport_name == 'websocket'%0A%0A
def
|
48ac7e52cf494eb71237093a1d0757c0b407b096 | Add mol2 writing | oddt/pandas.py | oddt/pandas.py | """ Pandas extension for chemical analysis """
from __future__ import absolute_import
import pandas as pd
import oddt
pd.set_option("display.max_colwidth", 999999)
def _mol_reader(fmt='sdf',
filepath_or_buffer=None,
usecols=None,
molecule_column='mol',
... | Python | 0.000285 | @@ -79,16 +79,46 @@
_import%0A
+from collections import deque%0A
import p
@@ -2326,19 +2326,845 @@
urn
-next(result
+deque(result, maxlen=1).pop()%0A%0A%0Adef read_mol2(filepath_or_buffer=None,%0A usecols=None,%0A molecule_column='mol',%0A molecule_name='mol_name',%0A ... |
49d9f8374769a5febc20edaa09ed7be02e5c6b25 | Fix test | tests/test.py | tests/test.py | # -*- coding: utf-8 -*-
import logging
from docker_registry import testing
logger = logging.getLogger(__name__)
class TestQuery(testing.Query):
def __init__(self):
self.scheme = 'elliptics'
class TestDriver(testing.Driver):
def __init__(self):
self.scheme = 'elliptics'
self.path =... | Python | 0.000004 | @@ -355,11 +355,63 @@
Config(%7B
+%22elliptics_nodes%22: %221.1.2.3:1025:2 10.0.0.2:1025:10%22
%7D)%0A
|
2717f5ba22ccc0308b4805658c8ebe9077c20352 | add a str-to-int helper | ceph_medic/util/__init__.py | ceph_medic/util/__init__.py | Python | 0 | @@ -0,0 +1,663 @@
+%0Adef str_to_int(string):%0A %22%22%22%0A Parses a string number into an integer, optionally converting to a float%0A and rounding down.%0A%0A Some LVM values may come with a comma instead of a dot to define decimals.%0A This function normalizes a comma into a dot%0A %22%22%22%0A ... | |
c934de6b8d05eeada3affe1762061ad5f684ec0c | Add Variable doc attribute to web api | openfisca_web_api/loader/variables.py | openfisca_web_api/loader/variables.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function, division, absolute_import
import datetime
import inspect
import textwrap
from openfisca_core.indexed_enums import Enum
from openfisca_core.commons import to_unicode
from openfisca_core.variables import VALUE_TYPES
def get_next_day(date... | Python | 0 | @@ -2694,16 +2694,85 @@
%7D%0A%0A
+ if variable.doc:%0A result%5B'documentation'%5D = variable.doc%0A%0A
if v
|
63e4dc7d1278bb905d8daa420cd211d746e72190 | Update models.py | molo/commenting/models.py | molo/commenting/models.py | from django_comments.models import Comment, COMMENT_MAX_LENGTH
from django_comments.models import CommentFlag
from django.dispatch import receiver
from django_comments.signals import (
comment_was_flagged,
comment_was_posted,
)
from django.conf import settings
from django.db import models
from django.db.models.... | Python | 0 | @@ -1135,16 +1135,161 @@
nager()%0A
+ %0A class MPTTMeta:%09%0A # comments on one level will be ordered by date of creation%09%0A order_insertion_by = %5B'submit_date'%5D%09%0A
%0A cla
|
70b442a6d8801e689d9211788a6ede744bb1c27d | fix API bug in AUC (#981) | monai/handlers/roc_auc.py | monai/handlers/roc_auc.py | # Copyright 2020 MONAI Consortium
# 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, s... | Python | 0 | @@ -2663,16 +2663,95 @@
outputs.
+%0A device: device specification in case of distributed computation usage.
%0A%0A No
@@ -3143,16 +3143,63 @@
a x: x,%0A
+ device: Optional%5Btorch.device%5D = None,%0A
) -%3E
@@ -3246,16 +3246,31 @@
ransform
+, device=device
)%0A
|
63074312aeb44b5db7f4e914c64864483f6a6510 | Update Apitools to version 0.5.6 | sdks/python/setup.py | sdks/python/setup.py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | Python | 0 | @@ -2738,17 +2738,17 @@
ls%3E=0.5.
-2
+6
,%3C1.0.0'
|
885e41eebe513cc237c9473069f61a609d2eb9b4 | Bump version number. | mopidy_mobile/__init__.py | mopidy_mobile/__init__.py | from __future__ import unicode_literals
import os
from mopidy import config, ext
__version__ = '1.8.0'
class Extension(ext.Extension):
dist_name = 'Mopidy-Mobile'
ext_name = 'mobile'
version = __version__
def get_config_schema(self):
schema = super(Extension, self).get_config_schema()
... | Python | 0 | @@ -100,9 +100,9 @@
1.8.
-0
+1
'%0A%0A%0A
|
a9bef19e17f96e66f4299a2df4b2fb63a137f473 | Allow tests/tmp to be a symlink, use absolute path to build script | tests/run-tests.py | tests/run-tests.py | #!/usr/bin/env python
import sys
import yaml
import os
import os.path
import subprocess
def run(cmd, **kwargs):
print repr(cmd), repr(kwargs)
subprocess.check_call(cmd, **kwargs)
def discover_tests(test_specs_dir):
tests = []
for entry in os.listdir(test_specs_dir):
if entry[0] == '.':
... | Python | 0 | @@ -1877,33 +1877,79 @@
-run('cd %25s && ../../build
+build_script = os.path.join(test_root, '../build')%0A run('cd %25s && %25s
scr
@@ -1976,16 +1976,30 @@
est_tmp,
+ build_script,
options
|
27ebdeb57dd78564770ef92b95bc659b25e10a69 | Fix 'keypair show' command output | openstackclient/compute/v2/keypair.py | openstackclient/compute/v2/keypair.py | # Copyright 2013 OpenStack Foundation
#
# 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 ... | Python | 0.999998 | @@ -4552,19 +4552,8 @@
info
-%5B'keypair'%5D
)%0A
|
74c20f976060f2056c91edcde810ccc3e8dc3f14 | add scene_doc to subscene iteration | tests/serialize.py | tests/serialize.py | #!/usr/bin/env python
import os
import os.path as op
from pynodegl_utils.com import query_subproc, query_inplace
def serialize(dirname, subproc=False):
module_pkg = 'pynodegl_utils.examples'
if subproc:
ret = query_subproc(query='list', pkg=module_pkg)
else:
ret = query_inplace(query='li... | Python | 0.000002 | @@ -519,16 +519,27 @@
ne_name,
+ scene_doc,
widgets
|
b1e8ee5d8578ce18484e278d4b7bf3b654ce96de | use compatible python3 syntax | misc/cores.py | misc/cores.py | # http://codeliberates.blogspot.com/2008/05/detecting-cpuscores-in-python.html
def detectCPUs():
import os
"""
Detects the number of CPUs on a system. Cribbed from pp.
"""
# Linux, Unix and MacOS:
if hasattr(os, "sysconf"):
if os.sysconf_names.has_key("SC_NPROCESSORS_ONLN"):
# L... | Python | 0.000208 | @@ -979,12 +979,13 @@
rint
-
+(
%225%22
+)
%0Aels
@@ -996,17 +996,17 @@
print
-
+(
detectCP
@@ -1009,9 +1009,10 @@
ctCPUs()
+)
%0A
|
de7d02815f32df7c89297184e845d9c8e30cebbb | Remove a waiting time | checks.d/services_checks.py | checks.d/services_checks.py | from checks import AgentCheck
from util import headers
import urllib2
import time
import socket
import logging
from Queue import Queue
import hashlib
from thread_pool import Pool
EVENT_TYPE = SOURCE_TYPE_NAME = 'servicecheck'
TIMEOUT = 150
class Status:
DOWN = "DOWN"
UP = "UP"
class BadConfException(Excepti... | Python | 0.000192 | @@ -4203,30 +4203,8 @@
d)%0A%0A
- time.sleep(1)%0A
|
def8eb0844e95d82b25c0a79c3be42bfaacb100c | add sphinx documentation | ot/__init__.py | ot/__init__.py |
# Python Optimal Transport toolbox
import utils
import datasets
import plot
# Ot functions
from emd import emd
from bregman import sinkhorn
from utils import dist,dots
__all__ = ["emd","sinkhorn","utils",'datasets','plot','dist','dot']
| Python | 0 | @@ -235,11 +235,12 @@
st','dot
+s
'%5D%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.