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 |
|---|---|---|---|---|---|---|---|
363979820d537b940d334296e9b5a9b23c05a24e | fix unicode error | multimedia/models.py | multimedia/models.py | #encoding: utf-8
from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from sorl.thumbnail import ImageField
from sitioreddes.utils import get_file_path
from taggit.managers import TaggableManager
from django.contrib.auth.models import U... | Python | 0.000367 | @@ -2074,32 +2074,41 @@
self):%0A%09%09return
+u'%25s' %25 (
self.nombre%0A%09cla
@@ -2094,32 +2094,34 @@
' %25 (self.nombre
+)%0A
%0A%09class Meta:%0A%09%09
|
5aa65dca88661220645df2ce598b83b04fce94d3 | Add some fields for display | kboard/accounts/admin.py | kboard/accounts/admin.py | from django import forms
from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin as BaseUserAdmin
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from .models import Account
class UserCreationForm(forms.ModelForm):
password1 = ... | Python | 0 | @@ -1524,16 +1524,32 @@
s_admin'
+, 'is_superuser'
)%0A li
@@ -1753,16 +1753,44 @@
_admin',
+ 'is_superuser', 'is_active'
)%7D),%0A
|
8eecd929c636c8e07027543e59e1b0657a571453 | Change uncontroled file name | install.py | install.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import sys
import subprocess
import shlex
import glob
try:
import argparse
except ImportError:
sys.exit("Please install or run Python 2.7 or later")
HOME = os.path.expanduser("~") # User Home Directory
DOTFILES = os.path.join(HOME, ".dotconfig/dotfiles... | Python | 0.000001 | @@ -514,18 +514,16 @@
, %22.
-travis.yml
+circleci
%22, %22
|
01c50698e1640edb4417c71ec7a58ad034d5fda4 | Rename invalid model exception | kraken/lib/exceptions.py | kraken/lib/exceptions.py | # -*- coding: utf-8 -*-
"""
kraken.lib.exceptions
~~~~~~~~~~~~~~~~~~~~~
All custom exceptions raised by kraken's modules and packages. Packages should
always define their exceptions here.
"""
class KrakenRecordException(Exception):
def __init__(self, message=None):
Exception.__init__(self, message)
| Python | 0.000005 | @@ -309,8 +309,136 @@
ssage)%0A%0A
+class KrakenInvalidModelException(Exception):%0A%0A def __init__(self, message=None):%0A Exception.__init__(self, message)%0A%0A
|
9113ea5813dabd746c2344e076bc3827aa2ec117 | Add restore functions to numpy.dual | numpy/dual.py | numpy/dual.py | # This module should be used for functions both in numpy and scipy if
# you want to use the numpy version if available but the scipy version
# otherwise.
# Usage --- from numpy.dual import fft, inv
__all__ = ['fft','ifft','fftn','ifftn','fft2','ifft2',
'inv','svd','solve','det','eig','eigvals','lstsq',
... | Python | 0.000002 | @@ -1102,97 +1102,216 @@
-sys._getframe(0).f_globals%5Bname%5D = _restore_dict%5Bname%5D%0A except KeyError:%0A pass%0A
+val = _restore_dict%5Bname%5D%0A except KeyError:%0A return%0A else:%0A sys._getframe(0).f_globals%5Bname%5D = val%0A%0Adef restore_all():%0A for name in _resto... |
ab823cb476c4b2244ab360e0ac9e95f26f06b972 | Bring back a needed import, and exclude it from flake checks | okupy/wsgi.py | okupy/wsgi.py | # vim:fileencoding=utf8:et:ts=4:sts=4:sw=4:ft=python
"""
WSGI config for okupy project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands disc... | Python | 0 | @@ -1852,16 +1852,54 @@
andlers%0A
+ import okupy.accounts.ssh # noqa%0A
from
|
0797e7a015fa32310be80223d499788298d9935d | Remove debugging code | openmesher.py | openmesher.py | #!/usr/bin/env python
import datetime, glob, os, shutil, subprocess, tempfile, logging, sys, argparse, random
import ipaddr, probstat, IPy, paramiko, yapsy
from distutils.sysconfig import get_python_lib
from OpenMesher.interfaces import *
from OpenMesher.lib import *
from OpenMesher.linkmesh import create_link_mesh
... | Python | 0.000739 | @@ -4727,66 +4727,8 @@
_%22:%0A
- l = logging.getLogger()%0A l.setLevel(logging.DEBUG)%0A
|
6fc1e3a51dbabe096478e78ceb6c3aaff95ead32 | test commit for website | trunk/pyfarm/client/master.py | trunk/pyfarm/client/master.py | # No shebang line, this module is meant to be imported
#
# This file is part of PyFarm.
# Copyright (C) 2008-2012 Oliver Palmer
#
# PyFarm 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 ... | Python | 0 | @@ -854,17 +854,16 @@
prefs%0A%0A
-#
PORT = p
@@ -872,16 +872,36 @@
fs.get('
+network.ports.client
')%0A%0Adef
@@ -981,40 +981,8 @@
-print options%0A# end getmaster%0A%0A#
# en
@@ -1035,14 +1035,21 @@
ing
-used%0A#
+provided%0A
if o
@@ -1106,25 +1106,28 @@
s not None:%0A
-#
+
raise Va
@@ -... |
9ca655edd5b03fadcb72fd976df6d77f9af8d277 | change quickstart | examples/python/quick_start/app.py | examples/python/quick_start/app.py | from e2c import E2c
config = (
'.run -- action',
'action.out -- print',
'action.out -- print')
def print_data(x: int, data):
print(x, data)
e2c = E2c[str, str](config)
e2c.actor('action', lambda data, out: out(data, {'a': 1}))
e2c.actor('print', print_data)
e2c.visualize()
e2c.run('hello')
| Python | 0.000001 | @@ -76,88 +76,9 @@
int'
-,%0A 'action.out -- print')%0A%0Adef print_data(x: int, data):%0A print(x, data)%0A%0A
+)
%0A%0Ae2
@@ -153,18 +153,8 @@
data
-, %7B'a': 1%7D
))%0Ae
@@ -174,20 +174,34 @@
nt',
+ lambda data:
print
-_
+(
data)
+)
%0A%0Ae2
|
2328b0ce0cddc7e56b1ed9b9bb1b3158b108f6ae | Add the debug_log file to setup_logging | turbo_hipster/worker_server.py | turbo_hipster/worker_server.py | #!/usr/bin/python2
#
# Copyright 2013 Rackspace Australia
#
# 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 ... | Python | 0.000244 | @@ -1329,16 +1329,30 @@
logging(
+self.debug_log
)%0A%0A
|
deba1c0bb985fe62000b4474744df9ee1170a8a1 | Use numpy testing | turbustat/tests/test_delvar.py | turbustat/tests/test_delvar.py | # Licensed under an MIT open source license - see LICENSE
'''
Test functions for Delta Variance
'''
from unittest import TestCase
import numpy as np
import numpy.testing as npt
from ..statistics import DeltaVariance, DeltaVariance_Distance
from ._testing_data import \
dataset1, dataset2, computed_data, compute... | Python | 0.000001 | @@ -735,18 +735,19 @@
+npt.
assert
- np.
+_
allc
@@ -1352,10 +1352,53 @@
stance'%5D
+,%0A decimal=3
)%0A
|
bb533bf6ff7261102e65dd3fafc2350e001969b9 | Remove comment | noter/views.py | noter/views.py | from flask import url_for, redirect, render_template, abort, \
flash, session
from noter import app, db
from models import Entry
from forms import loginForm, entryForm
from markdown2 import Markdown
@app.route('/')
def show_entries():
form = entryForm()
entries = entries_render(Entry.query.order_by(Entry.i... | Python | 0 | @@ -1429,36 +1429,8 @@
t()%0A
- #return show_entries();%0A
@@ -2877,16 +2877,17 @@
return entries
+%0A
|
0220369d89b2c0384f350fdd169eece6368783e9 | update commit message | unicoremc/managers/settings.py | unicoremc/managers/settings.py | import os
from django.template.loader import render_to_string
from django.conf import settings
from elasticgit import EG
from unicoremc.tasks import push_to_git
class SettingsManager(object):
def __init__(self):
self.frontend_settings_dir = 'frontend_settings/'
self.cms_settings_dir = 'cms_sett... | Python | 0 | @@ -4359,32 +4359,27 @@
'Save
-frontend
+cms
settings co
@@ -4965,32 +4965,18 @@
'Save
-frontend setting
+cm
s config
|
c7b43fea98303dd6eacb11dafa16a2ddfd7738e8 | update DeferringTextTestRunner of python 2 | unittesting/core/st2/runner.py | unittesting/core/st2/runner.py | import time
import sublime
from unittest import TextTestRunner
class DeferringTextTestRunner(TextTestRunner):
def run(self, test):
"Run the given test case or test suite."
self.finished = False
result = self._makeResult()
startTime = time.time()
deferred = test(result)
... | Python | 0 | @@ -281,38 +281,1290 @@
e()%0A
- deferred = test(result
+%0A def _start_testing():%0A deferred = test(result)%0A sublime.set_timeout(lambda: _continue_testing(deferred), 10)%0A%0A def _continue_testing(deferred):%0A try:%0A condition = next(deferred)... |
b1b3788a51305671cd65c0555b6ab665c7afe9ea | use matlab help as temporary docstring | utide/constituent_selection.py | utide/constituent_selection.py | from __future__ import absolute_import, division
import numpy as np
import scipy.io as sio
from .astronomy import ut_astron
from . import ut_constants
def ut_cnstitsel(tref, minres, incnstit, infer):
shallow = ut_constants.shallow
const = ut_constants.const
cnstit = {}
coef = {}
astro, ader =... | Python | 0.000001 | @@ -196,16 +196,1081 @@
infer):
+%0A %22%22%22%0A %25 UT_CNSTITSEL()%0A %25 carry out constituent selection%0A %25 inputs%0A %25 tref = reference time (datenum UTC)%0A %25 minres = freq separation (cph) used in decision tree%0A %25 incnstit = 'cnstit' input to ut_solv%0A %25 infer = 'o... |
57084fd911c5cef48da11d64b71763d8f922c038 | Check final memory usage, not peak memory usage, in Repeat_Load test | util/test/tests/Repeat_Load.py | util/test/tests/Repeat_Load.py | import rdtest
import os
import renderdoc as rd
class Repeat_Load(rdtest.TestCase):
slow_test = True
def repeat_load(self, path):
memory_peak = memory_baseline = 0
for i in range(20):
rdtest.log.print("Loading for iteration {}".format(i))
try:
controll... | Python | 0 | @@ -144,28 +144,29 @@
memory_
-peak
+usage
= memory_ba
@@ -269,16 +269,18 @@
format(i
++1
))%0A%0A
@@ -829,65 +829,8 @@
sage
-%0A memory_peak = max(memory_peak, memory_usage)
%0A%0A
@@ -1145,16 +1145,18 @@
format(i
++1
, memory
@@ -1219,20 +1219,21 @@
(memory_
-peak
+usage
/ memor
@@ -... |
cee28a8e2598fbd7705811aed04fde24f57f9b13 | Fix path in config test | cea/tests/test_config.py | cea/tests/test_config.py | """Test the cea.config.Configuration()"""
import unittest
import pickle
import os
import tempfile
import cea.config
class TestConfiguration(unittest.TestCase):
def test_can_be_pickled(self):
config = cea.config.Configuration()
config = pickle.loads(pickle.dumps(config))
self.assertIsNo... | Python | 0.000006 | @@ -2458,16 +2458,35 @@
ormcase(
+os.path.expanduser(
config.c
@@ -2513,26 +2513,71 @@
one)
-, os.path.normcase
+),%0A os.path.normcase(os.path.expanduser
(exp
@@ -2590,16 +2590,18 @@
output))
+)%0A
%0A%0Aif __n
|
77f410d03d4d182fd7210626ba804767768e3583 | Update C_Salinity_Vertical_sections.py | Cas_1/Salinity/C_Salinity_Vertical_sections.py | Cas_1/Salinity/C_Salinity_Vertical_sections.py | import numpy as np
import matplotlib.pyplot as plt
from xmitgcm import open_mdsdataset
plt.ion()
dir1 = '/homedata/bderembl/runmit/test_southatlgyre'
ds1 = open_mdsdataset(dir1,iters='all',prefix=['S'])
Height = ds1.S.Z
print(Height)
nx = len(ds1.S.XC)/2
print(nx)
ny = len(ds1.S.YC)/2
print(ny)
nt = -1 #... | Python | 0 | @@ -411,10 +411,10 @@
t,:,
+2
1
-0
0,:%5D
@@ -592,10 +592,10 @@
:,:,
-28
+56
0%5D.p
|
2f76a3ef654a56f1f881c266da96f4fa72703d3d | fix extending command regardless of platform | ceph_medic/util/hosts.py | ceph_medic/util/hosts.py | import json
from ceph_medic import config, terminal
from remoto import connection, process
def _platform_options(platform):
namespace = config.file.get_safe(platform, 'namespace', 'rook-ceph')
context = config.file.get_safe(platform, 'context', None)
return {'namespace': namespace, 'context': context}
d... | Python | 0 | @@ -119,16 +119,29 @@
tform):%0A
+ try:%0A
name
@@ -205,16 +205,20 @@
-ceph')%0A
+
cont
@@ -271,16 +271,96 @@
, None)%0A
+ except RuntimeError:%0A namespace = 'rook-ceph'%0A context = None%0A
retu
@@ -1018,20 +1018,16 @@
table%5D%0A%0A
-
cmd.
@@ -1104,16 +1104,16 ... |
12d367b37e5e401ef597a32b5e804c26c157f74a | Fix mis-named variable. | chaco/array_plot_data.py | chaco/array_plot_data.py | """ Defines ArrayPlotData.
"""
from numpy import array, ndarray
# Enthought library imports
from traits.api import Dict
# Local, relative imports
from .abstract_plot_data import AbstractPlotData
from .abstract_data_source import AbstractDataSource
class ArrayPlotData(AbstractPlotData):
""" A PlotData implement... | Python | 0.000024 | @@ -6558,19 +6558,15 @@
.update(
-new_
data)%0A%0A
|
aec916340572792f506204a9d24fb294cc844c36 | Fix format of config.show | chainer/configuration.py | chainer/configuration.py | from __future__ import print_function
import contextlib
import sys
import threading
class GlobalConfig(object):
"""The plain object that represents the global configuration of Chainer."""
def show(self, file=sys.stdout):
"""show(file=sys.stdout)
Prints the global config entries.
Th... | Python | 0.000017 | @@ -2260,17 +2260,19 @@
int(u'%7B%7D
-
+:%5Ct
%7B%7D%7B%7D'.fo
|
e90211ac7a17118a085ab2cfdf621569ee7eab5a | Fix import path | charmfixtures/testing.py | charmfixtures/testing.py | from testtools import (
TestCase,
try_import,
)
from charmfixtures.filesystem import Filesystem
from charmfixtures.users import Users
from charmfixtures.groups import Groups
from charmfixtures.hooktools.fixture import HookTools
hookenv = try_import("from charmhelpers.core.hookenv")
class CharmTest(TestCase)... | Python | 0.000012 | @@ -253,21 +253,16 @@
import(%22
-from
charmhel
|
c9603cb4942ddafe521869498b1add2dcd1d386f | Update clashcallerbot_search.py made database and reddit instance global | clashcallerbot_search.py | clashcallerbot_search.py | #! python3
# -*- coding: utf-8 -*-
"""Searches recent reddit comments for ClashCaller! string and saves to database.
This module uses the Python Reddit API Wrapper (PRAW) to search recent reddit comments
for the ClashCaller! string. If found, the username, comment time, message, and
expiration time (if any) are parsed... | Python | 0 | @@ -769,25 +769,8 @@
')%0A%0A
-%0Adef main():%0A
# Re
@@ -790,20 +790,16 @@
ni file%0A
-
config =
@@ -827,20 +827,16 @@
arser()%0A
-
config.r
@@ -856,20 +856,16 @@
.ini')%0A%0A
-
DB_USER
@@ -892,20 +892,16 @@
'user')%0A
-
DB_PASS
@@ -932,20 +932,16 @@
sword')%0A
-
DB_NAME
@@ -973,... |
cdd2e19aff6fcd86496c35bf39ac1f42d3139c31 | Fix test volume of interest to match data extents | Imaging/Core/Testing/Python/resampledTexture.py | Imaging/Core/Testing/Python/resampledTexture.py | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Demonstrate automatic resampling of textures (i.e., OpenGL only handles
# power of two texture maps. This examples exercise's vtk's automatic
# power of two resampling).
#
# get the... | Python | 0.000239 | @@ -756,17 +756,17 @@
0,63,0,9
-3
+2
)%0Aatext
|
29019f3f4cc5ca0ff814d806f250b3578f49e888 | identify no valid subschema instances | version_metadata/io_adaptor.py | version_metadata/io_adaptor.py | from .utils import json2, cmn
import os
import json
def load_schema(f):
base = os.path.dirname(os.path.abspath(__file__))
cwd = os.getcwd()
expectedpath = 'file:../schemas/json/'
newpath = 'file:{0}/../schemas/json/'.format(base)
schema_json = cmn.fread(f, encoding = 'utf-8')
schema_json_fixed = schema_json.re... | Python | 0.999993 | @@ -459,62 +459,302 @@
:%0A%09%09
-if isinstance(e, list):%0A%09%09%09return e%0A%09%09else:%0A%09%09%09return
+def clean_no_match_error(x):%0A%09%09%09if x.endswith(%22is not valid under any of the given schemas%22):%0A%09%09%09%09return %22no valid experiment/sample subtype identified:%22 + x%0A%09%09%09else:%0A%09... |
a9a89e0c825511a72e7e14faf06301e6ff674e18 | fix #3: bufhist: vim hangs if there are unnamed buffers | vial/plugins/bufhist/plugin.py | vial/plugins/bufhist/plugin.py | from time import time
from itertools import groupby
from vial import vfunc, vim, dref
from vial.utils import echon, redraw
from os.path import split
MAX_HISTORY_SIZE = 100
VHIST = 'vial_buf_hist'
VLAST = 'vial_last_buf'
def add_to_history(w, bufnr):
history = list(w.vars[VHIST])
history[:] = [r for r in his... | Python | 0.000001 | @@ -1700,16 +1700,65 @@
(r.name)
+ if r.name else %5B'', '%5Bbuf-%7B%7D%5D'.format(r.number)%5D
%0A
@@ -2307,24 +2307,37 @@
mns')) - 1%0A%0A
+ try:%0A
idx = hi
@@ -2351,24 +2351,63 @@
ndex(bufnr)%0A
+ except ValueError:%0A return%0A%0A
idx += d
|
7240c24933e712fe98c8cb06670e66f470205e4c | Add start and end options as well as days back for harvesting | share/management/commands/harvest.py | share/management/commands/harvest.py | import datetime
from django.apps import apps
from django.core.management.base import BaseCommand
from django.conf import settings
from share.models import ShareUser
from share.tasks import HarvesterTask
from share.provider import ProviderAppConfig
class Command(BaseCommand):
def add_arguments(self, parser):
... | Python | 0 | @@ -1,12 +1,25 @@
+import arrow%0A
import datet
@@ -608,16 +608,17 @@
elery')%0A
+%0A
@@ -701,154 +701,579 @@
back
-')%0A%0A def handle(self, *args, **options):%0A user = ShareUser.objects.get(username=settings.APPLICATION_USERNAME)%0A%0A task_kwargs = %7B%7D
+, defaults to 1')%0A p... |
00ad8303d7b1dcdba9eebfd95ea4ef49662023a2 | Remove test_tvnamer from runtest [#85] | tests/runtests.py | tests/runtests.py | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:unlicense (http://unlicense.org/)
import sys
import unittest
import test_tvdb_api
import test_tvnamer
def main():
suite = unittest.TestSuite([
unittest.TestLoader().loadTestsFromMod... | Python | 0 | @@ -204,28 +204,8 @@
_api
-%0Aimport test_tvnamer
%0A%0Ade
@@ -251,73 +251,8 @@
e(%5B%0A
- unittest.TestLoader().loadTestsFromModule(test_tvnamer),%0A
|
8f1420f8e5e7fb35ab0440dbd86c778dc38440ee | Fix location of merged (#3749) | .github/actions/trello_release/action.py | .github/actions/trello_release/action.py | # (C) Datadog, Inc. 2018
# All rights reserved
# Licensed under a 3-clause BSD style license (see LICENSE)
import os
import json
from datadog import initialize, api
import requests
(
EVENT_PATH_ENV_VAR,
TRELLO_LIST_ID,
TRELLO_KEY_ENV_VAR,
TRELLO_TOKEN_ENV_VAR,
DD_API_KEY_ENV_VAR
) = ENV_VARS = (
... | Python | 0 | @@ -2891,16 +2891,40 @@
nt.get('
+pull_request', %7B%7D).get('
merged')
|
51a82d1351b8638a4e4806b800900df62a2b0d63 | Revert PR #52. Didn't work yet | netbox/connection.py | netbox/connection.py | import requests
import json
import urllib.parse
from netbox import exceptions
class NetboxConnection(object):
def __init__(self, ssl_verify=False, use_ssl=True, host=None, auth_token=None, auth=None,
port=None, api_prefix=None, extra_headers=None):
self.use_ssl = use_ssl
self.hos... | Python | 0 | @@ -3600,109 +3600,8 @@
-if resp_data.get('results', None):%0A return resp_data%5B'results'%5D%0A else:%0A
retu
@@ -3604,32 +3604,43 @@
return resp_data
+%5B'results'%5D
%0A%0A def put(se
|
c9da0810109479f32c746eaec8e8520448ea9ad1 | Bump version | webtopay/__init__.py | webtopay/__init__.py | __version__ = (1, 0, 0)
| Python | 0 | @@ -14,11 +14,11 @@
(1, 0,
-0
+1
)%0A
|
f64fdc112024e9e44b4f94bcaed2a9ae98c7b436 | fix color layer position | cocos/layer/util_layers.py | cocos/layer/util_layers.py | # ----------------------------------------------------------------------------
# cocos2d
# Copyright (c) 2008 Daniel Moisset, Ricardo Quesada, Rayentray Tappa, Lucio Torre
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the follow... | Python | 0.000001 | @@ -3426,21 +3426,12 @@
y =
-self.position
+0, 0
%0A
|
385938c0014c0dffcb8524ef99b374e15af99a34 | handle local imports more effectively; add initial stub XML classification document test | tests/testMain.py | tests/testMain.py | import os
import sys
import unittest
import numpy
import arcpy
# import our local directory so we can use the internal modules
local_path = os.path.dirname(__file__)
scripts_path = os.path.join(local_path, '..', 'Install/toolbox')
abs_path = os.path.abspath(scripts_path)
sys.path.insert(0, abs_path)
from ... | Python | 0 | @@ -8,20 +8,8 @@
os%0D%0A
-import sys%0D%0A
impo
@@ -55,378 +55,325 @@
%0D%0A%0D%0A
-# import our local directory so we can use the internal modules%0D%0Alocal_path = os.path.dirname(__file__)%0D%0Ascripts_path = os.path.join(local_path, '..', 'Install/toolbox')%0D%0Aabs_path = os.path.abspath(scripts_path)%0D%0Asys... |
83bf1a8b682c1c6595bfe82749aac1b1077dc07b | fix style | whitelists/stdlib.py | whitelists/stdlib.py | """
Vulture sometimes reports used code as unused. To avoid these
false-positives, you can write a Python file that explicitly uses the
code and pass it to vulture:
vulture myscript.py mydir mywhitelist.py
This file explicitly uses code from the Python standard library that is
often incorrectly detected as unused.
... | Python | 0.000001 | @@ -487,16 +487,17 @@
pass%0A%0A
+%0A
whitelis
|
620f8598ecac59ea58cba20f9fc3ed50b1989dc0 | Save four frames in each screen | tests/test_ale.py | tests/test_ale.py | import unittest
import random
import tempfile
import sys
from PIL import Image
import numpy as np
import ale
class TestALE(unittest.TestCase):
def setUp(self):
pass
def test_state(self):
env = ale.ALE('breakout.bin')
self.assertEquals(env.state.shape, (4, 84, 84))
self.asse... | Python | 0.000001 | @@ -1431,32 +1431,72 @@
nv.is_terminal:%0A
+ for i in xrange(4):%0A
@@ -1518,12 +1518,15 @@
ate%5B
--1%5D%0A
+i%5D%0A
@@ -1563,24 +1563,28 @@
+
screen += 12
@@ -1593,32 +1593,36 @@
+
+
self.assertEqual
@@ -1640,32 +1640,36 @@
2... |
4554b75c39148209550033bf3dd116ab7d3d3782 | Add tests to check environment (solutions dir, engine uri) | tests/test_api.py | tests/test_api.py | import os
import glob
import time
import json
import base64
import requests
import unittest
class TestApi(unittest.TestCase):
solutions_dir = "/home/ada/lovelace/lovelace-solutions/"
python_solutions_dir = os.path.join(solutions_dir, "python")
javascript_solutions_dir = os.path.join(solutions_dir, "javasc... | Python | 0 | @@ -87,16 +87,204 @@
ttest%0A%0A%0A
+def test_environment_solutions_dir():%0A assert os.path.isdir(SOLUTIONS_DIR) is True%0A%0A%0Adef test_environment_engine_uri():%0A resp = requests.get(ENGINE_URI)%0A assert resp.ok is True%0A%0A%0A
class Te
|
57cf8ebc46dc2ed0f219d97d8946ed450ad5f38b | Fix calling real archive on macOS | tests/test_cli.py | tests/test_cli.py | import pytest
from banneret.main import cli
class TestOSSupport:
@pytest.mark.usefixtures('win32')
def test_windows_is_not_supported(self, log, runner):
result = runner.invoke(cli, ['archive'])
assert result.exit_code == 1
assert 'Wrong os: win32' in log.text
@pytest.mark.usefix... | Python | 0.000001 | @@ -147,32 +147,54 @@
elf, log, runner
+, mock_archive_project
):%0A resul
@@ -302,32 +302,81 @@
n32' in log.text
+%0A mock_archive_project.assert_not_called()
%0A%0A @pytest.ma
@@ -444,32 +444,54 @@
elf, log, runner
+, mock_archive_project
):%0A resul
@@ -607,16 +607,65 @@
log.text
+%0A ... |
8fe19b02e565da38cd965174e21b80b229cae0a4 | test added. module must has version | tests/test_cli.py | tests/test_cli.py | from __future__ import print_function
import unittest
import pyaspeller
class TestCLI(unittest.TestCase):
def setUp(self):
print("setUp")
pyaspeller.main()
def tearDown(self):
print("tearDown")
def test_simple(self):
self.assertTrue(2 * 2 == 4, "simple")
def test_s... | Python | 0.000003 | @@ -223,16 +223,192 @@
arDown%22)
+%0A %0A def test_pyaspeller_has_version(self):%0A self.assertTrue(hasattr(pyaspeller, '__version__'), %0A %22Module pyaspeller must have version%22)
%0A%0A de
|
10828b94f4cdf44822ee7377af4798d8794f6a6d | Make tests support python 2 | tests/test_pdf.py | tests/test_pdf.py | """Tests for the PDF class."""
import io
import pkg_resources
import unittest
import pdftotext
file_names = [
"abcde.pdf",
"blank.pdf",
"corrupt_page.pdf",
"corrupt.pdf",
"two_page.pdf",
]
test_files = {}
for file_name in file_names:
file_path = pkg_resources.resource_filename("tests", file_... | Python | 0.00122 | @@ -1086,16 +1086,17 @@
tringIO(
+u
%22wrong%22)
@@ -1119,32 +1119,50 @@
lf.assertRaises(
+(pdftotext.Error,
TypeError):%0A
@@ -1147,32 +1147,33 @@
rror, TypeError)
+)
:%0A pd
|
ed3dff759655102e14464e56c37c693ef38c8c22 | Remove set_trace | tests/test_pjm.py | tests/test_pjm.py | from pyiso import client_factory
from unittest import TestCase
import pandas as pd
from datetime import datetime, timedelta
import pytz
class TestPJM(TestCase):
def setUp(self):
self.edata_inst_load = """
<h1>Instantaneous Load</h1>
<p>As of <span id="ctl00_ContentPlaceHolder1_DateAndTime... | Python | 0.000003 | @@ -4776,48 +4776,6 @@
5M')
-%0A import pytest; pytest.set_trace()
%0A%0A
|
e1f44158c88bfaba7156d26f2ebe1e5dd46d1197 | use pipes.quote on py2 | tests/test_run.py | tests/test_run.py | import os
import mock
import filecmp
import subprocess
from dvc.main import main
from dvc.utils import file_md5
from dvc.stage import Stage, StageFileBadNameError, MissingDep
from dvc.stage import StageBadCwdError
from dvc.command.run import CmdRun
from dvc.exceptions import (OutputDuplicationError,
... | Python | 0.000001 | @@ -6142,31 +6142,138 @@
-from shlex import shlex
+try: # py3%0A from shlex import quote%0A except ImportError: # py2%0A from pipes import quote
%0A%0A
|
cdd387859e3a2d836f794202943a7f18ca63ab92 | Use codecs.open in test.parse_file | tests/test_srt.py | tests/test_srt.py | #!/usr/bin/env python
# vim: set fileencoding=utf8
import codecs
import tempfile
import srt
import os
from datetime import timedelta
from nose.tools import eq_ as eq, assert_not_equal as neq
class TestTinysrt(object):
@staticmethod
def _fixture(path):
return os.path.join(os.path.dirname(__file__), pa... | Python | 0.000003 | @@ -3087,16 +3087,23 @@
srt_f =
+codecs.
open(sel
|
44cb01a4ed7f1fcae4cd76c367a479b389e59418 | Update test_toy.py | tests/test_toy.py | tests/test_toy.py | import numpy as np
import matplotlib
matplotlib.use('Agg', warn=False)
from probfit.nputil import mid
from probfit.pdf import crystalball, gaussian
from probfit.functor import Normalized
from probfit.toy import gen_toy
from probfit._libstat import compute_chi2
from probfit.nputil import vector_apply
from probfit.costfu... | Python | 0.000007 | @@ -140,16 +140,35 @@
gaussian
+, doublecrystalball
%0Afrom pr
@@ -990,16 +990,695 @@
%3C 1.1)%0A
+ %0Adef test_gen_toy3():%0A np.random.seed(0)%0A bound = (-1, 2)%0A ntoy = 100000%0A toy = gen_toy(doublecrystalball, ntoy, bound=bound,%0A alpha=1., alpha2=1., n=2.,n2=2., mean=1., sig... |
03b2aff24014d8860e308486d7fc0256d3e903f3 | change item status | paas_manager/app/app.py | paas_manager/app/app.py | from flask import Flask, render_template, request
from werkzeug import secure_filename
app = Flask(__name__)
class Item:
def __init__(item, name, filename, status):
item.name = name
item.filename = filename
item.status = status
items = []
@app.route("/")
def view_index():
return render_te... | Python | 0.000001 | @@ -617,16 +617,15 @@
e, '
-uploaded
+waiting
') )
|
4412be416907f9480fa638a8961ac107a6398ae2 | Fix lint error | sub_notify.py | sub_notify.py | """
SubNotify.
Copyright (c) 2013 - 2016 Isaac Muse <isaacmuse@gmail.com>
License: MIT
"""
from os.path import join, dirname
import sublime
import sublime_plugin
from SubNotify.lib import notify
PLUGIN_SETTINGS = "sub_notify.sublime-settings"
SUB_NOTIFY_READY = False
######################
# Settings
##############... | Python | 0.000035 | @@ -89,41 +89,17 @@
%22%22%22%0A
-from os.path import join, dirname
+import os
%0Aimp
@@ -2747,16 +2747,24 @@
phics =
+os.path.
join(sub
@@ -2886,32 +2886,40 @@
Text%22,%0A
+os.path.
join(graphics, %22
@@ -2947,16 +2947,24 @@
+os.path.
join(gra
|
f1b86dff8cef8802f5493bad4331d23e016dca7c | Update textcat example | examples/training/train_textcat.py | examples/training/train_textcat.py | '''Train a multi-label convolutional neural network text classifier,
using the spacy.pipeline.TextCategorizer component. The model is then added
to spacy.pipeline, and predictions are available at `doc.cats`.
'''
from __future__ import unicode_literals
import plac
import random
import tqdm
from thinc.neural.optimizers... | Python | 0 | @@ -537,16 +537,196 @@
orizer%0A%0A
+# TODO: Remove this once we're not supporting models trained with thinc %3C6.9.0%0Aimport thinc.neural._classes.layernorm%0Athinc.neural._classes.layernorm.set_compat_six_eight(False)%0A%0A%0A
%0Adef tra
@@ -1178,16 +1178,21 @@
_data =
+list(
zip(trai
@@ -1210,16 +1210,17 @@
i... |
789ac1de1e94eda1224fb314ccad14c061c58ad4 | Create empty PactGroup if no arguments given | pact/group.py | pact/group.py | from .base import PactBase
from .utils import GroupWaitPredicate
class PactGroup(PactBase):
def __init__(self, pacts):
self._pacts = list(pacts)
super(PactGroup, self).__init__()
def __iadd__(self, other):
self._pacts.append(other)
return self
def _is_finished(self):
... | Python | 0.000002 | @@ -116,16 +116,21 @@
f, pacts
+=None
):%0A
@@ -145,16 +145,41 @@
_pacts =
+ %5B%5D if pacts is None else
list(pa
|
6c06ff9fab0f1ef9ef6ec0d1df01c01bd4edb38b | Add redirect to requested page upon entering sudo mode. | sudo/views.py | sudo/views.py | """
sudo.views
~~~~~~~~~~
:copyright: (c) 2014 by Matt Robenolt.
:license: BSD, see LICENSE for more details.
"""
try:
from urllib.parse import urlparse, urlunparse
except ImportError: # pragma: no cover
# Python 2 fallback
from urlparse import urlparse, urlunparse # noqa
from django.contrib.auth.decora... | Python | 0 | @@ -2741,16 +2741,17 @@
CT_URL)%0A
+%0A
# Ma
@@ -2982,24 +2982,110 @@
direct_to)%0A%0A
+ if request.method == 'GET':%0A request.session%5B'redirect_to'%5D = redirect_to%0A%0A
form = S
@@ -3185,24 +3185,24 @@
is_valid():%0A
-
@@ -3232,16 +3232,90 @@
equest)%0A
+ redirect_... |
bef33330e56ab6743ad22036049353261686d53f | Implement visitor for beta reduction | nameless/visitors.py | nameless/visitors.py | #!/usr/bin/python
# -*- coding: UTF-8 -*-
"""
visitors.py
@author ejnp
"""
import ast
import itertools
import lambda_calculus_ast
class FreeVariables(ast.NodeVisitor):
"""Visits each node of a lambda calculus abstract syntax tree and
determines which variables (if any) are unbound. Ultimately provides a se... | Python | 0 | @@ -99,22 +99,21 @@
ertools%0A
-import
+%0Afrom
lambda_
@@ -124,16 +124,58 @@
ulus_ast
+ import Variable, Application, Abstraction
%0A%0A%0Aclass
@@ -4199,28 +4199,1636 @@
self.visit(node.body))%0A
+%0A%0Aclass BetaReduction(ast.NodeVisitor):%0A %22%22%22Embodies the act of applying a function to a parame... |
198d399f0339b1a1b856721cabb3f4c66c203b92 | fix bug | wechatclient/clinet.py | wechatclient/clinet.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals, print_function
import os
import json
import tornado
import tornado.web
import tornado.ioloop
from tornado import gen
from tornado.gen import coroutine
from wechatpy import WeChatClient
from wechatpy.parser import parse_message
import json... | Python | 0.000001 | @@ -1422,33 +1422,32 @@
sg)%0A
-_
reply = create_r
|
f860eeee62f0c89789e5f2fd212bd6b9fcaa19d0 | Move the logic to extract a username from the session key into a separate method to ease subclassing | lazysignup/middleware.py | lazysignup/middleware.py | from django.conf import settings
from django.contrib.auth import SESSION_KEY
from django.contrib.auth import authenticate
from django.contrib.auth import get_user
from django.contrib.auth import login
from django.contrib.auth.models import User
USERNAME_LENGTH = 30
ALLOW_LAZY_REGISTRY = {}
USER_AGENT_BLACKLIST = []
... | Python | 0 | @@ -2436,16 +2436,34 @@
rname =
+self.get_username(
request.
@@ -2485,26 +2485,9 @@
_key
-%5B:USERNAME_LENGTH%5D
+)
%0A%0A
@@ -2831,16 +2831,102 @@
user)%0A%0A
+ def get_username(self, session_key):%0A return session_key%5B:USERNAME_LENGTH%5D%0A
|
c1e1fc49a92b1c608293adad4810df1ff4f08f19 | fix import order | lbworkflow/tests/urls.py | lbworkflow/tests/urls.py | from django.conf.urls import url
from django.conf.urls import include
urlpatterns = [
url(r'^wf/', include('lbworkflow.urls')),
]
| Python | 0.000001 | @@ -22,19 +22,23 @@
import
-url
+include
%0Afrom dj
@@ -59,24 +59,19 @@
import
-include%0A
+url
%0A%0Aurlpat
|
927bd523d7f42d9fc151b2cf223107f93846a77b | remove utf8 annotations | logger/log.py | logger/log.py | # coding:utf-8
import os
import logging
import logging.config as log_conf
log_dir = os.path.dirname(os.path.dirname(__file__))+'/logs'
if not os.path.exists(log_dir):
os.mkdir(log_dir)
log_path = os.path.join(log_dir, 'weibo.log')
log_config = {
'version': 1.0,
'formatters': {
'detail': {
... | Python | 0.000096 | @@ -1,19 +1,4 @@
-# coding:utf-8%0A
impo
|
233e043b5542b04c4b9284428a776074e01d8bbe | Fix platform discovery from plugins. | nimp/sys/platform.py | nimp/sys/platform.py |
''' Platform-related configuration utilities '''
import abc
import logging
import platform
import pkg_resources
import nimp.base_platforms
from nimp.utils.python import get_class_instances
_all_platforms = {}
_all_aliases = {}
_all_ue4_platforms = {}
class Platform(metaclass=abc.ABCMeta):
''' Describe a pla... | Python | 0 | @@ -1857,16 +1857,63 @@
gins'):%0A
+ try:%0A module = e.load()%0A
@@ -1932,16 +1932,21 @@
stances(
+modul
e, Platf
@@ -1946,32 +1946,65 @@
, Platform, tmp)
+%0A except:%0A pass
%0A%0A for platfo
|
7b40cb4f7e1e01d8b0e63c7310867cd1b7daf48e | update version | slackminion/plugins/core/__init__.py | slackminion/plugins/core/__init__.py | version = '0.9.10'
| Python | 0 | @@ -9,11 +9,11 @@
= '0.9.1
-0
+1
'%0A
|
df3a1860ec4debc432ad214a0b88e6461cb30879 | Fix octohatrack.py | octohatrack.py | octohatrack.py | import octohat
octohat.main()
| Python | 0.000829 | @@ -11,16 +11,20 @@
ohat
+rack
%0Aoctohat
.mai
@@ -19,16 +19,20 @@
%0Aoctohat
+rack
.main()%0A
|
44ca16fca88acb6f9de5dbde41682ec0c407ed49 | print files as they get packed into the tar file | odi_cleanup.py | odi_cleanup.py | #!/usr/bin/env python
import os
import sys
import pwd
import shutil
import glob
import datetime
import tarfile
import odi_config as odi
from subprocess import call
def main():
try:
object_str, filters, instrument, images, illcor_flag, skyflat_src, wcs_flag, reproject_flag, scale_flag, stack_flag, gaia_flag... | Python | 0.000001 | @@ -1509,24 +1509,75 @@
l=True)%0A
+print 'Files contained in /ssd1/'+file_stem+%22.tar:%22
%0A # if th
@@ -1885,30 +1885,105 @@
-tar.add('config.yaml')
+print '- derived_props.txt'%0A tar.add('config.yaml')%0A print '- config.yaml'%0A
%0A
@@ -2072,16 +2072,47 @@
+'.fz')%0A
+ ... |
4ea4022822403db0476ca8c35a8db535dd81a68f | use real user object when populating msgs | temba/ivr/migrations/0006_auto_20150203_0558.py | temba/ivr/migrations/0006_auto_20150203_0558.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from temba.msgs.models import Msg, HANDLED, IVR
from temba.orgs.models import Org
from temba.flows.models import FlowStep, ActionSet, SayAction
from django.conf import settings
class Migration(migrations.Migratio... | Python | 0.000001 | @@ -988,16 +988,68 @@
editor):
+%0A from django.contrib.auth.models import User
%0A%0A
@@ -1491,90 +1491,8 @@
ue:%0A
- print %22%5B%25s%5D %25s%22 %25 (ivr.call.contact_urn, step.rule_value)%0A
@@ -1708,16 +1708,91 @@
_value%0A%0A
+ user = User.object... |
d1ec190f1a4dc84db0540481f2489f1db8421799 | Enable specifying the password in `config.ini` | oemof_pg/db.py | oemof_pg/db.py | from sqlalchemy import create_engine
import keyring
from . import config as cfg
def connection():
engine = create_engine(
"postgresql+psycopg2://{user}:{passwd}@{host}:{port}/{db}".format(
user=cfg.get("postGIS", "username"),
passwd=keyring.get_password(
cfg.get("po... | Python | 0 | @@ -1,12 +1,88 @@
+from configparser import NoOptionError as option, NoSectionError as section%0A
from sqlalch
@@ -169,16 +169,529 @@
tion():%0A
+ pw = keyring.get_password(cfg.get(%22postGIS%22, %22database%22),%0A cfg.get(%22postGIS%22, %22username%22))%0A%0A if pw is None:%0A ... |
2c73c0ca2400109a5f9ce27c129d598518b2ce9e | Protect request access in case it's None | social/strategies/django_strategy.py | social/strategies/django_strategy.py | from django.conf import settings
from django.http import HttpResponseRedirect, HttpResponse
from django.db.models import Model
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth import authenticate
from django.template import TemplateDoesNotExist, RequestContext, loader
from social.str... | Python | 0.998998 | @@ -1086,24 +1086,75 @@
erge=True):%0A
+ if not self.request:%0A return %7B%7D%0A
if m
@@ -1379,16 +1379,45 @@
(self):%0A
+ if self.request:%0A
@@ -2297,32 +2297,61 @@
default=None):%0A
+ if self.request:%0A
return s
@@ -2422,32 +2422,61 @@
, name... |
6dc556d4c095137d4bd91e4411dc5168014014e7 | Fix typo | cronjobs/zjs_tag_zotaut.py | cronjobs/zjs_tag_zotaut.py | #!/bin/python3
# -*- coding: utf-8 -*-
import json
import urllib.request
import github_api_util
import github_ubtue_util
ZEDER_URL_IXTHEO = 'http://www-ub.ub.uni-tuebingen.de/zeder/cgi-bin/zeder.cgi?action=get&Dimension=wert&Instanz=ixtheo&Bearbeiter='
ZEDER_URL_KRIMDOK = 'http://www-ub.ub.uni-tuebingen.de/zeder/cgi-... | Python | 0.999999 | @@ -2556,10 +2556,10 @@
il.B
-Z
S
+Z
_LAB
|
2ae5c6cb0a82e15ee224b2772b9390c6caf764af | Remove unused code | nextactions/board.py | nextactions/board.py | from nextactions.list import List
class Board:
def __init__(self, trello, json):
self._trello = trello
self.id = json['id']
self.name = json['name']
# TODO remove me
self.nextActionList = []
def getLists(self):
json = self._trello.get(
'https://api... | Python | 0.000006 | @@ -176,66 +176,8 @@
me'%5D
-%0A # TODO remove me%0A self.nextActionList = %5B%5D
%0A%0A
|
45f82bbe65ccb08119f5a9d1e3f4333872f05856 | Add change name and change avatar commands. | curiosity/plugins/owner.py | curiosity/plugins/owner.py | import inspect
import traceback
import curio
import sys
from curio.traps import _get_kernel
from curious import commands
from curious.commands.context import Context
from curious.commands.plugin import Plugin
def is_owner(self, ctx: Context):
return ctx.author.id == 141545699442425856 or ctx.message.author.id =... | Python | 0 | @@ -85,16 +85,66 @@
t_kernel
+%0Afrom curious.http.curio_http import ClientSession
%0A%0Afrom c
@@ -1143,16 +1143,804 @@
mtted)%0A%0A
+ @commands.command(name=%22name%22)%0A async def _change_name(self, ctx: Context, *, new_name: str):%0A %22%22%22%0A Changes the name of the bot.%0A %22%22... |
d66c95a6441d9c872819916d80b70f15580580eb | create a command line interface | nommer_cli.py | nommer_cli.py | Python | 0.000001 | @@ -0,0 +1,854 @@
+import argparse%0Afrom nommer import *%0A%0Adef main():%0A parser = argparse.ArgumentParser()%0A parser.add_argument(%22words%22, help=%22list of words separated by coma%22, type=str)%0A args = parser.parse_args()%0A if args.words:%0A names = process(args.words)%0A display(n... | |
9ac272fa07445d2e8c44dc31706939efbe9346fa | Use args and kwargs when instantiating the extension, as configs key is no longer supported. | mdx_urlize.py | mdx_urlize.py | """A more liberal autolinker
Inspired by Django's urlize function.
Positive examples:
>>> import markdown
>>> md = markdown.Markdown(extensions=['urlize'])
>>> md.convert('http://example.com/')
u'<p><a href="http://example.com/">http://example.com/</a></p>'
>>> md.convert('go to http://example.com')
u'<p>go to <a ... | Python | 0 | @@ -2125,20 +2125,23 @@
ion(
-configs=None
+*args, **kwargs
):%0A
@@ -2170,21 +2170,21 @@
ion(
-configs=confi
+*args, **kwar
gs)%0A
|
84c57b882abfc300f0df1d307d386ebda9d3fc75 | Raise an exception if submission fails. | util/jenkins/stage_release.py | util/jenkins/stage_release.py | """
Take in a YAML file with the basic data of all the things we could
deploy and command line hashes for the repos that we want to deploy
right now.
Example Config YAML file:
---
DOC_STORE_CONFIG:
hosts: [ list, of, mongo, hosts]
port: #
db: 'db'
user: 'jenkins'
password: 'password'
configuration... | Python | 0 | @@ -5617,16 +5617,241 @@
rmat(r))
+%0A if r.status_code != 201:%0A # Something went wrong.%0A msg = %22Failed to submit request with params: %7B%7D%22%0A raise Exception(msg.format(pformat(build_params)))
%0A%0Aif __n
|
d50281dcaee29d9879ec88e517a723b5fafe6cdf | fix ics files for outlook 2003 | woodstock/views/ics.py | woodstock/views/ics.py | from django.http import HttpResponse
from django.shortcuts import get_object_or_404
from woodstock.models import EventPart
from woodstock.views.decorators import registration_required
from woodstock import settings
import icalendar
import datetime
import random
import hashlib
def _event_part_ics(event_parts):
ca... | Python | 0 | @@ -408,16 +408,49 @@
'2.0')%0A
+ cal.add('method', 'REQUEST')%0A
for
|
d2c419094c4a732acdeb305411d9a6fa9884f4c5 | Use labels for tracking | mail/views.py | mail/views.py | from django import http
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext as _
from django.contrib import messages
from django.conf import settings
from django.contrib.auth.decorators impo... | Python | 0 | @@ -2534,16 +2534,50 @@
l_body'%5D
+,%0A email%5B'tags'%5D.split(',')
%0A )%0A
|
42d24141761b0397e798da7a09c9a0837c9d9d76 | Revert "Utf8Validator acts on bytearrays or str/bytes" | ws4py/utf8validator.py | ws4py/utf8validator.py | # coding=utf-8
###############################################################################
##
## Copyright 2011 Tavendo GmbH
##
## Note:
##
## This code is a Python implementation of the algorithm
##
## "Flexible and Economical UTF-8 Decoder"
##
## by Bjoern Hoehrmann
##
## bjoer... | Python | 0 | @@ -4587,28 +4587,8 @@
DFA%5B
-b if type(b) is int
ord(
|
33dcaee26c1df5ce690eeb9c2104904bb49043a3 | create classifier for each request | task2/task.py | task2/task.py | from sklearn import tree
clf = tree.DecisionTreeClassifier()
def prepare_classifier(data):
target = []
_input = []
for a in data:
target.append(a['type'])
_input.append((a['noise-level'], a['brake-distance'], a['vibrations']))
clf.fit(_input, target)
def predict(data):
result = [... | Python | 1 | @@ -23,44 +23,8 @@
ee%0A%0A
-clf = tree.DecisionTreeClassifier()%0A
%0Adef
@@ -43,16 +43,21 @@
ssifier(
+clf,
data):%0A
@@ -261,16 +261,21 @@
predict(
+clf,
data):%0A
@@ -325,17 +325,17 @@
input =
-(
+%5B
(a%5B'nois
@@ -378,25 +378,25 @@
ibrations'%5D)
-)
+%5D
%0A cls
@@ -683,16 +683,56 @@
petion... |
0eb90c1f15def6a47d01607c27b9abdc70720594 | Add mdadm as dependency in mdadm state docs | salt/states/mdadm.py | salt/states/mdadm.py | # -*- coding: utf-8 -*-
'''
Managing software RAID with mdadm
==================================
A state module for creating or destroying software RAID devices.
.. code-block:: yaml
/dev/md0:
raid.present:
- level: 5
- devices:
- /dev/xvdd
- /dev/xvde
- /dev/x... | Python | 0.000001 | @@ -91,16 +91,36 @@
======%0A%0A
+:depends: mdadm%0A%0A
A state
|
b73e7fb61b08c3322ba0c6796d87ec79f5451a93 | Update exceptions.py | taxii_client/exceptions.py | taxii_client/exceptions.py |
class ClientException(Exception):
pass
class UnsuccessfulStatusError(ClientException):
def __init__(self, taxii_status, *args, **kwargs):
super(UnsuccessfulStatusError, self).__init__(status_to_message(taxii_status), *args, **kwargs)
self.status = taxii_status.status_type
self.text... | Python | 0 | @@ -576,18 +576,13 @@
-message
+l
=
+%5B
stat
@@ -595,16 +595,17 @@
tus_type
+%5D
%0A%0A if
@@ -635,37 +635,22 @@
-message += '; %25s;' %25
+l += %5B
dict_to_
@@ -676,16 +676,17 @@
_detail)
+%5D
%0A%0A if
@@ -723,29 +723,14 @@
-message += '; %25s;' %25
+l += %5B
dict
@@ -763,17 +... |
836002d3d0957ea74e6d456afb5bdfd282377875 | use correct template names | salt/utils/extend.py | salt/utils/extend.py | # -*- coding: utf-8 -*-
'''
SaltStack Extend
'''
from __future__ import absolute_import
from datetime import date
import tempfile
from shutil import copytree
try:
import logging
log = logging.getLogger(__name__)
from cookiecutter.main import cookiecutter as cookie
import cookiecutter.prompt as prompt
... | Python | 0.000005 | @@ -156,17 +156,8 @@
ee%0A%0A
-try:%0A
impo
@@ -167,20 +167,16 @@
logging%0A
-
log = lo
@@ -200,16 +200,22 @@
_name__)
+%0A%0Atry:
%0A fro
@@ -642,16 +642,98 @@
sing pip
+ or %22 %5C%0A %22from https://github.com/audreyr/cookiecutter
%22%0A %0A
@@ -960,16 +960,19 @@
O... |
3f9685420f55fbfb910744a1d5d9c6aa0f29b78e | Set version to 0.5.0 | saltcloud/version.py | saltcloud/version.py | __version_info__ = (0, 2)
__version__ = '.'.join(map(str, __version_info__))
| Python | 0 | @@ -20,9 +20,12 @@
(0,
-2
+5, 0
)%0A__
|
a7ffe098b305a6cf4804ca85cc9d3583fe10c192 | fix broken `getallvms.py` | samples/getallvms.py | samples/getallvms.py | #!/usr/bin/env python
# VMware vSphere Python SDK
# Copyright (c) 2008-2013 VMware, Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/lic... | Python | 0 | @@ -1213,17 +1213,30 @@
List = v
-m
+irtual_machine
.childEn
|
5e231c116ba8165e9d8c795b85ca2833238aed54 | Test that -blocksonly nodes do not send getdata(CMPCT) on a low bandwidth connection. | test/functional/p2p_compactblocks_blocksonly.py | test/functional/p2p_compactblocks_blocksonly.py | #!/usr/bin/env python3
# Copyright (c) 2021-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test that a node in blocksonly mode does not request compact blocks."""
from test_framework.messages i... | Python | 0 | @@ -3180,16 +3180,712 @@
True)%0A%0A
+ self.log.info(%22Test that -blocksonly nodes send getdata(BLOCK) instead%22%0A %22 of getdata(CMPCT) in BIP152 low bandwidth mode%22)%0A%0A block1 = self.build_block_on_tip()%0A%0A p2p_conn_blocksonly.send_message(msg_headers(headers=%5B... |
8c79843a7dbd02db8c7b57f24ef65eaa5213a90a | print progress | data/generate_prod_data.py | data/generate_prod_data.py | # -*- coding: utf-8 -*-
import os
import sys
import yaml
from psycopg2.extensions import AsIs
import geocoder as geocoder_lib
import entities
from datetime import datetime
import source_update
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '../data/db')))
from db import DatabaseConnection
#... | Python | 0.000002 | @@ -4569,32 +4569,91 @@
eid%0A
+if found%2520000==0:%0A print %22Progress:%22,found%0A
%0A if
|
a8bf085683b14e61ac1fe0f57592e551084fafef | Fix the active_timeout test to work without quic enabled (#7197) | tests/gold_tests/timeout/active_timeout.test.py | tests/gold_tests/timeout/active_timeout.test.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");... | Python | 0 | @@ -902,16 +902,101 @@
p2')%0A)%0A%0A
+if Condition.HasATSFeature('TS_USE_QUIC') and Condition.HasCurlFeature('http3'):%0A
ts = Tes
@@ -1072,16 +1072,93 @@
c=True)%0A
+else:%0A ts = Test.MakeATSProcess(%22ts%22, select_ports=True, enable_tls=True)%0A
server =
@@ -3024,16 +3024,17 @@
%0A tr4
+
= Test.A
|
7317592aadfcae192b0059e0e18fb67237e5bec0 | Remove textpad's content once sent. | termiloult.py | termiloult.py | import argparse
from asyncio import get_event_loop, gather, CancelledError
from collections import deque
from curses import (
wrapper, newwin, initscr, noecho, cbreak,
start_color, nocbreak, endwin, echo
)
from curses.textpad import Textbox, rectangle
from functools import wraps
import html
import j... | Python | 0 | @@ -3501,41 +3501,8 @@
()%0A%0A
- self.root_window.clear()%0A
@@ -4177,16 +4177,54 @@
end(msg)
+%0A self.input_window.clear()
%0A%0A @d
|
14ebf548b96413d5a3064412696867ba836db0da | Fix bug when generating again thankyou note | thankyou_letters/models/account_invoice_line.py | thankyou_letters/models/account_invoice_line.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2016 Compassion CH (http://www.compassion.ch)
# Releasing children from poverty in Jesus' name
# @author: Emanuel Cino <ecino@compassion.ch>
#
# The licence is in the file __openerp__.p... | Python | 0 | @@ -2702,16 +2702,33 @@
lines +=
+ (invoice_lines -
existin
@@ -2747,16 +2747,17 @@
bjects()
+)
%0A%0A
|
2a65ca70cb35983ce2b7d2f921e816780855731b | Test kifparse()/kifserialize() invariance. | test/lib/parser.py | test/lib/parser.py | """ The PyUnit test framework for the parser. """
import unittest
from lib import parser
class wParseTestCase(unittest.TestCase):
def test0Tokenize(self):
line = '10495555 18 n 05 pusher 1 drug_peddler 0 peddler 1 drug_dealer 0 drug_trafficker 0 004 @ 10721470 n 0000 @ 09977660 n 0000 + 02302817 v 0301 +... | Python | 0 | @@ -60,16 +60,89 @@
nittest%0A
+import subprocess%0A%0Afrom tempfile import mkdtemp%0Afrom shutil import rmtree
%0Afrom li
@@ -1355,16 +1355,603 @@
test')%0A%0A
+class kifParseSerilizeTest(unittest.TestCase):%0A def test0ParseSerilize(self):%0A tempd = mkdtemp()%0A out1 = %22/%22.join(%5Btempd, %22o... |
0cdd081b5343fefd3ab76a3abe508cec7c35ecea | Add support for ./ansible.cfg file | lib/ansible/constants.py | lib/ansible/constants.py | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any lat... | Python | 0 | @@ -1210,16 +1210,57 @@
path1 =
+ os.getcwd() + %22/ansible.cfg%22%0A path2 =
os.path
@@ -1271,25 +1271,16 @@
anduser(
-%0A
os.envir
@@ -1331,17 +1331,17 @@
path
-2
+3
= %22/etc
@@ -1358,24 +1358,25 @@
nsible.cfg%22%0A
+%0A
if os.pa
@@ -1447,16 +1447,16 @@
path2):%0A
-
@@ -1469,... |
d8113006657f15a8447e436bb213217f3bd41bd8 | make tests safe! | test/test_btyfi.py | test/test_btyfi.py | from __future__ import absolute_import
from btyfi import Radius, RadiusGit, RadiusHg
from difflib import unified_diff
import filecmp
import os
from os import remove
from shutil import copyfile, rmtree
from subprocess import check_output, CalledProcessError
from sys import version_info
if version_info < (2, 7):
fro... | Python | 0.000001 | @@ -836,24 +836,79 @@
**kwargs):%0A
+ self._in_test_directory = _in_test_directory()%0A
self
@@ -1028,66 +1028,224 @@
-return self.delete_and_create_repo()%0A%0A def setUp(self):
+if not self._in_test_directory:%0A return False%0A return self.delete_and_create_repo()%0A%0A ... |
0349412bc88447ce2d1c1e3aa0b91452c4df69be | Fix mouse test with latest PyEnsembl changes | test/test_mouse.py | test/test_mouse.py | from __future__ import absolute_import
from nose.tools import eq_
from varcode import load_vcf, load_vcf_fast, Variant, Substitution
from pyensembl import Genome, GenomeSource
from . import data_path
MOUSE_GTF_PATH = "ftp://ftp.ensembl.org/pub/release-81/gtf/mus_musculus/Mus_musculus.GRCm38.81.gtf.gz"
MOUSE_TRANSCRI... | Python | 0 | @@ -687,37 +687,24 @@
-GenomeSource(
gtf_path
=MOUSE_G
@@ -687,32 +687,39 @@
gtf_path
+_or_url
=MOUSE_GTF_PATH,
@@ -735,37 +735,24 @@
-
-
transcript_f
@@ -752,32 +752,39 @@
cript_fasta_path
+_or_url
=MOUSE_TRANSCRIP
@@ -813,37 +813,24 @@
-
- ... |
a5145fb8dcce99e2e8e470824c1ce603d1326f25 | add int and float to test colnames | test/test_utils.py | test/test_utils.py | """Unit tests for cartoframes.utils"""
import unittest
from cartoframes.utils import (dict_items, cssify, norm_colname,
normalize_colnames)
from collections import OrderedDict
class TestUtils(unittest.TestCase):
"""Tests for functions in utils module"""
def setUp(self):
... | Python | 0 | @@ -2796,16 +2796,22 @@
sting',
+1, 1.0
%5D%0A
@@ -2929,16 +2929,28 @@
sting',
+'_1', '_1_0'
%5D%0A%0A d
|
901a47adf6726d50c01ac743e9661c0caac2b555 | Check to ensure the excpetions return the text we expect. | test_openfolder.py | test_openfolder.py | import pytest
from mock import patch, MagicMock
from open_folder import *
def test_folder_exists():
with patch('subprocess.check_call', MagicMock(return_value="NOOP")):
result = open_folder(".")
assert result == None
def test_folder_does_not_exists():
with patch('subprocess.check_call', Magic... | Python | 0 | @@ -370,34 +370,45 @@
aises(Exception)
+ as excinfo
:%0A
-
open
@@ -468,16 +468,80 @@
150718%22)
+%0A assert str(excinfo.value) == ('Folder does not exist.')
%0A%0Adef te
@@ -626,32 +626,33 @@
value=%22NOOP%22)):%0A
+%0A
with pat
@@ -764,16 +764,27 @@
ception)
+ as excinfo
:%0A ... |
3d8107e5f9fb694165c367265f5e99b59d1ac527 | Update log level in preprocessor | lib/core_preprocessor.py | lib/core_preprocessor.py | """
Format the data so that atram can use it later in atram itself.
It takes sequence read archive (SRA) files and converts them into coordinated
blast and sqlite3 databases.
"""
from os.path import join, basename, splitext
import sys
import multiprocessing
import numpy as np
from Bio.SeqIO.QualityIO import FastqGene... | Python | 0.000001 | @@ -584,36 +584,37 @@
le'%5D, args%5B'log_
-fi
le
+vel
'%5D, args%5B'blast_
|
b3e187fdc35af31a22eed5b3917c9352420a092f | add renderer in loader_util (omitted from prev. commit) | data_loader/loader_util.py | data_loader/loader_util.py |
#
# Hubblemon - Yet another general purpose system monitor
#
# Copyright 2015 NAVER Corp.
#
# 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
#
# U... | Python | 0 | @@ -668,16 +668,72 @@
art_data
+%0Afrom data_loader.basic_loader import flot_line_renderer
%0A%0Aclass
@@ -1294,16 +1294,17 @@
_data()%0A
+%0A
%09%09%09for y
@@ -1432,16 +1432,56 @@
rt.mode%0A
+%09%09%09%09new_chart.renderer = chart.renderer%0A
%09%09%09%0A%09%09%09c
@@ -2248,16 +2248,56 @@
art.mode
+%0A%09%09%... |
b8ae587da8b3cecf6b1f2fbe8899f0629e24448b | remove main mathod | libcloudcli/configure.py | libcloudcli/configure.py | import os
import re
import sys
import logging
import configparser
def main():
try:
root = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
# currently config.ini is in example folder
config_path = os.path.join(root, 'examples/config.ini')
# TODO: There is a better way t... | Python | 0.999998 | @@ -65,20 +65,29 @@
r%0A%0A%0Adef
-main
+readConfigure
():%0A
@@ -703,43 +703,4 @@
(e)%0A
-%0Aif __name__ == '__main__':%0A main()%0A
|
4a4b1ec09d0c0757ff5dd5a91ab59406903f96fa | Fix api routes | libcrowds_analyst/api.py | libcrowds_analyst/api.py | # -*- coding: utf8 -*-
import json
from rq import Queue
from redis import Redis
from flask import Blueprint, request, current_app, jsonify, abort
from libcrowds_analyst import analysis
BP = Blueprint('api', __name__)
QUEUE = Queue('libcrowds_analyst', connection=Redis())
MINUTE = 60
def analyse(func):
"""Analy... | Python | 0.000017 | @@ -852,17 +852,16 @@
.route('
-/
convert-
@@ -1081,17 +1081,16 @@
.route('
-/
playbill
|
4a1ea024efaecb4d3a4808fb402c8917770a59c5 | add present absent to vlan_vnic | library/ucs_vlan_vnic.py | library/ucs_vlan_vnic.py | #!/usr/bin/python
# TODO Error handling.
# Detect parameters missing. Ansible does this right?...
# Merge add/remove
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'Jason Barbee',
'version': '0.1'}
DOCUMENTATION = '''
---
module: ucs_vlan_vnic
version_added: "2.2"
s... | Python | 0.999958 | @@ -5174,52 +5174,8 @@
le)%0A
- module.exit_json(**results)%0A
@@ -5332,32 +5332,24 @@
nic(module)%0A
-
modu
|
cc64ccf708c3ef9d36e3075d89ec40acf90d3373 | Determine stochasticity automatically for MetaPlayer (which fixes tests) | axelrod/strategies/meta.py | axelrod/strategies/meta.py | import random
from axelrod import Player
class MetaPlayer(Player):
"""A generic player that has its own team of players."""
team = []
def __init__(self):
Player.__init__(self)
# Make sure we don't use any meta players to avoid infinite recursion.
self.team = [t for t in self.t... | Python | 0 | @@ -477,24 +477,172 @@
self.team%5D%0A%0A
+ # If the team will have stochastic players, this meta is also stochastic.%0A self.stochastic = any(%5Bt.stochastic for t in self.team%5D)%0A%0A
def stra
@@ -655,32 +655,32 @@
elf, opponent):%0A
-
%0A # Make
@@ -1330,38 +1330,16 @@
ajority%22
-%0... |
bd0216e4e63e54c1b652fd12fef1397c5b5cae32 | Update constants.py | azurecloudify/constants.py | azurecloudify/constants.py | ########
# Copyright (c) 2015 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0.000001 | @@ -782,16 +782,92 @@
earer '%0A
+headers = %7B%22Content-Type%22: %22application/json%22, %22Authorization%22: credentials%7D
%0Asubscri
|
817ade17f2d30359e207ba313990ea31658a1f9b | fix docker build script | cellbase-app/app/cloud/docker/docker-build.py | cellbase-app/app/cloud/docker/docker-build.py | #!/usr/bin/env python
import argparse
import os
import requests
import sys
import json
import pathlib
from pathlib import Path
def error(message):
sys.stderr.write('error: %s\n' % message)
# parser.print_help()
sys.exit(2)
def run(command):
print(command)
code = os.system(command)
if code !... | Python | 0.000099 | @@ -14,16 +14,17 @@
v python
+3
%0A%0Aimport
@@ -4373,14 +4373,8 @@
+ %22/
-build/
bin/
|
100ae3aaaa5fb9339c7d3c71228536540ee22c51 | change SQL query symbol to match the nect part of the instrucitonal. | journal.py | journal.py | # -*- coding: utf-8 -*-
import os
import logging
from pyramid.config import Configurator
from pyramid.session import SignedCookieSessionFactory
from pyramid.view import view_config
from waitress import serve
import psycopg2
from contextlib import closing
from pyramid.events import NewRequest, subscriber
import datetime... | Python | 0 | @@ -491,19 +491,22 @@
%0A)%0A%22%22%22%0A%0A
-NEW
+INSERT
_ENTRY =
@@ -2914,11 +2914,14 @@
ute(
-NEW
+INSERT
_ENT
|
8a0080f7c0478ece42cebbdf46259c3dfc81499b | Mark the symbol servers argument to fetch-symbols.py as required | mendeley/fetch-symbols.py | mendeley/fetch-symbols.py | #!/usr/bin/env python
# This is a script to fetch debug symbols for a binary from
# a symbol server with an HTTP endpoint, for use with
# minidump_stackwalk's '-e' option which runs an external
# command to fetch debug symbols needed to generate a stacktrace
# from a minidump.
#
# Given a binary name and build ID, it ... | Python | 0.000001 | @@ -1851,16 +1851,37 @@
symbols'
+,%0A required=True
)%0A pa
|
3541ae7a91d0d7d932659d5a5fd96b62a390bba7 | use hasattr | toolware/utils/query.py | toolware/utils/query.py | import re
import datetime
from django.db.models import Q
from django.db import models
from django.db.models.query import QuerySet
from .generic import get_integer, get_days_ago, get_days_from_now
class CaseInsensitiveQuerySet(QuerySet):
"""
Custom QuerySet to treat queries on special field(s) as case insensi... | Python | 0.000002 | @@ -658,35 +658,81 @@
%22%22%22%0A
-try
+if hasattr(self.model, 'CASE_INSENSITIVE_FIELDS')
:%0A fo
@@ -938,56 +938,8 @@
eld%5D
-%0A except AttributeError:%0A pass
%0A%0A
|
2d7dbe1a30edd2a915e8b1b60db8fe8dbf6402e0 | bump version | message_queue/__init__.py | message_queue/__init__.py | __version__ = '0.3.2'
from message_queue.logger import *
from message_queue.publisher import Publisher
from message_queue.message import Message
from message_queue.subscriber import Subscriber
from message_queue.adapters import *
| Python | 0 | @@ -16,9 +16,9 @@
0.3.
-2
+3
'%0A%0Af
|
abd85c1ade671ba991caacd73dad0dc77190c865 | Fix upload field character limit | main/forms.py | main/forms.py | from django import forms
from .models import MailOrder
from tinymce.widgets import TinyMCE
class GoogleAddressForm(forms.Form):
sender_street_number = forms.CharField(max_length=100, required=False, widget=forms.HiddenInput())
sender_route = forms.CharField(max_length=100, required=False, widget=forms.HiddenIn... | Python | 0 | @@ -1884,33 +1884,33 @@
ield(max_length=
-1
+8
00, required=Fal
|
a9b2b5acd3b629aeb7d6254f3a346619028fe9ba | Add sketch column | nycodex/db/schema.py | nycodex/db/schema.py | import enum
import sqlalchemy as sa
from sqlalchemy.dialects import postgresql
from .base import Base
from .utils import UpsertMixin
@enum.unique
class AssetType(enum.Enum):
calendar = "calendar"
chart = "chart"
datalens = "datalens"
dataset = "dataset"
file = "file"
filter = "filter"
hr... | Python | 0.000001 | @@ -1721,25 +1721,24 @@
able=False)%0A
-%0A
dataset
@@ -1795,8 +1795,687 @@
ields%22)%0A
+%0A%0Aclass Sketch(Base, UpsertMixin):%0A __tablename__ = %22sketch%22%0A __table_args__ = (%0A sa.ForeignKeyConstraint(%0A %5B%22dataset_id%22, %22field_name%22%5D,%0A %5B%22field.datase... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.