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 |
|---|---|---|---|---|---|---|---|
4985c0533c52dca827b60244305de77f3abc9e0d | Fix wrong keys | tartpy/network.py | tartpy/network.py | from collections.abc import Mapping, Sequence
import json
import socket
import socketserver
import threading
from urllib.parse import urlparse
import uuid
from .runtime import Runtime, behavior, Actor
from .tools import actor_map, dict_map
class NetworkRuntime(Runtime):
def __init__(self, url):
super()._... | Python | 0.023501 | @@ -1163,18 +1163,13 @@
d':
-self.
uid%7D%0A
+
%0A
@@ -1330,16 +1330,17 @@
id(msg%5B'
+_
url'%5D, m
@@ -1343,16 +1343,17 @@
%5D, msg%5B'
+_
uid'%5D)%0A%0A
@@ -1460,16 +1460,16 @@
ng) and%0A
-
@@ -1507,16 +1507,17 @@
_uid', '
+_
url'%7D)%0A
|
b9b41ea38de0b54cf85829c10a764aaf70d3e4bf | remove a useless local variable | charsleft_widget/widgets.py | charsleft_widget/widgets.py | from django import forms
from django.utils.safestring import mark_safe
from django.utils.translation import ugettext_lazy as _
try:
# py2.x
from django.utils.encoding import force_unicode as force_str
except ImportError:
# py3.x
from django.utils.encoding import force_text as force_str
try:
# Djang... | Python | 0.000528 | @@ -1141,61 +1141,8 @@
e))%0A
- char_remain_str = _(u'characters remaining')%0A
@@ -1558,31 +1558,42 @@
n_str':
-char_
+_(u'characters
remain
-_str
+ing')
,%0A
|
41df2db2fcc3a03c00feaccbd40ccac9f7195ec9 | bump to 0.2.4: version was outdated | mangopay/__init__.py | mangopay/__init__.py | __version__ = (0, 2, 3)
| Python | 0.000013 | @@ -18,7 +18,8 @@
2,
-3
+4
)%0A
+%0A
|
90cf5d380c80c05fa37c1e3ec2171c097a5365c9 | fix test that hangs occasionally to fail instead if a short time elapses without success | test/Parallel/failed-build.py | test/Parallel/failed-build.py | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | Python | 0.000002 | @@ -1246,24 +1246,22 @@
tSCons%0A%0A
-_
python
-_
= TestS
@@ -1265,24 +1265,22 @@
stSCons.
-_
python
-_
%0A%0Atry:%0A
@@ -2567,25 +2567,66 @@
rt time%0A
-while not
+for i in %5B1, 2, 3, 4, 5%5D:%0A time.sleep(2)%0A if
os.path
@@ -2656,30 +2656,20 @@
'):%0A
-time.sleep(1)%0A
+
os.mkdir
@@ -268... |
12d2d4364070a64dc4960955a29d4c333d4aa38d | Debug output for kmeans | matchmaker/kmeans.py | matchmaker/kmeans.py | #!/usr/bin/env python
"""K-Means
Thanks to G-Do [ http://www.daniweb.com/forums/member37720.html ]
http://www.daniweb.com/forums/thread31449.html
"""
import sys, math, random
class Point:
"""The Point class represents points in n-dimensional space
coords is a list of coordinates for this Point
n is the ... | Python | 0 | @@ -3183,19 +3183,99 @@
-while True:
+jter = 0%0A while True:%0A print %3E%3Esys.stderr, %22j =%22, jter%0A jter += 1%0A
%0A
@@ -3386,16 +3386,33 @@
nd(%5B%5D)%0A%0A
+ iter = 0%0A
@@ -3425,24 +3425,24 @@
each Point:%0A
-
for
@@ -3446,32 +3446,154 @@
or p ... |
2992eede5ba829bb03a85689246775e37f9f69dd | modify version | mdcorpus/__init__.py | mdcorpus/__init__.py | #! /usr/bin/env python
# -*- coding: utf-8 -*-
__version__ = "0.1.0"
__all__ = ["mdcorpus", "parser"]
from storm.locals import *
from mdcorpus import *
# initializing the relationships
MovieTitlesMetadata.genres = ReferenceSet(MovieTitlesMetadata.id,
MovieGenreLine.movie_id,... | Python | 0 | @@ -62,11 +62,11 @@
%220.
-1.0
+0.1
%22%0A__
|
e975b27484a3d1a6cc96df604f99a4a3efab92b8 | Add better title to job page. | app/dashboard/views/job.py | app/dashboard/views/job.py | # This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be usefu... | Python | 0 | @@ -1445,16 +1445,44 @@
wargs):%0A
+ job = kwargs%5B%22job%22%5D%0A
@@ -1530,29 +1530,97 @@
187;%22 %25
-kwargs%5B%22job%22%5D
+job%0A page_title = %22%25s — «%25s» job%22 %25 (self.PAGE_TITLE, job)
%0A
@@ -1789,29 +1789,19 @@
job=
-kwargs%5B%22
job
-%22%5D
,%0A... |
e1da4e0047449939086a7e36ac3c85bbcd62e713 | add __all__ | src/utils/functions/sql.py | src/utils/functions/sql.py | from itertools import takewhile
from pprint import pprint
def sql_formato_fo2(sql):
"""Recebe um SQL como executado no RDBMS
Retira a identação de todas as linhas não comentário e elimina
linhas vazias do início e do final.
Retorna SQL 'formatado'
"""
linhas = sql.split('\n')
min_spaces =... | Python | 0.99848 | @@ -53,16 +53,55 @@
print%0A%0A%0A
+__all__ = %5B%0A 'sql_formato_fo2',%0A%5D%0A%0A%0A
def sql_
|
16ecb86d28c3587fabf4268c27a6db255af6de7d | fix tests | statsy/__init__.py | statsy/__init__.py | # coding: utf-8
from django.utils.module_loading import autodiscover_modules
from statsy.log import logger
from statsy.sites import site
__all__ = [
'send', 'watch', 'get_send_params'
'objects', 'groups', 'events',
'site', 'autodiscover', 'logger'
]
def autodiscover():
autodiscover_modules('stats'... | Python | 0.000001 | @@ -591,16 +591,42 @@
Statsy()
+,%0A 'Statsy': Statsy
%0A %7D)%0A
|
9617c68ee1beca10c5cc1ce820f50bcdf1355bc8 | Fix python test determinism without infomap library | test/testDeterminism.py | test/testDeterminism.py | from infomap import infomap
import sys
import argparse
import subprocess
import re
def run(input, count, infomapArgs):
firstCodelength = 0.0
for i in range(1, count + 1):
print("\nStarting run {}...".format(i))
res = subprocess.run(['./Infomap', input, infomapArgs], stdout=subproces... | Python | 0.000074 | @@ -1,32 +1,4 @@
-from infomap import infomap%0A
impo
|
1508906ba67094c819986c449a2ac83d0e3b27f6 | Fix testValidEvent() to allow timezones with positive offset | test/test_google_api.py | test/test_google_api.py | #!/usr/bin/python
import google_api
import unittest
import re
import os
class AuthLink(unittest.TestCase):
def testAuthLink(self):
secure = '1'
if google_api.debug:
secure = '0'
expected = "https://www.google.com/accounts/AuthSubRequest?scope=https%3A%2F%2Fwww.google.com%2Fcal... | Python | 0.000016 | @@ -2039,33 +2039,36 @@
d%7B2%7D:%5Cd%7B2%7D.%5Cd%7B3%7D
--
+%5B-+%5D
%5Cd%7B2%7D:%5Cd%7B2%7D%22, st
@@ -2154,17 +2154,20 @@
2%7D.%5Cd%7B3%7D
--
+%5B-+%5D
%5Cd%7B2%7D:%5Cd
|
83a0386bcb9680da4470af5be10ef7e9e4e980bf | test RG | src/runner.py | src/runner.py | '''
Run a pipeline stage either locally or on the cluster,
taking into account the configuration settings,
and command line options of the pipeline.
'''
from ruffus.drmaa_wrapper import run_job, error_drmaa_job
# slurm memory is requested in MB, but the config file specifies in GB
MEGABYTES_IN_GIGABYTE = 1024
'''
S... | Python | 0.000001 | @@ -3440,32 +3440,34 @@
%0A
+ #
retain_stdout =
|
c19f340d361fb9788b5cfd18e4f622493d818ca0 | Add test for as_pairs | test/test_validation.py | test/test_validation.py | from __future__ import division, absolute_import, print_function
try:
import enum
SUPPORTS_ENUM = True
except ImportError:
SUPPORTS_ENUM = False
import confuse
import os
import unittest
from . import _root
class TypeCheckTest(unittest.TestCase):
def test_str_type_correct(self):
config = _roo... | Python | 0.000003 | @@ -4607,20 +4607,233 @@
onfig%5B'f'%5D.as_str()%0A
+%0A def test_as_pairs(self):%0A config = _root(%7B'k': %5B%7B'a': 'A'%7D, 'b', %5B'c', 'C'%5D%5D%7D)%0A self.assertEqual(%0A %5B('a', 'A'), ('b', None), ('c', 'C')%5D,%0A config%5B'k'%5D.as_pairs()%0A )%0A
|
9a031390e3c67586b60715c4a17a75063b5f7661 | Add parentheses to method call. | pushhubsearch/models.py | pushhubsearch/models.py | from datetime import datetime
from persistent import Persistent
from persistent.mapping import PersistentMapping
from repoze.folder import Folder
import dateutil.parser
from dateutil.tz import tzutc
import logging
logger = logging.getLogger(__name__)
class Root(PersistentMapping):
__parent__ = __name__ = None
... | Python | 0.000001 | @@ -494,16 +494,18 @@
f.values
+()
if v.Ti
|
5a9b82d442b8b620793242e0303bd149aa7baea8 | Use timezone-aware datetime values. Fixes #23 | pushy/tasks/__init__.py | pushy/tasks/__init__.py | import celery
from django.conf import settings
from datetime import datetime
from ..models import PushNotification
from ..dispatchers import get_dispatcher, Dispatcher
from ..models import get_filtered_devices_queryset, Device
@celery.shared_task(
queue=getattr(settings, 'PUSHY_QUEUE_DEFAULT_NAME', None)
)
def c... | Python | 0.000028 | @@ -51,23 +51,27 @@
om d
-atetime
+jango.utils
import
date
@@ -66,23 +66,23 @@
import
-datetim
+timezon
e%0Afrom .
@@ -1125,31 +1125,31 @@
e_started =
-datetim
+timezon
e.now()%0A
@@ -1541,39 +1541,39 @@
date_finished =
-datetim
+timezon
e.now()%0A
@@ -3317,15 +3317,15 @@
d =
-datetim
+time... |
e775613d43dac702565cf266d9995c9cd706d7c8 | Add documentation for the CPSR command | pwndbg/commands/cpsr.py | pwndbg/commands/cpsr.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import gdb
import pwndbg.arch
import pwndbg.color
import pwndbg.commands
import pwndbg.regs
@pwndbg.commands.Command
@pwndbg.commands.OnlyWhenRunning
def cpsr():
if pwndbg.arch.current != 'arm':
print("This is only availabl... | Python | 0 | @@ -240,16 +240,54 @@
cpsr():%0A
+ 'Print out the ARM CPSR register'%0A
if p
|
c174b06ec79070f5e3f7820f59a1133ddf13d1dd | update version prior to tag | py/desispec/_version.py | py/desispec/_version.py | __version__ = '0.5.0.dev858'
| Python | 0 | @@ -14,16 +14,9 @@
'0.
-5
+7
.0
-.dev858
'%0A
|
76e220d80d88be6068e2ac82af4d41a437ec115f | fix invalid syntax for Python 3.4 | swh/web/ui/main.py | swh/web/ui/main.py | # Copyright (C) 2015-2016 The Software Heritage developers
# See the AUTHORS file at the top-level directory of this distribution
# License: GNU Affero General Public License version 3, or any later version
# See top-level LICENSE file for more information
import logging
import os
from flask import Flask
from flask_... | Python | 0.00121 | @@ -2954,17 +2954,16 @@
imiter'%5D
-,
%0A )%0A
|
ecbd6a9f42f04d40ccafbbc3d28a6110a7c0f644 | transfer weekday string representation to python datetime weekday representation | swty_downloader.py | swty_downloader.py | #!/usr/local/bin/python
import argparse
import urllib
from datetime import date, timedelta
_DATE_SEPARATOR = '-'
#TODO: use Enum instead
_MONDAY = 'Monday'
_TUESDAY = 'Tuesday'
_WEDNESDAY = 'Wednesday'
_THURSDAY = 'Tuesday'
_FRIDAY = 'Friday'
def _construct_url(date):
return 'http://swtychina.com/gb/audiodoc/{y... | Python | 0.999999 | @@ -1000,81 +1000,249 @@
ef _
-start_download(start_date, end_date, chosen_weekdays):%0A #TODO%0A pass
+download_certain_weekday_program(start_date, end_date, day):%0A #TODO%0A pass%0A%0Adef _start_download(start_date, end_date, chosen_weekdays):%0A for day in chosen_weekdays:%0A _download_certai... |
58e91fc46e75f084ad05459590fcf34b03ab0f36 | improve modularization | src/search.py | src/search.py | import re
import suds
import texttable as tt
import xml.etree.ElementTree as ET
from .config import user_id, password
from datetime import date
from operator import itemgetter
from six import print_
from wos import WosClient
def _draw_table(data):
# Generate table
tab = tt.Texttable()
tab.set_cols_align(... | Python | 0.000121 | @@ -528,23 +528,30 @@
)%0A%0A%0Adef
-search(
+query(client,
author,
@@ -589,235 +589,8 @@
e):%0A
- try:%0A client = WosClient(user_id, password)%0A client.connect()%0A except suds.WebFault as e:%0A print_('Username and/or password not valid, or requests limit exceeded')%0A print_... |
3eb3c5ffc0e346103d60c121598e170c3a816818 | Add command handler to flask route | src/server.py | src/server.py | import logging
import asyncio
import flask
import threading
import aiocoap.resource as resource
import aiocoap
app = flask.Flask(__name__,static_folder="../static",static_url_path="/static",template_folder="../templates")
@app.route("/")
def hello():
return flask.render_template("index.html", name="index")
class... | Python | 0 | @@ -241,13 +241,13 @@
def
-hello
+index
():%0A
@@ -308,16 +308,91 @@
ndex%22)%0A%0A
+@app.route(%22/%3Cint:id%3E/%3Ccommand%3E%22)%0Adef parseCommand(id, command):%0A pass%0A%0A
class Bl
|
1d08ce3729417b5360bdf5ab7d6a545089e9e17c | Bump target bitrate on webm conversions | mediacrush/worker.py | mediacrush/worker.py | import os
import tempfile
import subprocess
import shutil
import threading
from datetime import datetime
from .config import _cfg, _cfgi
from .database import r, _k
from .files import processing_needed, extension, compression_rate
from .objects import File
class TimeLimitedCommand(object):
crashed = False
d... | Python | 0 | @@ -1712,17 +1712,17 @@
od -b:v
-1
+2
M -crf 5
|
226fcebb6effc474287d6a0ce5cbcdbe9e16720f | Clean client.py | juju_onlinelabs/client.py | juju_onlinelabs/client.py | import os
from juju_onlinelabs.exceptions import ProviderAPIError
import json
import requests
class Entity(object):
@classmethod
def from_dict(cls, data):
i = cls()
i.__dict__.update(data)
return i
class Server(Entity):
"""
Attributes: id, name, image, state, public_ip, cre... | Python | 0 | @@ -2346,157 +2346,8 @@
')%0A%0A
- #if data%5B'status'%5D != %22OK%22:%0A #raise ProviderAPIError(%0A #response, data.get('message', data.get('error_message')))%0A%0A
|
7c161e097d198e6c766a3a085d9b915e3803d7e0 | deal with `u''` in test_paths | kazoo/tests/test_paths.py | kazoo/tests/test_paths.py | from unittest import TestCase
from kazoo.protocol import paths
class NormPathTestCase(TestCase):
def test_normpath(self):
self.assertEqual(paths.normpath('/a/b'), '/a/b')
def test_normpath_empty(self):
self.assertEqual(paths.normpath(''), '')
def test_normpath_unicode(self):
se... | Python | 0 | @@ -1,12 +1,23 @@
+import sys%0A
from unittes
@@ -70,16 +70,180 @@
paths%0A%0A%0A
+if sys.version_info %3E (3, ): # pragma: nocover%0A def u(s):%0A return s%0Aelse: # pragma: nocover%0A def u(s):%0A return unicode(s, %22unicode_escape%22)%0A%0A%0A
class No
@@ -519,16 +519,17 @@
rmpath(u
+(
'/... |
ce4c24b480f34b75c047edd2ecad13755c48627e | Support identifying blackberry user agents | king_phisher/ua_parser.py | king_phisher/ua_parser.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# king_phisher/ua_parser.py
#
# 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 copyright
# notice, this l... | Python | 0 | @@ -1638,16 +1638,27 @@
android%7C
+blackberry%7C
(ipad%7Cip
@@ -2238,16 +2238,72 @@
ndroid'%0A
+%09elif 'blackberry' in os_name:%0A%09%09os_name = 'BlackBerry'%0A
%09elif 'i
|
8c0d6a6dc75b0f1ec7f39ceb97e8b1d76f4246b8 | Bump version for impending release | releases/_version.py | releases/_version.py | __version_info__ = (1, 1, 0)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0 | @@ -16,17 +16,17 @@
_ = (1,
-1
+2
, 0)%0A__v
|
91eca37144d0c378761e47c143e66a79af37c226 | Fix IntegrityError and DoesNotExist 500s | repo_manage/forms.py | repo_manage/forms.py |
from django import forms
from django.forms import ModelForm
from django.forms.models import inlineformset_factory
from common.models import Repository, Collaboration, User
slug_errors = {
'invalid' : "Use only letters, numbers, underscores, and hyphens",
}
class NewRepositoryForm(forms.Form):
repo_name ... | Python | 0.000001 | @@ -804,45 +804,8 @@
gs:%0A
- print kwargs%5B'instance'%5D%0A
@@ -905,27 +905,170 @@
def
-save(self, **kwargs
+clean(self):%0A cleaned_data = super(CollaborationForm, self).clean()%0A self.instance.full_clean()%0A return cleaned_data%0A%0A def clean_user(self
):%0A
@@ -1125... |
f287cec50cf121824b2cd2611215fb3c0a85b20b | handle 'config' doctype. | pyang/plugins/sample.py | pyang/plugins/sample.py | # Copyright (c) 2014 by Ladislav Lhotka, CZ.NIC <lhotka@nic.cz>
#
# Pyang plugin generating a XSLT1 stylesheet for XML->JSON translation.
#
# 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 perm... | Python | 0 | @@ -3233,19 +3233,55 @@
-if ctx.opts
+self.doctype = ctx.opts.doctype%0A if self
.doc
@@ -3414,24 +3414,20 @@
-ctx.opts
+self
.doctype
@@ -4018,24 +4018,20 @@
Element(
-ctx.opts
+self
.doctype
@@ -4597,16 +4597,74 @@
ildren:%0A
+ if ch.i_config or self.doctype == %22data%22:%0A ... |
a90bc8e6ee01e8ed91bd62efdbf900b998c69001 | remove FboException (doesn't exist anymore.) | kivy/factory_registers.py | kivy/factory_registers.py | # Auto-generated file by setup.py build_factory
from kivy.factory import Factory
r = Factory.register
r('Animation', module='kivy.animation')
r('AnimationTransition', module='kivy.animation')
r('ExceptionHandler', module='kivy.base')
r('Cache', module='kivy.cache')
r('ClockBase', module='kivy.clock')
r('KivyConfigPar... | Python | 0 | @@ -1943,54 +1943,8 @@
o')%0A
-r('FboException', module='kivy.graphics.fbo')%0A
r('I
|
2b646f719c293532b7190405ebd3437fb957690f | Version bump to 0.6.1 | tasky/__init__.py | tasky/__init__.py | # Copyright 2016 John Reese
# Licensed under the MIT license
# flake8: noqa
from .tasks import Task, PeriodicTask, TimerTask, QueueTask
from .config import Config, JsonConfig
from .loop import Tasky
__version__ = '0.6.0'
| Python | 0 | @@ -213,11 +213,11 @@
= '0.6.
-0
+1
'%0A
|
9963da42589fbc8f3c886c8482c45e514c731285 | Fix a URL bug. | tcamp/reg/urls.py | tcamp/reg/urls.py | from django.conf.urls import patterns, include, url
from django.contrib import admin
from django.views.generic.base import TemplateView
from reg.views import *
from reg.badges import *
urlpatterns = patterns('',
url(r'^$', register),
url(r'^override/$', register_override),
url(r'^price/$', price_check),
... | Python | 0 | @@ -709,16 +709,19 @@
a-z0-9%5D%7B
+21,
22%7D)%5C.js
|
ec36caa23fef6426f88640879486171b50f888bf | Remove monkeypatch where it is no more used | tests/bagatom/test_getters.py | tests/bagatom/test_getters.py | from lxml import etree
from mock import mock_open, patch
import pytest
from codalib import bagatom
@patch('codalib.bagatom.os.stat')
@patch('codalib.bagatom.os.walk')
def test_getOxum(mock_walk, mock_stat):
"""
Check the return value of getOxum with patched system calls.
getOxum should return the total ... | Python | 0 | @@ -1365,27 +1365,16 @@
ns_dict(
-monkeypatch
):%0A %22
@@ -1688,19 +1688,8 @@
pen(
-monkeypatch
):%0A
|
dc61874bd9b459fac25a81c6df559c441ff68eb3 | update error handlers to use g.error | pyfarm/master/errors.py | pyfarm/master/errors.py | # No shebang line, this module is meant to be imported
# -*- coding: utf-8 -*-
#
# Copyright 2013 Oliver Palmer
#
# 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/li... | Python | 0.000001 | @@ -1157,17 +1157,20 @@
jsonify
+, g
%0A
-
%0A%0Adef er
@@ -1428,45 +1428,26 @@
-return jsonify(%7B%0A %22
+error = g.
error
-%22:
+ or
%22un
@@ -1486,17 +1486,51 @@
uest.url
-%7D
+%0A return jsonify(error=error
), BAD_R
@@ -1913,45 +1913,26 @@
-return jsonify(%0A %7B%2... |
9503df05b5600ef0867fc69921170e004f03fae1 | Initialize certificate manager in Cluster class | pylxd/models/cluster.py | pylxd/models/cluster.py | # Copyright (c) 2016 Canonical Ltd
#
# 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 | @@ -1098,16 +1098,97 @@
t, self)
+%0A self.certificate = managers.ClusterCertificateManager(self.client, self)
%0A%0A @p
|
d0c8fc4ecc475d29e19d821fb3b9a04e1dd8203c | Remove unnecessary future import | tests/import_rewrite_tests.py | tests/import_rewrite_tests.py | from __future__ import unicode_literals
from nose.tools import assert_equal
from vendorize.import_rewrite import rewrite_imports_in_module
def test_module_without_imports_is_unchanged():
assert_equal(
"print(42)",
rewrite_imports_in_module(
"print(42)",
top_level_names=[]... | Python | 0.000003 | @@ -1,45 +1,4 @@
-from __future__ import unicode_literals%0A%0A
from
|
45f34307c61582f8446bf4c2e65f81cc67291644 | remove problem with win32 | pyscraper/runfilters.py | pyscraper/runfilters.py | #! /usr/bin/python2.3
# vim:sw=8:ts=8:et:nowrap
import sys
import re
import os
import string
import cStringIO
import xml.sax
xmlvalidate = xml.sax.make_parser()
from filterwranscolnum import FilterWransColnum
from filterwransspeakers import FilterWransSpeakers
from filterwranssections import FilterWransSections
fr... | Python | 0.00001 | @@ -3124,16 +3124,127 @@
+if sys.platform != %22win32%22:%0A%09%09%09%09%09%09%09# this function leaves the file open which can't be renamed in win32%0A%09%09%09%09%09%09%09
xmlvalid
|
fe6c8937a1c26acc736f218b73b3eb2968e8b6c7 | Increment version | pysendpulse/__init__.py | pysendpulse/__init__.py | __author__ = 'Maksym Ustymenko'
__author_email__ = 'tech@sendpulse.com'
__copyright__ = 'Copyright 2017, SendPulse'
__credits__ = ['Maksym Ustymenko', ]
__version__ = '0.0.7'
| Python | 0.000002 | @@ -165,11 +165,11 @@
= '0.0.
-7
+8
'%0A
|
bcde0e3271a153d72568687fcab0f032a536749e | fix directory listing with broken symlinks | pysftpserver/storage.py | pysftpserver/storage.py | """General SFTP storage. Subclass it the way you want!"""
import os
import itertools
from pysftpserver.abstractstorage import SFTPAbstractServerStorage
from pysftpserver.futimes import futimes
from pysftpserver.stat_helpers import stat_to_longname
class SFTPServerStorage(SFTPAbstractServerStorage):
"""Simple st... | Python | 0 | @@ -1537,32 +1537,53 @@
)%0A else:%0A
+ try:%0A
_sta
@@ -1611,16 +1611,20 @@
+
+
filename
@@ -1638,16 +1638,20 @@
parent%0A
+
@@ -1686,32 +1686,362 @@
rent, filename)%0A
+ )%0A except:%0A # we could have a broke... |
419bb26ddc3017fb87cd9ce1853bc4f64f052394 | Use exception which prints the same regardless of config. | tests/misc/print_exception.py | tests/misc/print_exception.py | import _io as io # uPy does not have io module builtin
import sys
if hasattr(sys, 'print_exception'):
print_exception = sys.print_exception
else:
import traceback
print_exception = lambda e, f: traceback.print_exception(None, e, sys.exc_info()[2], file=f)
def print_exc(e):
buf = io.StringIO()
print... | Python | 0 | @@ -846,11 +846,11 @@
-XXX
+1/0
%0Aexc
@@ -995,11 +995,11 @@
-YYY
+2/0
%0Atry
|
8144f9c6b8812e33a6a6bd6777502fd95db1c4ea | Implement ``TEST_DISABLED_APPS`` settings, update ``INSTALLED_APPS`` list. | testproject/settings.py | testproject/settings.py | import os
import sys
# Calculate current directory path and add it to ``sys.path``
DIRNAME = os.path.abspath(os.path.dirname(__file__))
sys.path.append(DIRNAME)
# Debug settings
DEBUG = True
TEMPLATE_DEBUG = DEBUG
# Test settings
TDDSPRY_TEST_CASE = 'django.test.TestCase'
# Authentication settings
AUTH_PROFILE_MOD... | Python | 0 | @@ -215,68 +215,8 @@
UG%0A%0A
-# Test settings%0ATDDSPRY_TEST_CASE = 'django.test.TestCase'%0A%0A
# Au
@@ -237,16 +237,16 @@
ettings%0A
+
AUTH_PRO
@@ -883,24 +883,94 @@
stration',%0A%0A
+ 'testproject.disabled.attr',%0A 'testproject.disabled.setting',%0A%0A
'testpro
@@ -1734,16 +1734,132 @@
s'),%0A)%0A... |
26fc49f1a29d60bf175094be5bb77abff56844ba | test that crosses are vibrant red | tests/test_announcer_chair.py | tests/test_announcer_chair.py | import unittest
from source.announcer_chair import *
class AnnouncerTestCase(unittest.TestCase):
def setUp(self):
self.announcer = Announcer()
self.start = "Welcome to XOX, a Noughts and Crosses Game"
self.select = "Type 1 to go first, or 2 to go second."
self.tie = "The game is a ... | Python | 0.998406 | @@ -683,16 +683,24 @@
d = '''%0A
+%5C033%5B91m
X %5C033%5B
@@ -713,16 +713,24 @@
%5C033%5B0m%7C
+%5C033%5B91m
X %5C033%5B
@@ -805,16 +805,24 @@
---+---%0A
+%5C033%5B91m
X %5C033%5B
|
c2b75e624a398c18228108d1ebd1458e4bc7a3ad | Remove print. | tests/test_csv_upload_flow.py | tests/test_csv_upload_flow.py | import uuid
import datetime
import sys
import re
import time
import imaplib
import email as email_lib
import email.header
import pytest
from requests import session
from config import Config
from tests.utils import (retrieve_sms_with_wait,
delete_sms_messge,
find_csrf_t... | Python | 0.000001 | @@ -1769,43 +1769,8 @@
l))%0A
- print(post_check_sms.text)%0A
|
a503c35232e8f9ffca3426de5e92ce884134f775 | Use atexit for cleanup. | teres/__init__.py | teres/__init__.py | # -*- coding: utf-8 -*-
# This file is part of Teres.
#
# Copyright (C) 2016 Peter Kotvan
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | Python | 0 | @@ -1103,16 +1103,31 @@
nished.%0A
+import atexit%0A%0A
FILE = 9
@@ -1486,16 +1486,125 @@
sult%5D%0A%0A%0A
+@atexit.register%0Adef cleanup():%0A %22%22%22%0A Cleanup method.%0A %22%22%22%0A Reporter.get_reporter().test_end()%0A%0A%0A
class Ha
|
9c4f69880e605fa853f1073015e8515935350534 | Improve code formatting. | teres/handlers.py | teres/handlers.py | # -*- coding: utf-8 -*-
# This file is part of Teres.
#
# Copyright (C) 2016 Peter Kotvan
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 2.1 of the License, or (at you... | Python | 0.000005 | @@ -2837,29 +2837,16 @@
ger.log(
-%0A
_result_
|
f21df54c7c7b1373ec514b88f9cb3818d55705d1 | Use assertRedirects() to test redirects | test/app/tests.py | test/app/tests.py | from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import Client, TestCase
from app.models import TestModel
class AbstractTestCase(TestCase):
def setUp(self):
TestModel.objects.all().delete()
User.objects.create_superuser('user', 'email@test.... | Python | 0 | @@ -783,65 +783,17 @@
sert
-Equal(response.status_code, 302)%0A self.assertEqual
+Redirects
(res
@@ -789,36 +789,32 @@
directs(response
-.url
, 'http://testse
@@ -1356,60 +1356,21 @@
dd')
-)%0A self.assertEqual(response.status_code, 302
+, follow=True
)%0A
@@ -1378,37 +1378,41 @@
self.assert... |
bdb2bccffd7b30b66a85debd820a8367e654685f | Update protocol: start-time is preferred over start_time | python/oml4py/oml4py.py | python/oml4py/oml4py.py | #
# Description: Python Class for OML Connection and Data Uploading
#
# From http://oml.mytestbed.net/projects/oml/wiki/Description_of_Text_protocol
#
# The client opens a TCP connection to an OML server and then sends a header
# followed by a sequence of measurement tuples. The header consists of a
# sequence of ke... | Python | 0 | @@ -3168,17 +3168,17 @@
%22start
-_
+-
time: %22
|
3e4600a42c8f3153840c875ac17709f8d3d58e6f | save received values to csv | python/recvBroadcast.py | python/recvBroadcast.py | import socket
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
UDP_PORT = 42042
# using the '' address works
sock.bind(('', UDP_PORT))
# using the address of eth1 doesn't
#sock.bind(('192.168.2.123', UDP_PORT))
# and neither does using the local loo... | Python | 0 | @@ -6,16 +6,39 @@
t socket
+%0Aimport csv%0Aimport time
%0A%0Asock =
@@ -87,17 +87,16 @@
_DGRAM)%0A
-%0A
sock.set
@@ -147,17 +147,16 @@
ST, 1) %0A
-%0A
UDP_PORT
@@ -168,240 +168,157 @@
042%0A
-%0A# using the '' address works%0Asock.bind(('', UDP_PORT))%0A# using the address of eth1 doesn't%0A#sock.bind(('192.168... |
f6ddd5c4d79ada59d9db4b467849d9b52c5fef75 | Add GraphFields to package import. | landlab/field/__init__.py | landlab/field/__init__.py | from landlab.field.scalar_data_fields import ScalarDataFields, FieldError
from landlab.field.grouped import ModelDataFields, GroupError, GroupSizeError
from landlab.field.field_mixin import ModelDataFieldsMixIn
__all__ = ['ScalarDataFields', 'ModelDataFields', 'ModelDataFieldsMixIn',
'FieldError', 'GroupErr... | Python | 0 | @@ -203,16 +203,53 @@
ldsMixIn
+%0Afrom .graph_field import GraphFields
%0A%0A__all_
@@ -371,10 +371,27 @@
zeError'
+, 'GraphFields',
%5D%0A
|
6009f6ef2e4000cbb18feaa8efd0b46ac5b97e5c | fix some PEP8 things | jenkinsBot.py | jenkinsBot.py | #!/usr/bin/python
from __future__ import (absolute_import, division,
print_function, unicode_literals)
import ast
from jenkins import Jenkins
from errbot import botcmd, BotPlugin
from config import JENKINS_URL, JENKINS_USERNAME, JENKINS_PASSWORD
class JenkinsBot(BotPlugin):
def connect_t... | Python | 0.00013 | @@ -361,16 +361,29 @@
Jenkins(
+%0A
JENKINS_
@@ -689,25 +689,16 @@
h_term)%0A
- %0A
@@ -720,33 +720,32 @@
mat_jobs(jobs)%0A%0A
-%0A
@botcmd%0A
@@ -905,24 +905,40 @@
s.get_jobs()
+%0A
if 'anime'
@@ -954,17 +954,16 @@
olor'%5D%5D%0A
-%0A
@@ -1001,17 ... |
28303a94401ed8eec3658dd3a1b1b09d8ba700f7 | complete test coverage for demo_signal | pywt/tests/test_data.py | pywt/tests/test_data.py | import os
import numpy as np
from numpy.testing import assert_allclose, assert_raises, run_module_suite
import pywt.data
data_dir = os.path.join(os.path.dirname(__file__), 'data')
wavelab_data_file = os.path.join(data_dir, 'wavelab_test_signals2.npz')
wavelab_result_dict = np.load(wavelab_data_file)
def test_data_a... | Python | 0 | @@ -48,16 +48,17 @@
import
+(
assert_a
@@ -80,16 +80,52 @@
_raises,
+ assert_,%0A
run_mod
@@ -133,16 +133,17 @@
le_suite
+)
%0A%0Aimport
@@ -277,17 +277,16 @@
_signals
-2
.npz')%0Aw
@@ -1832,16 +1832,381 @@
, key)%0A%0A
+ # can get a list of the available signals%0A available... |
99d62b24a8c6197accfef8650681a82689ee4bea | add order as bill classification choice | opencivicdata/common.py | opencivicdata/common.py | """
Module for declaration of common constants available throughout Open Civic Data code.
"""
import re
DIVISION_ID_REGEX = r'^ocd-division/country:[a-z]{2}(/[^\W\d]+:[\w.~-]+)*$'
JURISDICTION_ID_REGEX = r'^ocd-jurisdiction/country:[a-z]{2}(/[^\W\d]+:[\w.~-]+)*/\w+$'
# helper for making options-only lists
_keys = la... | Python | 0.974052 | @@ -2842,32 +2842,56 @@
', 'Petition'),%0A
+ ('order', 'Order'),%0A
('concurrent
|
4be36c723788bed029c0ed2c0818672f14e1d801 | Use branches | examples/paper_figures/ks_plots.py | examples/paper_figures/ks_plots.py | # Licensed under an MIT open source license - see LICENSE
'''
KS p-values for different properties.
'''
import numpy as np
from pandas import read_csv
import matplotlib.pyplot as p
import numpy as np
import seaborn as sn
sn.set_context('talk')
sn.set_style('ticks')
sn.mpl.rc("figure", figsize=(7, 9))
# Widths
width... | Python | 0.000002 | @@ -900,18 +900,16 @@
%22face%22)%0A
-#
p.tight_
@@ -918,18 +918,16 @@
yout()%0A%0A
-#
p.show()
@@ -968,16 +968,25 @@
rvature_
+branches_
ks_table
|
a0c1666e29e5068c0cfb97739d57d020208d2482 | version 0.1.2, cosmetic changes to comments etc only. | utils/extract_reads.py | utils/extract_reads.py | #!/bin/env python
#
# extract_random.py: write random subsets of read records from input files
# Copyright (C) University of Manchester 2012 Peter Briggs
#
########################################################################
#
# extract_random.py
#
###########################################################... | Python | 0 | @@ -28,21 +28,20 @@
xtract_r
-andom
+eads
.py: wri
@@ -238,29 +238,28 @@
%0A# extract_r
-andom
+eads
.py%0A#%0A######
@@ -340,21 +340,20 @@
xtract_r
-andom
+eads
.py%0A%0APul
@@ -418,21 +418,20 @@
xtract_r
-andom
+eads
.py %5B-n
@@ -773,17 +773,17 @@
= %220.1.
-1
+2
%22%0A%0A#####
|
fb6a9eebbfaf8da2a9b6a4cd8332fc666b0e8e9f | version bump to 0.4.0 | meshio/meta.py | meshio/meta.py | # -*- coding: utf-8 -*-
#
__version__ = '0.3.0'
__author__ = 'Nico Schlömer'
__author_email__ = 'nico.schloemer@gmail.com'
__website__ = 'https://github.com/nschloe/meshio'
| Python | 0.000001 | @@ -40,9 +40,9 @@
'0.
-3
+4
.0'%0A
|
317ed8a9f77657a9b33519a44ec2071321747a59 | Fix tab spaces. | microreader.py | microreader.py | import feedparser, json, bottle
import lxml.html
import xml.etree.ElementTree as ET
from datetime import datetime
from bottle import route, run, view, install, redirect, hook, request, response, abort, static_file
from peewee import *
from time import mktime
class CustomJsonEncoder(json.JSONEncoder):
def default(s... | Python | 0 | @@ -296,20 +296,17 @@
coder):%0A
-
+%09
def defa
@@ -321,24 +321,18 @@
, obj):%0A
-
+%09%09
if isins
@@ -357,20 +357,11 @@
e):%0A
-
+%09%09%09
retu
@@ -402,24 +402,18 @@
M:%25S%22))%0A
-
+%09%09
if isins
@@ -470,16 +470,10 @@
a'%5D%0A
-
+%09%09
retu
@@ -5127,12 +5127,9 ... |
41d93b76fc2dd3602b8e7e90959685fad5797a65 | remove pdb ref | commons/tests.py | commons/tests.py | from django.test import TestCase
from django.urls import reverse
from django.core.files.uploadedfile import SimpleUploadedFile
from django.contrib.auth.models import User
from .forms import DocumentForm
from .models import Document
import os
class CommonsUploadFormTests(TestCase):
def test_init_invalid_without_en... | Python | 0.000001 | @@ -1611,45 +1611,8 @@
'))%0A
- #import pdb; pdb.set_trace()%0A
|
1b93dbfdaa141b255dce6379ca3a2ad4bbc85e50 | Add download path argument to download_path_exists function. Won't work otherwise | src/teiler.py | src/teiler.py | import argparse
import os
import sys
import utils
from PyQt4.QtCore import *
from PyQt4.QtGui import *
import qt4reactor
qt_app = QApplication(sys.argv)
qt4reactor.install()
from twisted.python import log
from twisted.internet import reactor
import filetransfer
from filetransfer import FileReceiverFactory
from peer... | Python | 0.000003 | @@ -2902,16 +2902,28 @@
.exists(
+downloadPath
) == Fal
|
24936881b7db48bab52f2a6129ce31c5136529ee | Remove unused imports from test/test_conn.py | test/test_conn.py | test/test_conn.py | import os
import random
import socket
import struct
import mock
import unittest2
from kafka.common import *
from kafka.conn import *
class ConnTest(unittest2.TestCase):
def setUp(self):
self.config = {
'host': 'localhost',
'port': 9090,
'request_id': 0,
'pa... | Python | 0.000001 | @@ -1,28 +1,4 @@
-import os%0Aimport random%0A
impo
|
34615bd199838c546a88336a96523a09878117d5 | Add link to krad home page | test/test_krad.py | test/test_krad.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
'''
Script for testing KRad module library
Latest version can be found at https://github.com/neocl/jamdict
References:
Python documentation:
https://docs.python.org/
Python unittest
https://docs.python.org/3/library/unittest.html
-... | Python | 0 | @@ -177,271 +177,212 @@
-Python documentation:%0D%0A https://docs.python.org/%0D%0A Python unittest%0D%0A https://docs.python.org/3/library/unittest.html%0D%0A --%0D%0A argparse module:%0D%0A https://docs.python.org/3/howto/argparse.html%0D%0A PEP 257 - Python Docstring C
+ RADKFI... |
f9004902b0edcfef6cbea0cca3c7ed680ad4f873 | Make icon path more portable for image test | test/test_mini.py | test/test_mini.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Test most basic GNTP functions using our mini growl function
"""
import unittest
import logging
logging.basicConfig(level=logging.WARNING)
import gntp.config
import gntp.notifier
APPLICATION_NAME = "GNTP unittest"
ICON_URL = "https://www.google.com/intl/en_com/images... | Python | 0.000001 | @@ -141,16 +141,26 @@
logging%0A
+import os%0A
logging.
@@ -357,14 +357,49 @@
E =
-%22test/
+os.path.join(os.path.dirname(__file__), %22
grow
@@ -409,16 +409,17 @@
con.png%22
+)
%0ACALLBAC
|
b363d3ebcd9724209462efc847e8ad67cc59dd49 | Update for new method name. | test/test_soap.py | test/test_soap.py | import unittest
import utils
import os
import sys
import re
import modeller
import subprocess
from modeller import soap_protein_od
from modeller.terms import energy_term
TOPDIR = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
utils.set_search_paths(TOPDIR)
import cryptosite.soap
# Mock the soap_protei... | Python | 0 | @@ -1993,20 +1993,26 @@
te.soap.
-main
+soap_score
()%0A
|
fce8e150b3842449fe25a34eb6afc0b9d871c4fa | Fix Django Debug toolbar | src/nyc_trees/nyc_trees/settings/development.py | src/nyc_trees/nyc_trees/settings/development.py | """Development settings and globals."""
from base import * # NOQA
# DEBUG CONFIGURATION
# See: https://docs.djangoproject.com/en/dev/ref/settings/#debug
DEBUG = True
# See: https://docs.djangoproject.com/en/dev/ref/settings/#template-debug
TEMPLATE_DEBUG = DEBUG
# END DEBUG CONFIGURATION
# EMAIL CONFIGURATION
# ... | Python | 0.000044 | @@ -941,16 +941,29 @@
_IPS = (
+'127.0.0.1',
'10.0.2.
|
9591c65e247e810371aad7f0535e90e8ddd1b722 | Implement additional options for SchemaDatabase URL query | lglass/database/schema.py | lglass/database/schema.py | # coding: utf-8
import urllib.parse
import lglass.rpsl
import lglass.database.base
@lglass.database.base.register("schema")
class SchemaDatabase(lglass.database.base.Database):
""" The inverse databases resolves inverse relationships on find() and also
validates the schema of objects. """
schema_validation_field... | Python | 0.000001 | @@ -3392,16 +3392,350 @@
ld%22%5D%5B-1%5D
+%0A%09%09%09if %22hidden-attr-field%22 in query:%0A%09%09%09%09self.hidden_attr_field = query%5B%22hidden-attr-field%22%5D%5B-1%5D%0A%09%09%09if %22hide-attributes%22 in query:%0A%09%09%09%09self.hide_attributes = True if query%5B%22hide-attributes%22%5D%5B-1%5D == %22true%22... |
a5917c4add6da256aa76a1ed3a049aceb3caad57 | Implement types-include and types-exclude for SchemaDatabase URLs | lglass/database/schema.py | lglass/database/schema.py | # coding: utf-8
import lglass.rpsl
import lglass.database.base
@lglass.database.base.register("schema")
class SchemaDatabase(lglass.database.base.Database):
""" The inverse databases resolves inverse relationships on find() and also
validates the schema of objects. """
schema_validation_field = "x-schema-valid"
... | Python | 0 | @@ -10,16 +10,37 @@
utf-8%0A%0A
+import urllib.parse%0A%0A
import l
@@ -2925,33 +2925,372 @@
ls,
-self):%0A%09%09return cls(None)
+url):%0A%09%09self = cls(None)%0A%0A%09%09if url.query:%0A%09%09%09query = urllib.parse.parse_qs(url.query)%0A%09%09%09if %22types-include%22 in query:%0A%09%09%09%09types = query%5B%2... |
e6bfb9d9783f7aedc0f1819e1ced0306984e0e0a | Improve normalization method | ml_helpers.py | ml_helpers.py | import numpy as np
import re
def extract_train():
return extract('dataset/train.txt')
def extract_test():
return extract('dataset/test.txt')
def extract(file):
input_file = open(file)
traindata = input_file.readlines()
features = []
targets = []
for line in traindata:
formatted_l... | Python | 0.000055 | @@ -328,23 +328,17 @@
ine.
-replace(%22%5Cn%22, %22
+strip(%22%5Cn
%22)%0A
@@ -589,132 +589,46 @@
at)%0A
-%0A
-max_features = matrix_features.max(axis = 0)%0A max_features = (max_features + (max_features == 0))%0A%0A normal_matrix
+normal_matrix_features = normalize
_fea
@@ -632,19 +632,17 @@
features... |
d2de145bf1000b638867e4972769ab76e9910f1a | Fix plot for k-means. Resolves #54 | mla/kmeans.py | mla/kmeans.py | import random
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
from mla.base import BaseEstimator
from mla.metrics.distance import euclidean_distance
random.seed(1111)
class KMeans(BaseEstimator):
"""Partition a dataset into K clusters.
Finds clusters by repeatedly assigning each d... | Python | 0.000003 | @@ -4709,16 +4709,70 @@
white%22)%0A
+ palette = sns.color_palette(%22hls%22, self.K + 1)
%0A
@@ -4977,46 +4977,21 @@
, c=
-sns.color_palette(%22hls%22, self.K + 1)%5Bi
+%5Bpalette%5Bi%5D,
%5D)%0A%0A
|
9fae5b50815b0ea597ee6d13181f96284d07d1ab | Simplify import_optionset | rdmo/options/imports.py | rdmo/options/imports.py | import logging
from rdmo.conditions.models import Condition
from rdmo.core.imports import (fetch_parents, get_foreign_field,
get_m2m_instances, set_common_fields,
set_lang_field, validate_instance)
from .models import Option, OptionSet
logger = logging.ge... | Python | 0.000085 | @@ -664,85 +664,12 @@
key'
-, '')%0A if optionset.provider_key is None:%0A optionset.provider_key =
+) or
''%0A
|
e360b4e2a19a526e1541a7833648619bb5fac8e2 | Fix read of wrong dictionnary | stock_orderpoint_move_link/models/procurement_rule.py | stock_orderpoint_move_link/models/procurement_rule.py | # Copyright 2017 Eficent Business and IT Consulting Services, S.L.
# License LGPL-3.0 or later (https://www.gnu.org/licenses/lgpl.html).
from odoo import models
class ProcurementRule(models.Model):
_inherit = 'procurement.rule'
def _get_stock_move_values(self, product_id, product_qty, product_uom,
... | Python | 0.000123 | @@ -800,24 +800,26 @@
for o in val
+ue
s%5B'orderpoin
|
9d284a64e3ece19ae3d52ea419a537a8b6f9c1ab | add missing quotation | mpld3/urls.py | mpld3/urls.py | import os
from . import __path__
import warnings
#warnings.warn("using temporary MPLD3_URL: switch to ghpages ASAP!")
__all__ = ["D3_URL", "MPLD3_URL", "D3_LOCAL", "MPLD3_LOCAL"]
D3_URL = "http://d3js.org/d3.v3.min.js"
MPLD3_URL = "http://mpld3.github.io/js/mpld3.v0.1.js
D3_LOCAL = os.path.join(__path__[0], "js", "... | Python | 0 | @@ -267,16 +267,17 @@
.v0.1.js
+%22
%0A%0AD3_LOC
|
509fb695072cc9a2e602ab80d44e615aecd7b1b0 | Fix a bug that broke Python 2.5 support. | cleaver/backend/db/model.py | cleaver/backend/db/model.py | import sqlalchemy as sa
from sqlalchemy.orm import relationship
from sqlalchemy.ext.declarative import declarative_base
ModelBase = declarative_base()
class Experiment(ModelBase):
__tablename__ = 'cleaver_experiment'
name = sa.Column(sa.UnicodeText, primary_key=True)
started_on = sa.Column(sa.DateTime, ... | Python | 0 | @@ -1378,16 +1378,25 @@
.Column(
+%0A
sa.Enum(
@@ -1403,16 +1403,20 @@
*TYPES,
+**%7B'
native_e
@@ -1422,16 +1422,27 @@
enum
-=
+':
False
+%7D
),
+%0A
pri
@@ -1450,24 +1450,29 @@
ary_key=True
+%0A
)%0A%0A exper
|
a53497a8fa41b400dd6cb3ff412cfd2f7444923b | add ',' at the end of 'reps' in installed apps in the settings file | memopol2/settings.py | memopol2/settings.py | # Django settings for memopol2 project.
import os
PROJECT_PATH = os.path.abspath(os.path.split(__file__)[0])
DEBUG = True
TEMPLATE_DEBUG = DEBUG
ADMINS = (
('Admin Istrator', 'admin@nowhere.net'),
)
MANAGERS = ADMINS
DATABASE_ENGINE = 'sqlite3' # 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3... | Python | 0.000001 | @@ -3556,16 +3556,17 @@
'reps'
+,
%0A)%0A%0AINTE
|
9bf53665a241d9e61e78dffb0524b49e11b79cfc | Change deprecation output to a logger message | regenmaschine/client.py | regenmaschine/client.py | """Define a client to interact with a RainMachine unit."""
import asyncio
from datetime import datetime
import logging
from typing import Dict
import async_timeout
from aiohttp import ClientSession
from aiohttp.client_exceptions import ClientError
from regenmaschine.controller import Controller, LocalController, Remo... | Python | 0.000009 | @@ -5453,13 +5453,23 @@
-print
+_LOGGER.warning
(%22re
|
ece87040e75bc5add21d2904444ef8e5edb6761e | Use ranged comparison | test_functools.py | test_functools.py | import itertools
import time
import copy
import sys
import pytest
from jaraco.functools import Throttler, method_cache
class TestThrottler(object):
def test_function_throttled(self):
"""
Ensure the throttler actually throttles calls.
"""
# set up a function to be called
counter = itertools.count()
# se... | Python | 0.000002 | @@ -1455,29 +1455,33 @@
e:%0A%09
-@pytest.mark.skipif('
+bad_vers = '(3, 5, 0) %3C=
sys.
@@ -1497,18 +1497,17 @@
nfo
-==
+%3C
(3, 5,
0)',
@@ -1506,15 +1506,43 @@
5,
-0
+1
)'
-,
%0A%09
-%09
+@pytest.mark.skipif(bad_vers,
reas
|
b8ae2f25b9e66ef032ef0e560674dba1a0b34d51 | Support for resource sets with no memory | mesos/cli/cmds/ps.py | mesos/cli/cmds/ps.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 u... | Python | 0 | @@ -1344,16 +1344,39 @@
4 * 1.0%0A
+ if max_mem %3E 0%0A
retu
@@ -1420,16 +1420,31 @@
* 100)%0A
+ return %220%22%0A
%0A%0A@cli.i
|
5b0d2eaf4379e22ea339cfb344d4ed5097c54ffe | update to f-strings | src/python/lib/ensembl/compara/db/unittestdb.py | src/python/lib/ensembl/compara/db/unittestdb.py | """
Copyright [1999-2015] Wellcome Trust Sanger Institute and the EMBL-European Bioinformatics Institute
Copyright [2016-2020] EMBL-European Bioinformatics Institute
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... | Python | 0 | @@ -2698,16 +2698,17 @@
te(text(
+f
%22CREATE
@@ -2717,27 +2717,16 @@
TABASE %7B
-%7D;%22.format(
db_url.d
@@ -2732,17 +2732,19 @@
database
-)
+%7D;%22
))%0A
@@ -3712,16 +3712,17 @@
te(text(
+f
%22DROP DA
@@ -3733,19 +3733,8 @@
SE %7B
-%7D;%22.format(
self
@@ -3745,17 +3745,19 @@
.db_name
-)
+%7D;%22
... |
ab2c6980ff1aa3945da2271b6637421db22cae96 | Add python ninja_syntax.py support for pool | misc/ninja_syntax.py | misc/ninja_syntax.py | #!/usr/bin/python
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import textwrap
import re
def escape_path(word):
return word.replace('$ ','$$ ').replace(' ','$... | Python | 0.000001 | @@ -911,16 +911,135 @@
ndent)%0A%0A
+ def pool(self, name, depth):%0A self._line('pool %25s' %25 name)%0A self.variable('depth', depth, indent=1)%0A%0A
def
@@ -1125,16 +1125,27 @@
r=False,
+ pool=None,
restat=
@@ -1164,16 +1164,29 @@
le=None,
+%0A
rspfile
@@ -1522,32 +1522,99 @... |
679305757e68861885f1e5c819625d2f0bca6c0b | add include and subninja | misc/ninja_syntax.py | misc/ninja_syntax.py | #!/usr/bin/python
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import textwrap
class Writer(object):
def __init__(self, output, width=78):
self.output... | Python | 0.000001 | @@ -1697,16 +1697,158 @@
utputs%0A%0A
+ def include(self, path):%0A self._line('include %25s' %25 path)%0A%0A def subninja(self, path):%0A self._line('subninja %25s' %25 path)%0A%0A
def
|
c189822975052ebfe5065c90bbf5676813e46093 | Fix for LiveServerTestCase failures - moved db.drop_all to setUp as the context set up by LiveServerTestCase doesn't go out of scope till AFTER the test is run. (it was hanging as the context still had an open session, deadlocking the db.drop_all() call). | tests/__init__.py | tests/__init__.py | """ Unit tests for package
to run:
nosetests
options:
nosetests --help
"""
from datetime import datetime
from flask_testing import TestCase as Base
from flask_webtest import SessionScope
from sqlalchemy.exc import IntegrityError
from portal.app import create_app
from portal.config import TestConfig
from por... | Python | 0 | @@ -5648,24 +5648,78 @@
esting.%22%22%22%0A%0A
+ db.drop_all() # clean up from previous tests%0A
db.c
@@ -6290,81 +6290,216 @@
sion
- and
+.%0A%0A Database
drop
-
+_
all
-tables.%22%22%22%0A%0A db.session.remove()%0A db.drop_all
+is done at setup due to app context challenge... |
f549d13773eb6c45791af7b734be098b2f90a71e | Remove mention of old test_compare.py | tests/__init__.py | tests/__init__.py | from .test_compare import *
from .test_list import *
from .test_simple import *
| Python | 0.000024 | @@ -1,32 +1,4 @@
-from .test_compare import *%0A
from
|
1eb36fc6ebcaff451a2000def2ff81d8e6c3917c | Add _safe_url method in HTMLRenderer | mistune/renderers.py | mistune/renderers.py | from .scanner import escape, escape_html
class BaseRenderer(object):
NAME = 'base'
IS_TREE = False
def __init__(self):
self._methods = {}
def register(self, name, method):
self._methods[name] = method
def _get_method(self, name):
try:
return object.__getattri... | Python | 0.000003 | @@ -2801,158 +2801,29 @@
def
-text(self, text):%0A return escape_html(text)%0A%0A def link(self, link, text=None, title=None):%0A if text is None:%0A text = link%0A
+_safe_url(self, url):
%0A
@@ -3189,20 +3189,19 @@
if
-link
+url
.startsw
@@ -3228,21 +3228,19 @@
-link... |
376fb5860c573416ac71a0dfe5437011858398b6 | Update __init__.py | tests/__init__.py | tests/__init__.py | """Unit tests init."""
import json
import os
import time
import unittest
try:
from selenium import webdriver
from selenium.common.exceptions import WebDriverException
except ImportError as imp_err:
raise ImportError('Failed to import \'selenium\':\n' + imp_err)
from network_crawler.api.operator_web_site ... | Python | 0.000072 | @@ -264,16 +264,20 @@
' +
+str(
imp_err)
%0A%0Afr
@@ -272,16 +272,17 @@
imp_err)
+)
%0A%0Afrom n
|
5c77d1203e7f6f985cb7a470324dafba648bbdcd | remove imports | tests/__init__.py | tests/__init__.py | import unittest
from test_auth_views import TestAuthViews
from test_email import TestEmail
from test_api import TestApi
from test_utils_s3 import TestUtilsS3
from test_db_models import TestDatabase
from test_countries import TestCountries
from test_tasks import TestTasks
if __name__ == '__main__':
unittest.main(... | Python | 0.000005 | @@ -1,12 +1,14 @@
+#
import unitt
@@ -11,18 +11,22 @@
nittest%0A
-%0A%0A
+#%0A#%0A#
from tes
@@ -59,16 +59,18 @@
thViews%0A
+#
from tes
@@ -94,16 +94,18 @@
stEmail%0A
+#
from tes
@@ -125,16 +125,18 @@
TestApi%0A
+#
from tes
@@ -165,16 +165,18 @@
UtilsS3%0A
+#
from tes
@@ -207,16 +207,18 @@
atabase%0A
... |
ac746d0afcd0a3a3267ee701dc868d584e3f5d94 | Remove unused imports | tests/__init__.py | tests/__init__.py | import unittest
import os
import re
class BaseTestCase(unittest.TestCase):
def setUp(self):
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "tests.testapp.testapp.settings")
from django.test.client import Client
from tests.testapp.testapp.wsgi import application
import rhetoric
... | Python | 0.000001 | @@ -23,18 +23,8 @@
os%0A
-import re%0A
%0A%0Acl
|
4c2fe580aa549f64722ca15d37c1065f62fd885f | implement the view | mudu/views.py | mudu/views.py | from django.shortcuts import render
# Create your views here.
| Python | 0.000021 | @@ -2,62 +2,720 @@
rom
-django.shortcuts import render%0A%0A# Create your views here.%0A
+rest_framework import status%0Afrom rest_framework.decorators import api_view%0Afrom rest_framework.response import Response%0Afrom .models import About, Contact%0Afrom .serializers import AboutSerializer, ContactSerializer%0A%0... |
7b290d41b00ddfa3f241784efceda1831134bac3 | Fix the validations_log_basedir overriding | tripleoclient/v1/tripleo_validator.py | tripleoclient/v1/tripleo_validator.py | # Copyright 2019 Red Hat, 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 ... | Python | 0.997884 | @@ -2247,41 +2247,20 @@
-parser.set_defaults(%0A
+default = %7B'
vali
@@ -2261,33 +2261,32 @@
%7B'validation
-s
_log_dir
=constants.V
@@ -2265,33 +2265,35 @@
lidation_log_dir
-=
+':
constants.VALIDA
@@ -2301,32 +2301,71 @@
IONS_LOG_BASEDIR
+%7D%0A parser.set_defaults(**default
)%0A ... |
58c59697039b48ef48f14cd9eb62205c2db91972 | Add test boilerplatte | tests/conftest.py | tests/conftest.py | Python | 0 | @@ -0,0 +1,15 @@
+import pytest%0A%0A
| |
0a3487325ea7044464603aa1c126374acf8a4239 | Allow for specifying the number of images to use when calculating dispersion scores | mmfeat/space/base.py | mmfeat/space/base.py | '''
Vector space model bases
'''
import os
import cPickle as pickle
import numpy as np
from scipy.stats import spearmanr
from .sim import cosine
class Space(object):
def __init__(self, descrs):
self.reportMissing = True
if isinstance(descrs, str):
self.space = pickle.load(open(desc... | Python | 0 | @@ -3530,24 +3530,39 @@
rescale=True
+, n_images=None
):%0A s
@@ -4303,21 +4303,19 @@
im
-gdisp = disp(
+age_reps =
self
@@ -4333,17 +4333,145 @@
values()
-)
+%0A if n_images is not None:%0A image_reps = image_reps%5B:n_images%5D%0A%0A imgdisp = disp(image_reps)%0A
%... |
64afd914e58f0abe52030d6ee4279fb0757b1ab6 | Use `prawtest_` prefix for environment test settings. | tests/conftest.py | tests/conftest.py | """Prepare py.test."""
import os
import time
from base64 import b64encode
import betamax
from betamax_serializers import pretty_json
# Prevent calls to sleep
def _sleep(*args):
raise Exception('Call to sleep')
time.sleep = _sleep
def b64_string(input_string):
"""Return a base64 encoded string (not bytes) f... | Python | 0 | @@ -517,16 +517,20 @@
et('praw
+test
_%7B%7D'.for
@@ -538,16 +538,42 @@
at(key),
+%0A
'placeh
|
e65749ef0be0a37c80bff39328e14035af9ab383 | Fix live environment set up in conftest | tests/conftest.py | tests/conftest.py | import os
import uuid
import pytest
from selenium import webdriver
from tests.utils import (
generate_unique_email
)
from tests.pages.rollups import sign_in
from config import Config
class Profile(object):
def __init__(self, **kwargs):
for key, val in kwargs.items():
setattr(self, key... | Python | 0.000001 | @@ -3129,39 +3129,36 @@
n_template_id':
-Staging
+Live
Config.REGISTRAT
@@ -3218,39 +3218,36 @@
n_template_id':
-Staging
+Live
Config.INVITATIO
|
7b5611c642e16afdfcaceebfa5bbe6d2c3330f3f | Fix MacOS tests (#6119) | tests/conftest.py | tests/conftest.py | # type: ignore
import asyncio
import os
import socket
import ssl
import sys
from hashlib import md5, sha256
from pathlib import Path
from tempfile import TemporaryDirectory
from typing import Any, List
from unittest import mock
from uuid import uuid4
import pytest
from aiohttp.test_utils import loop_context
IS_LINUX... | Python | 0.000001 | @@ -376,16 +376,111 @@
rustme%0A%0A
+ # Check if the CA is available in runtime, MacOS on Py3.10 fails somehow%0A trustme.CA()%0A%0A
TRUS
|
2ad088102d5022027bcbd507ed784b3cc2d9fab6 | bump version to 0.9.4 | mockthink/version.py | mockthink/version.py | VERSION = '0.9.3'
| Python | 0 | @@ -12,7 +12,7 @@
0.9.
-3
+4
'%0A
|
02388fe1a6b19c8fd8dff602b0e7bbfdc9855b99 | Fix conftest | tests/conftest.py | tests/conftest.py | # coding: utf-8
from __future__ import unicode_literals
import re
import os
import sys
import json
import mock
import pytest
import httpretty as httpretty_module
from vcr import VCR
from rakuten_ws import RakutenWebService
VCR_CASSETTE_DIR = os.path.join(os.path.dirname(__file__), 'cassettes')
VCR_RECORD_MODE = os... | Python | 0 | @@ -1039,37 +1039,175 @@
-if response%5B%22body%22%5D%5B%22string%22%5D
+# Used mainly for RakutenPayOrder.getOrder%0A if (response%5B%22body%22%5D%5B%22string%22%5D and%0A %22application/json; charset=utf-8%22 in response%5B%22headers%22%5D%5B%22Content-Type%22%5D)
:%0A
|
a7ca9945a7010dac8f44c4c74659ce82e4fb20ff | Fix old unused imports | modder/gui/frames.py | modder/gui/frames.py | # coding: utf-8
import wx
from wx.lib.floatcanvas import FloatCanvas as FC
from modder import MOD_REGISTRY
from .base_frames import ManagerFrame
from modder.gui.graph.models import Block, ConnectorLine, CanvasMixin
from modder.gui.graph.test import DrawFrame
class ModManagerFrame(wx.Frame, CanvasMixin):
def __i... | Python | 0.000017 | @@ -105,46 +105,8 @@
TRY%0A
-from .base_frames import ManagerFrame%0A
from
@@ -175,52 +175,8 @@
xin%0A
-from modder.gui.graph.test import DrawFrame%0A
%0A%0Acl
|
1ebe7f612af3c71063a4c3035732319602ffb66c | Build browse cache backwards to reduce work needed | mopidy/local/json.py | mopidy/local/json.py | from __future__ import absolute_import, unicode_literals
import collections
import gzip
import json
import logging
import os
import re
import sys
import tempfile
import time
import mopidy
from mopidy import local, models
from mopidy.local import search, translator
logger = logging.getLogger(__name__)
# TODO: move ... | Python | 0 | @@ -1366,56 +1366,106 @@
#
-%7Bparent_uri: %7Buri: ref%7D%7D%0A self._cache = %7B
+TODO: local.ROOT_DIRECTORY_URI%0A self._cache = %7B'local:directory': collections.OrderedDict()
%7D%0A%0A
@@ -1758,149 +1758,227 @@
-parent = 'local:directory'%0A for i in range(len(parts)):%0A ... |
ce92d99fd87e5935de954af75ae39481d04711ea | Change morse simulation environment to demo_wildfire | morse_sim/default.py | morse_sim/default.py | #! /usr/bin/env morseexec
""" Basic MORSE simulation scene for <morse_sim> environment
Feel free to edit this template as you like!
"""
import os
import os.path
import numpy as np
os.chdir(os.path.dirname(__file__))
from morse.builder import *
from morse_sim.builder.actuators.absolute_teleport import AbsoluteTel... | Python | 0.000001 | @@ -2593,16 +2593,17 @@
', '
-terrain_
+demo_wild
fire
|
a3392a89b71e262783caaf4acdddbb2577103cee | Improve list displays in admin interface. | mqtt_logger/admin.py | mqtt_logger/admin.py | from django.contrib import admin
from models import *
class MessageAdmin(admin.ModelAdmin):
readonly_fields = ['subscription', 'time_recorded', 'topic', 'payload']
admin.site.register(MQTTMessage, MessageAdmin)
admin.site.register(MQTTSubscription)
| Python | 0 | @@ -113,9 +113,9 @@
s =
-%5B
+(
'sub
@@ -165,56 +165,499 @@
oad'
-%5D%0A%0Aadmin.site.register(MQTTMessage, MessageAdmin
+)%0A date_hierarchy = 'time_recorded'%0A list_display = ('time_recorded', 'subscription', 'topic', 'payload')%0A list_display_links = ('payload',)%0A list_filter = ('subscription', '... |
8b939af8909d424b2a6b73194b257724ecc8c349 | add more tests | coconuts/tests/test_exif.py | coconuts/tests/test_exif.py | # -*- coding: utf-8 -*-
#
# django-coconuts
# Copyright (c) 2008-2013, Jeremy Lainé
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above ... | Python | 0 | @@ -1498,16 +1498,22 @@
ass Exif
+OldPil
Test(Bas
@@ -1573,23 +1573,253 @@
est_
-old_p
+canon(self):%0A %22%22%22%0A IMG_8232.JPG%0A %22%22%22%0A # fnumber%0A self.assertEqual(format_rational((4, 1)), '4')%0A%0A # exposure time%0A self.assertEqual(format_rational((1, ... |
7d1dabd9a7120e0a24c54aa9c1f7ab9c13683dfa | Remove unused Keyword lexeme | viper/lexer/lexemes.py | viper/lexer/lexemes.py | INDENT_SIZE = 4
class Lexeme:
def __init__(self, text, repl_with_text=True):
self.text = text
self._repl_with_text = repl_with_text
def __repr__(self):
if self._repl_with_text:
return f'{type(self).__name__}({self.text})'
else:
return type(self).__name_... | Python | 0 | @@ -1452,42 +1452,8 @@
s%0A%0A%0A
-class Keyword(Lexeme):%0A pass%0A%0A%0A
clas
|
35aa5f3928a6d1b60e2412f0d075f7dfc4738b04 | Bump version because I can! | volaupload/_version.py | volaupload/_version.py | """
Version information for volaupload
"""
__version__ = "0.9.3"
| Python | 0 | @@ -60,7 +60,7 @@
0.9.
-3
+4
%22%0A
|
37305ca839f3b1c384cff92a2e77a76e068dbdda | Remove python_2_unicode_compatible shim (#122) | wagtailmedia/models.py | wagtailmedia/models.py | from __future__ import unicode_literals
import mimetypes
import os.path
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.core.validators import MinValueValidator
from django.db import models
from django.dispatch import Signal
from django.urls import reverse
from dja... | Python | 0.000001 | @@ -745,313 +745,8 @@
e%0A%0A%0A
-# Python 2.x compability apis are removed from Django 3%0A# https://docs.djangoproject.com/en/3.0/releases/3.0/#removed-private-python-2-compatibility-apis%0Atry:%0A from django.utils.encoding import python_2_unicode_compatible%0Aexcept ImportError:%0A%0A def python_2_unicode_co... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.