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 |
|---|---|---|---|---|---|---|---|
032d0cd785a979da59e90c1064a868cd252618e4 | Change import to form used everywhere else. | scikits/image/color/tests/test_colorconv.py | scikits/image/color/tests/test_colorconv.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:author: Nicolas Pinto, 2009
:license: modified BSD
"""
from os import path
import numpy as np
from numpy.testing import *
from scikits.image.io import imread
from scikits.image.color import (
rgb2hsv,
)
from scikits.image import data_dir
import colorsys
... | Python | 0 | @@ -105,23 +105,18 @@
%22%22%0A%0A
-from os
import
+os.
path
@@ -353,32 +353,35 @@
mg_rgb = imread(
+os.
path.join(data_d
@@ -425,16 +425,19 @@
imread(
+os.
path.joi
@@ -861,24 +861,16 @@
e(self):
-
%0A
|
caa8c7c1fcd77bfb3fb79675a20acbf7a784bc9a | fix the version comparison for pytorch installed with pip (#2179) | mmdet/core/fp16/hooks.py | mmdet/core/fp16/hooks.py | import copy
import torch
import torch.nn as nn
from mmcv.runner import OptimizerHook
from ..utils.dist_utils import allreduce_grads
from .utils import cast_tensor_type
class Fp16OptimizerHook(OptimizerHook):
"""FP16 optimizer hook.
The steps of fp16 optimizer is as follows.
1. Scale the loss value.
... | Python | 0 | @@ -3460,79 +3460,8 @@
t()%0A
- torch_version = %5Bint(v) for v in torch.__version__.split('.')%5D%0A
@@ -3512,16 +3512,18 @@
orch
+._
_version
%3C %5B
@@ -3522,17 +3522,18 @@
sion
+__
%3C
-%5B1, 3%5D
+'1.3'
:%0A
|
005fb52b70a8f29151e77169e967cdebb7649534 | tweak expected result in mmirs analysis test due to slight background change | mmtwfs/tests/test_wfs.py | mmtwfs/tests/test_wfs.py | # Licensed under GPL3 (see LICENSE)
# coding=utf-8
import pkg_resources
import os
import numpy as np
from matplotlib.testing.decorators import cleanup
from ..zernike import ZernikeVector
from ..config import mmt_config
from ..wfs import WFSFactory, check_wfsdata
from ..custom_exceptions import WFSConfigException, W... | Python | 0 | @@ -1760,17 +1760,17 @@
) == -27
-4
+5
)%0A%0A@clea
|
6d0e4c0568d6ad5ee16afd34e30b06a5fb3b58eb | bump version number | mocodo/version_number.py | mocodo/version_number.py | version = u"2.1.3" | Python | 0.000004 | @@ -13,6 +13,6 @@
2.1.
-3
+4
%22
|
36e76242be9bea7c13406eddab2821c76757f8c1 | fix song initialization in panel | mod-bspwm/widgets/mpd.py | mod-bspwm/widgets/mpd.py | import math
import mpd
import subprocess
from PyQt5 import QtWidgets
class MpdProvider(object):
delay = 1
def __init__(self, main_window):
self.enabled = len(main_window) > 1
if not self.enabled:
return
self.main_window = main_window
self.client = mpd.MPDClient()
... | Python | 0 | @@ -373,16 +373,49 @@
s = None
+%0A self.current_song = None
%0A%0A
|
aeb59440809f9a3ab32bf65752627822ce57b5fa | use AdvectionDiffusion timestepper class for test_IP_diffusion | tests/test_IP_diffusion.py | tests/test_IP_diffusion.py | import itertools
from os import path
from gusto import *
from firedrake import PeriodicIntervalMesh, ExtrudedMesh, SpatialCoordinate,\
VectorFunctionSpace, File, Constant, Function, exp, as_vector
import pytest
def setup_IPdiffusion(vector, DG):
dt = 0.01
L = 10.
m = PeriodicIntervalMesh(50, L)
m... | Python | 0 | @@ -1,41 +1,4 @@
-import itertools%0Afrom os import path%0A
from
@@ -119,14 +119,8 @@
ace,
- File,
Con
@@ -129,18 +129,8 @@
ant,
- Function,
exp
@@ -171,32 +171,41 @@
tup_IPdiffusion(
+dirname,
vector, DG):%0A%0A
@@ -481,21 +481,15 @@
ame=
-%22IPdiffusion%22
+dirname
)%0A%0A
@@ -780,32 +780,83 @@
%0A ... |
09a6c0ccce4b1909e1df9c86a5f949849caae536 | use scenetree class to index scenes | poll-usgs/handler.py | poll-usgs/handler.py |
import gzip
import hashlib
import logging
import requests
import boto3
logger = logging.getLogger()
logger.setLevel(logging.INFO)
def chunks(l):
for i in range(0, len(l), 10):
yield l[i:i+10]
def create_path_row_tree(scenes):
"""
Create a search tree using path/row as indices.
"""
tre... | Python | 0 | @@ -208,123 +208,97 @@
%5D%0A%0A%0A
-def create_path_row_tree(scenes):%0A %22%22%22%0A Create a search tree using path/row as indices.%0A %22%22%22%0A tree
+class SceneTree(object):%0A%0A def __init__(self, scene_list):%0A%0A self.data
= %7B%0A
+
@@ -319,32 +319,36 @@
: %7B%0A ... |
d8eadf3803acaee35bda3ae99e72ae3041d33e70 | use a queue and flatten to allow adding other streams later | hedgehog/server/hedgehog_server.py | hedgehog/server/hedgehog_server.py | from typing import Any, Callable, Coroutine, Dict, Type
import logging
import traceback
import zmq.asyncio
import aiostream.stream
from hedgehog.utils.asyncio import Actor
from hedgehog.utils.zmq.poller import Poller
from hedgehog.utils.zmq.socket import SocketLike
from hedgehog.utils.zmq.timer import Timer
from hedge... | Python | 0 | @@ -50,16 +50,31 @@
, Type%0A%0A
+import asyncio%0A
import l
@@ -80,16 +80,16 @@
logging%0A
-
import t
@@ -116,22 +116,20 @@
asyncio%0A
-import
+from
aiostre
@@ -130,23 +130,28 @@
iostream
-.stream
+ import pipe
%0Afrom he
@@ -183,16 +183,35 @@
rt Actor
+, stream_from_queue
%0Afrom he
@@ -2524,17 +2524,16 @@... |
64e3dcab39c97896431847c11644bba34305ff1a | Fix None | operations.py | operations.py | # coding: utf-8
import json
import telegram
from rq.decorators import job
from redis_wrap import SYSTEMS
import config
import botcommands
from utils import *
bot = None
@job('reply', connection=SYSTEMS['default'], result_ttl=5)
def handle_update(update, telegram_bot=None):
global bot
if telegram_bot is Non... | Python | 0.002881 | @@ -2509,16 +2509,51 @@
=debug)%0A
+ if result is not None:%0A
|
8f6921e9fdc294fd6cc0f5701624a27ff63ed1c0 | Add 'Objectiveable' to Objectives, and rename association | src/ggrc/models/objective.py | src/ggrc/models/objective.py | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
from ggrc import db
from .associationproxy import association_proxy
from .mixins i... | Python | 0 | @@ -420,24 +420,68 @@
Personable%0A
+from .object_objective import Objectiveable%0A
from .reflec
@@ -521,16 +521,31 @@
jective(
+Objectiveable,
Document
@@ -1098,26 +1098,26 @@
object
+ive
_object
-ive
s = db.r
@@ -1362,24 +1362,25 @@
ols',%0A
+#
'object_obje
@@ -1384,24 +1384,51 @@
bjectives',%0A
+... |
996486d25a23f2d75384e8c2736ca4735a542283 | Fix obj load function | module/others/plugins.py | module/others/plugins.py | from maya import cmds
class Commands(object):
""" class name must be 'Commands' """
commandDict = {}
def _loadObjPlugin(self):
if not cmds.pluginInfo("objExport", q=True, loaded=True):
cmds.loadPlugin("objExport")
commandDict['sampleCommand'] = "sphere.png"
# ^ Don't forget t... | Python | 0.000031 | @@ -264,21 +264,21 @@
ct%5B'
-sampleCommand
+loadObjPlugin
'%5D =
|
7b0505318128a2f7a567fd2b949f99e212108f2e | Add util.get_accounts_from_file(). | src/Exscript/util.py | src/Exscript/util.py | # Copyright (C) 2007 Samuel Abels, http://debain.org
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2, as
# published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOU... | Python | 0 | @@ -3332,24 +3332,684 @@
urn hosts%0A%0A%0A
+def get_accounts_from_file(self, filename):%0A %22%22%22%0A Reads a list of user/password combinations from the given file %0A and creates an Account instance for each of them.%0A Returns a list of accounts.%0A%0A @type filename: string%0A @param filename... |
36dcd427769904e7f6ff5f44b933774bdfa48843 | Change `boot` to `request` | vcl_client/vcl.py | vcl_client/vcl.py | """Entry point for CLI access."""
import json
import click
import tabulate
import keyring
from vcl_client import cfg
from vcl_client import request
from vcl_client import utils
@click.group()
def vcl():
"""Creates and manages VMs hosted by the Apache VCL service."""
@vcl.command()
@click.argument('image_id')... | Python | 0 | @@ -276,32 +276,46 @@
%0A%0A%0A@vcl.command(
+name='request'
)%0A@click.argumen
@@ -687,20 +687,32 @@
.')%0Adef
-boot
+request_instance
(image_i
|
28c8b43abb281b247d3c572e12b7c401437642f5 | fix issue with new twitter urls | twitterbot.py | twitterbot.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import asyncore, random, re, twitter, urllib2, exceptions
from ConfigParser import ConfigParser
from datetime import datetime, timedelta
from sys import argv, exit
from ircasync import *
from subprocess import Popen, PIPE
config = ConfigParser()
try:
config.readfp(open(ar... | Python | 0.000057 | @@ -1353,24 +1353,28 @@
%5C/.*%5C/status
+e?s?
%5C/(%5B0-9%5D%7B0,2
@@ -1769,16 +1769,20 @@
*/status
+e?s?
%5C/(%5B0-9%5D
|
70de19b20cc71a8f4c77fe6c96f85921c74639ca | remove unused code | tests/test_djangoclient.py | tests/test_djangoclient.py | # -*- coding: utf-8 -*-
# Copyright 2015 splinter authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
import os
import sys
import unittest
from six.moves.urllib import parse
from splinter import Browser
from .base import BaseBrowserTests... | Python | 0 | @@ -459,247 +459,24 @@
ngo%0A
-try:%0A # Django %3E= 1.7 needs setup%0A django.setup()%0Aexcept AttributeError:%0A pass%0A%0A%0Adef django_installed():%0A try:%0A import django # noqa%0A Browser(%22django%22)%0A except ImportError:%0A return False%0A return True
+%0A%0Adjango.se... |
f432ad600fdd9b69fb35a1a56c3799a0521e1c04 | add start command | perch/bases.py | perch/bases.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import json
import os
import sys
from .config import constants
from .serializers import serializers
class StdIOHandler(object):
"Provide common I/O handling to the command line"
def __init__(self):
self.config = json.loads(os.environ.get(constants.stage_e... | Python | 0.000008 | @@ -935,32 +935,170 @@
p(obj) + '%5Cn')%0A%0A
+ elif command == 'start':%0A for obj in self.start():%0A sys.stdout.write(self.serializer.dump(obj) + '%5Cn')%0A%0A
else:%0A
|
b21618784ce58fc73516d90f6ba9ed6e6c26772f | Fix style of events admin file | cs4teachers/events/admin.py | cs4teachers/events/admin.py | """Administration configuration for the events application."""
from django.contrib import admin
from events.models import (
Event,
ThirdPartyEvent,
Location,
Session,
Sponsor,
Resource,
)
from django_google_maps import widgets as map_widgets
from django_google_maps import fields as map_fields
... | Python | 0 | @@ -1025,16 +1025,17 @@
%0A %7D%0A%0A
+%0A
class Re
|
9d61e0bd697cf8cd5086f56f85f6083d29a2f083 | 重构,加入一些注释 | pyactive/relation/relation_methods.py | pyactive/relation/relation_methods.py | # -*- coding:utf-8 -*-
from ..utils import singularize_of, pluralize_of, ColumnNotInColumns
def owner_attr_for_has_one_and_has_belongs_to(self):
""" for has_one and belongs_to
"""
if self._owner_attr:
return self._owner_attr
if self.owner is None:
return None
from ..record import A... | Python | 0 | @@ -152,31 +152,72 @@
%22%22%22
-fo
+Use
r has
-_one and
+ one Phone, owner attr must be 'phone'%0A Phone
belongs
_to%0A
@@ -212,19 +212,51 @@
belongs
-_
+
to
+ User, owner attr must be 'user'
%0A %22%22%22
@@ -683,20 +683,56 @@
%22%22%22
-fo
+Use
r has
-_
+
many
+ Phone, owner attr must be 'phone... |
6a304e8d4a02a7243c49816b586d8a6fb38c14b0 | return value of get_market_ids in cryptsy.public matches the private implementation | cryptsy/public.py | cryptsy/public.py | # Copyright (c) 2014 Henry S. Harrison
import requests
from datetime import datetime
from decimal import Decimal
from cryptsy.common import COMMON_HEADERS, CryptsyError, DATETIME_FORMAT
from cryptsy.order import parse_order_list
from cryptsy.trade import parse_trade_list
URL = 'http://pubapi.cryptsy.com/api.php'
... | Python | 0.000001 | @@ -3542,30 +3542,36 @@
kwargs)%0A
-return
+pair_to_id =
%7Bpair: info
@@ -3611,16 +3611,105 @@
sponse.items()%7D%0A
+ id_to_pair = %7Bv: k for k, v in pair_to_id.items()%7D%0A return id_to_pair, pair_to_id%0A
|
cd63e0db15e820dad330e10c585dc84cea0c5aa8 | Allow to change datadir by argument to AnalysisDaemon | pycqed/analysis_v2/analysis_daemon.py | pycqed/analysis_v2/analysis_daemon.py |
import time
import traceback
import logging
import os
import matplotlib.pyplot as plt
log = logging.getLogger(__name__)
log.setLevel(logging.INFO)
from pycqed.analysis import analysis_toolbox as a_tools
class AnalysisDaemon:
"""
AnalysisDaemon is a class that allow to process analysis in a
separate pytho... | Python | 0 | @@ -1464,32 +1464,104 @@
f.job_errs = %5B%5D%0A
+ if watchdir is not None:%0A a_tools.datadir = watchdir%0A
if start
|
de89e3c3cf0eee28693f33f26b9b9b24e8def64e | Change 'http' to 'https' for SonarCloud | tests/test_integrations.py | tests/test_integrations.py | from uuid import uuid1
import pytest
@pytest.fixture(autouse=True)
def integrations_create_webhook_incoming(logged_rocket):
return logged_rocket.integrations_create(
integrations_type="webhook-incoming",
name=str(uuid1()),
enabled=True,
username=logged_rocket.me().json().get("user... | Python | 0.999152 | @@ -878,16 +878,17 @@
s=%5B%22http
+s
://examp
|
598f5da36f99d2e1fec56f047b6e1d636844cc5c | Fix 'relation "core_project" does not exist' error | pylab/core/migrations/0001_initial.py | pylab/core/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
import django_extensions.db.fields
import autoslug.fields
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_de... | Python | 0 | @@ -349,16 +349,64 @@
MODEL),%0A
+ ('website', '0002_auto_20150728_0303'),%0A
%5D%0A%0A
|
5fe4629bb6e4277541b3e12e4bb866a41d9f93e4 | Add scatter to det continuous scores | pysteps/verification/detcontscores.py | pysteps/verification/detcontscores.py | """Forecast evaluation and skill scores for deterministic continuous forecasts."""
import numpy as np
from scipy.stats import spearmanr, pearsonr
def scores_det_cont_fcst(pred, obs, scores, offset=0.01):
"""Calculate simple and skill scores for deterministic continuous forecasts
Parameters
----------... | Python | 0.000001 | @@ -2368,24 +2368,288 @@
----------+%0A
+ %7C scatter %7C half the distance between the 16%25 and 84%25 percentiles of the %7C%0A %7C %7C error distribution %7C%0A +------------+------------------------------------------------------------... |
58193351b2cda1428bcbc1d17183b4ca30bec90e | add test for float parsing | tests/test_templatetags.py | tests/test_templatetags.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
test_django-sheets
------------
Tests for `django-sheets` models module.
"""
import os
import responses
from io import open
from django import template
from django.test import SimpleTestCase
from django.test.utils import override_settings
from django.core.cache impo... | Python | 0.000001 | @@ -4246,28 +4246,578 @@
al(1, len(responses.calls))%0A
+%0A @responses.activate%0A def test_floats(self):%0A %22%22%22%0A Make sure that empty spreadsheets are not mistaken for cache miss%0A %22%22%22%0A responses.add(%0A responses.GET, gdocs_format.format(key=sample_key),... |
b8f40755b58746a8509bf441bf89f8b53426c876 | Save feed_classes as individual pickle rather than combined dictionary for all diseases Make sure predictors and feed_classes are only reloaded once, and saved to local store | python/machine_weighting_predictor.py | python/machine_weighting_predictor.py | """
Entry point for Python service, to which data is POSTed to train the ABRAID Ensemble Chain,
and from which a prediction for a new datapoint is requested.
"""
from chain import Chain
from flask import Flask, request
from sklearn.externals import joblib
import numpy as np
app = Flask(__name__)
PREDICTORS = {}
FEED_... | Python | 0 | @@ -1669,32 +1669,85 @@
.load(filename)%0A
+ PREDICTORS%5Bdisease_group_id%5D = predictor%0A
except I
@@ -2166,32 +2166,90 @@
.load(filename)%0A
+ FEED_CLASSES%5Bdisease_group_id%5D = feed_classes%0A
except I
@@ -4082,16 +4082,34 @@
_CLASSES
+%5Bdisease_group_id%5D
, _get_p
|
cd20c89ffa34538437a41e2416be3168aab14926 | add placeholder | tests/test_user_is_root.py | tests/test_user_is_root.py | import os
import sys
def user_is_root():
"""Check if current UID is 0.
"""
if os.getuid() != 0:
print("This program requires ROOT privileges. Exiting.")
sys.exit()
user_is_root()
| Python | 0 | @@ -15,16 +15,37 @@
rt sys%0A%0A
+%22%22%22Placeholder.%0A%22%22%22%0A%0A
def user
|
bd653cac393b7de850941cafc5918921cf0ef4bf | Rename a protected constant variable | dataproperty/_formatter.py | dataproperty/_formatter.py | # encoding: utf-8
from __future__ import absolute_import, unicode_literals
import copy
from typepy import Nan, Typecode
class Format(object):
NONE = 0
THOUSAND_SEPARATOR = 1
class Formatter(object):
__slots__ = ("__is_formatting_float", "__format_flags", "__datetime_format_str")
_BLANK_CURLY_BRA... | Python | 0.000394 | @@ -331,17 +331,13 @@
_MAP
-PING
= %7B%0A
+
@@ -611,20 +611,16 @@
RMAT_MAP
-PING
.keys()%0A
@@ -1096,20 +1096,16 @@
RMAT_MAP
-PING
)%0A
@@ -1643,32 +1643,32 @@
l_places=None):%0A
+
format_s
@@ -1711,12 +1711,8 @@
_MAP
-PING
.get
|
f0e172872435307d5fe3ac48ff7c2ed0b3df5759 | split up integration and unit tests, the sqlite tests take longer than i'd like, do as much unit testing as possible -- adding some unit tests for player height/weight conversion | tests/unit/models_tests.py | tests/unit/models_tests.py | import unittest
from nhlstats.models import Player
class TestModelPlayer(unittest.TestCase):
def test_height_na(self):
p = Player()
self.assertEqual(p.height_imperial, 'N/A') | Python | 0 | @@ -187,21 +187,1302 @@
ight
-_imperial, 'N/A')
+, None)%0A self.assertEqual(p.height_imperial, 'N/A')%0A self.assertEqual(p.height_metric, 'N/A')%0A%0A p = Player(height=0)%0A self.assertEqual(p.height, 0)%0A self.assertEqual(p.height_imperial, 'N/A')%0A ... |
65e71b869ba0943f859e36acee3a33e457de7b63 | Add inverse sample size weighting combining function | permute/npc.py | permute/npc.py | from __future__ import division, print_function, absolute_import
import numpy as np
from scipy.stats import norm, rankdata
# Combining functions
def fisher(pvalues):
'''
Apply Fisher's combining function
.. math:: \-2\sum_i \log(p_i)
Parameters
----------
pvalues : array_like
... | Python | 0 | @@ -1227,16 +1227,485 @@
values)%0A
+ %0A%0Adef inverse_n_weight(pvalues, size):%0A %22%22%22%0A Compute the test statistic%0A%0A .. math:: -%5C%5Csum_%7Bs=1%7D%5ES%5C%5Cfrac%7Bp_s%7D%7B%5Csqrt%7BN_s%7D%7D%0A%0A Parameters%0A ----------%0A pvalues : array_like%0A Array of p-values to combin... |
4040ac18f60901779aacac0896e77d1f2b679adf | fix db2 test | tests/unit/test_app_db2.py | tests/unit/test_app_db2.py | import mock
import pip
from unittest import TestCase
from plugins.applications.db2 import db2_crawler
from plugins.applications.db2.feature import DB2Feature
from plugins.applications.db2.db2_container_crawler \
import DB2ContainerCrawler
from plugins.applications.db2.db2_host_crawler \
import DB2HostCrawler
fr... | Python | 0 | @@ -2558,128 +2558,8 @@
ss%0A%0A
- def test_noimport(self):%0A pip.main(%5B'uninstall', '--yes', 'ibm_db'%5D)%0A db2_crawler.retrieve_metrics()%0A%0A
|
d6c0052e032b56f9184c94d809b591d5c5da4c5a | Test fixes for Windows. | tests/unit/test_loaders.py | tests/unit/test_loaders.py | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved.
#
# 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 ... | Python | 0 | @@ -2526,32 +2526,45 @@
sertEqual(path,
+os.path.join(
'someservice/201
@@ -2559,17 +2559,20 @@
eservice
-/
+', '
2013-08-
@@ -2567,32 +2567,33 @@
', '2013-08-21')
+)
%0A%0A def test_d
@@ -2778,16 +2778,29 @@
l(path,
+os.path.join(
'someser
@@ -2795,33 +2795,36 @@
oin('someservice
-/
+', '
2012-10-01')%0... |
ee274d44eec39bd0ff886b5fd4818d43896b8210 | Change default resolution | photodaemon.py | photodaemon.py | import picamera
import redis
import time
def take_photo():
camera = picamera.PiCamera()
camera.capture('static/photo.jpg')
camera.close()
r.publish('photo', time.time())
r = redis.StrictRedis(host='localhost', port=6379, db=0)
p = r.pubsub()
p.subscribe('take-photo')
while True:
message = p.get_m... | Python | 0.000001 | @@ -86,16 +86,52 @@
amera()%0A
+ camera.resolution = (1280, 720)%0A
came
|
cd98efe591119b5cec903858fa0058b182cfc79e | Fix check for done | teuthology/task/restart.py | teuthology/task/restart.py | import logging
import pipes
from teuthology import misc as teuthology
from teuthology.orchestra import run as tor
from ..orchestra import run
log = logging.getLogger(__name__)
def restart_daemon(ctx, config, role, id_, *args):
log.info('Restarting {r}.{i} daemon...'.format(r=role, i=id_))
daemon = ctx.daemon... | Python | 0.999108 | @@ -5550,16 +5550,19 @@
if cmd
+%5B0%5D
== %22don
|
0bc30346f33e7d3379a1c8ee4758f0c85fc82016 | Mark parameter as unused | pic2map/cli.py | pic2map/cli.py | # -*- coding: utf-8 -*-
"""Command Line Interface."""
import argparse
import logging
import os
import subprocess
import sys
from pic2map.db import (
LocationDB,
transform_metadata_to_row,
)
from pic2map.fs import TreeExplorer
from pic2map.gps import filter_gps_metadata
from pic2map.server.app import app
log... | Python | 0.002629 | @@ -1165,16 +1165,17 @@
f serve(
+_
args):%0A
|
93cb2784eedda59aa725198b6a2bb49d9cba3fe9 | add arguments | pinhook/cli.py | pinhook/cli.py | import click
from .bot import Bot
from marshmallow import Schema, fields, validate, INCLUDE
class Config(Schema):
nickname = fields.Str(required=True)
channels = fields.List(fields.Str(), required=True)
server = fields.Str(required=True)
port = fields.Int()
ops = fields.List(fields.Str())
ssl_r... | Python | 0.000006 | @@ -580,24 +580,37 @@
_conf(config
+, conf_format
):%0A schem
@@ -1943,16 +1943,29 @@
i(config
+, conf_format
):%0A c
|
7d6ceb556b0293510e99a63a867342c50fc1a890 | add min block height to scan to | opreturnninja/rpc_scan.py | opreturnninja/rpc_scan.py | import logging
logging.basicConfig(level=logging.INFO)
import argparse
import traceback
import sys
from io import BytesIO
from binascii import unhexlify
from time import sleep
import logging
from socket import timeout
import http.client
import multiprocessing as mp
import functools
from sqlalchemy.exc import Integrit... | Python | 0 | @@ -3180,16 +3180,28 @@
rom + 1,
+ min(430000,
force_f
@@ -3218,16 +3218,17 @@
* 365))
+)
if i no
|
1046e53c2f6068be9ff7c0ecb62ca665e08fccb4 | Tweak Sentry init to allow running from default settings.py. | plenario/__init__.py | plenario/__init__.py | import os
from flask import Flask, render_template, redirect, url_for, request
from raven.contrib.flask import Sentry
from plenario.database import session as db_session
from plenario.models import bcrypt
from plenario.api import api, cache
from plenario.auth import auth, login_manager
from plenario.views import views
... | Python | 0 | @@ -1,14 +1,4 @@
-import os%0A
from
@@ -364,38 +364,8 @@
lug%0A
-from urllib import quote_plus%0A
from
@@ -411,19 +411,131 @@
RY_URL%0A%0A
-try
+%0A# Unless PLENARIO_SENTRY_URL specified in settings, don't try to start raven.%0Asentry = None%0Aif PLENARIO_SENTRY_URL
:%0A se
@@ -577,43 +577,9 @@
RL)%0A
-except ... |
8dd2beef3c91da695321c7ceacd46898c97f1efa | Remove (currently) unused messenger web endpoint | plugins/messenger.py | plugins/messenger.py | import socket
import sys
from os import environ
from threading import Thread
import simplejson as json
from flask import Request
from injector import inject
from hal.outgoing_content import OutgoingContent
from hal.response import Envelope
from hal.user import User
def exit_after_finished(fun, exit_code_fun=lambda ... | Python | 0 | @@ -100,62 +100,8 @@
json
-%0Afrom flask import Request%0Afrom injector import inject
%0A%0Afr
@@ -579,345 +579,8 @@
ot):
-%0A @inject(request=Request)%0A def talk(request):%0A room = request.form%5B'room'%5D%0A name = request.form.get('user') or None%0A if name:%0A user = User(... |
51b91c6e53ec257d2bcc83338ea621d6e7521fdc | Fix side effects on join queries. | dci/server/api/v1/utils.py | dci/server/api/v1/utils.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2015 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 la... | Python | 0.000057 | @@ -2733,16 +2733,21 @@
elect =
+list(
table_a_
@@ -2754,16 +2754,17 @@
select_c
+)
%0A # f
|
4bb6833a3e41a1a130a548ce2654a88fec2250d7 | Use smooth | mos/meshes.py | mos/meshes.py | import bpy
import bmesh
import struct
import json
import os
def uv_from_vert_first(uv_layer, v):
for l in v.link_loops:
uv_data = l[uv_layer]
return uv_data.uv
return None
def has_material_index(vertex, index):
has_index = False
for face in vertex.link_faces:
if face.material... | Python | 0.000001 | @@ -2588,39 +2588,9 @@
if
-blender_object.data.polygons%5B0%5D
+f
.use
@@ -2596,17 +2596,16 @@
e_smooth
-
:%0A
|
3ce3abbf33130a7d7d82915456c4de200edc0a30 | Fix reading wrong version field. | starthinker/util/google_api/discovery_to_bigquery.py | starthinker/util/google_api/discovery_to_bigquery.py | ###########################################################################
#
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/l... | Python | 0.0004 | @@ -1420,18 +1420,21 @@
fo%5B'
-discoveryV
+items'%5D%5B0%5D%5B'v
ersi
|
4085fbfb4a418e000745961c8695ab32015f377d | Update prediction update script. | prediction/update.py | prediction/update.py | # -*- coding: utf-8 -*-
#
# Poio Corpus
#
# Copyright (C) 2009-2013 Poio Project
# Author: Peter Bouda <pbouda@cidles.eu>
# URL: <http://media.cidles.eu/poio/>
# For license information, see LICENSE.TXT
# Works with Python 2 and 3, requires 64-bit Python
import sys
import os
import glob
import zipfile
import shutil
i... | Python | 0 | @@ -2875,16 +2875,23 @@
_date =
+3000000
0%0A%0A
|
d29c68b4d67a2fd88fdf668b9b103c9cc3154a84 | Fix all flag so you don't need to pass in True | printers/printers.py | printers/printers.py | from collections import OrderedDict
import argparse
import datetime
import json
import os
import subprocess
import sys
import time
def getData(all = False):
"""Returns the print queue jobs in a nicely formatted JSON object."""
raw_data = subprocess.Popen(
'lpq -a', shell=True, stdout=subprocess.PIPE)... | Python | 0.999721 | @@ -2976,16 +2976,49 @@
'--all',
+ dest='all', action='store_true',
%0A
@@ -3076,34 +3076,48 @@
e info.'
-,
+)
%0A
- required
+argparser.set_defaults(all
=False)%0A
|
a60102ea950c44431097576d74921ea4867fb197 | Remove urllib and use requests | ugent-food.py | ugent-food.py | #!/usr/bin/env python3
import json
import datetime
import sys
import urllib.request
from urllib.error import HTTPError
def header(text, fillchar='-', width=40):
tofill = max(width - 4 - len(text), 0)
leftpad = tofill // 2
print('{}[ {} ]{}'.format(
fillchar * leftpad,
text,
fillc... | Python | 0 | @@ -52,18 +52,23 @@
%0Aimport
-sy
+request
s%0Aimport
@@ -68,30 +68,19 @@
%0Aimport
-urllib.request
+sys
%0Afrom ur
@@ -841,51 +841,21 @@
u =
-json.loads(urllib.request.urlopen(%0A
+requests.get(
%22htt
@@ -951,39 +951,13 @@
y)).
-read().decode(%0A 'utf-8')
+json(
)%0A
|
ef62b2c146bb1c8960a3ee700c544d61519998b2 | Remove unreachable conditional | wqflask/base/GeneralObject.py | wqflask/base/GeneralObject.py | # Copyright (C) University of Tennessee Health Science Center, Memphis, TN.
#
# 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 la... | Python | 0.000231 | @@ -1465,104 +1465,8 @@
y):%0A
- if key in self.__dict__.keys():%0A return self.__dict__%5Bkey%5D%0A else:%0A
|
707927b9cbe8b96d0848181c4f6a01a0f3358db2 | remove duplicate | src/NeuralNetwork.py | src/NeuralNetwork.py | import numpy
import scipy.special
class NeuralNetwork(object):
"""my neural network"""
def __init__(self, inputnodes, hiddennodes, outputnodes, learningrate):
# set number of nodes in each input, hidden, output layer
self.inodes = inputnodes
self.hnodes = hiddennodes
self.onodes... | Python | 0.999985 | @@ -61,18 +61,16 @@
t):%0A
-%22%22
%22my neur
@@ -76,26 +76,24 @@
ral network%22
-%22%22
%0A def __i
@@ -948,18 +948,16 @@
-%22%22
%22train t
@@ -966,34 +966,32 @@
neural network%22
-%22%22
%0A # conve
@@ -2502,18 +2502,16 @@
-%22%22
%22query t
@@ -2528,18 +2528,16 @@
network... |
cfac4d9499ca02828fb4777c226f35fcd106014f | Fix issues with python 2 | proxytypes.py | proxytypes.py | """
Based on the implementation here by Phillip J. Eby:
https://pypi.python.org/pypi/ProxyTypes
"""
from functools import wraps
import operator
import sys
PY3 = sys.version_info[0] >= 3
OPERATORS = [
# Unary
"pos", "neg", "abs", "invert",
# Comparison
"eq", "ne", "lt", "gt", "le", "ge",
# Contai... | Python | 0.000006 | @@ -1169,18 +1169,19 @@
bases,
-%7B%7D
+dct
)%0A
@@ -1501,19 +1501,20 @@
if key
-==
+in %5B
%22__dict_
@@ -1515,16 +1515,28 @@
_dict__%22
+, %22__new__%22%5D
:%0A
|
be73d3eea43119758ae195d6722c4669b2f3e06f | Disallows negative timespan | moirai/hardware/timer.py | moirai/hardware/timer.py | # -*- coding: utf-8; -*-
#
# Copyright (c) 2016 Álan Crístoffer
#
# 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, ... | Python | 0.998733 | @@ -1637,18 +1637,26 @@
e.sleep(
-dt
+max(dt, 0)
)%0A%0A d
|
c2c1b850c1045d0e57217b074d5ce79dfee78681 | Update moksha's app_cfg | moksha/config/app_cfg.py | moksha/config/app_cfg.py | from tg.configuration import AppConfig, Bunch
import moksha
from moksha import model
from moksha.lib import app_globals, helpers
base_config = AppConfig()
base_config.renderers = []
base_config.package = moksha
#Set the default renderer
base_config.default_renderer = 'genshi'
base_config.renderers.append('genshi')
... | Python | 0 | @@ -153,36 +153,8 @@
g()%0A
-base_config.renderers = %5B%5D%0A%0A
base
@@ -180,16 +180,17 @@
oksha%0A%0A#
+
Set the
@@ -242,58 +242,160 @@
= '
-genshi'%0Abase_config.renderers.append('genshi')
+mako'%0Abase_config.renderers = %5B%5D%0Abase_config.renderers.append('mako') %0A%0A# @@ This is necessary at the mom... |
082dabcc5f74a82c2e0afa11999da77087a5b2e0 | Update WebUtils.py | data/WebUtils.py | data/WebUtils.py | class WebUtils(object) :
class Scrape(object) :
from functools import lru_cache
@lru_cache(maxsize=None)
def __call__(self,url,headers=None, raw=False) :
#print(url)
return WebUtils.invoke_url(url,headers,raw)
@staticmethod
def invoke_url(url,headers=None, raw=False) :
import requests
... | Python | 0 | @@ -102,20 +102,19 @@
maxsize=
-None
+100
)%0A de
|
8e5246cf9b95294c56d2ee76bcf25975de144c3b | debug status | project/utils/status.py | project/utils/status.py | import json
import requests
from project.models import Phone, Alias
def get_alias(phone, shortname):
phon = Phone.query.filter(Phone.phone_number == phone).first()
if phon is None:
return shortname
alis = Alias.query.filter(Alias.uid == phon.uid and Alias._from == shortname).first()
if alis is N... | Python | 0.000001 | @@ -174,32 +174,87 @@
f phon is None:%0A
+ print(%22unknown phone -- using %25s%22 %25 shortname)%0A
return s
@@ -258,24 +258,24 @@
n shortname%0A
-
alis = A
@@ -381,32 +381,130 @@
-return shortname
+print(%22no alias found -- using %25s%22 %25 shortname)%0A return shortname%0A ... |
7a7c2a069bf6464d3225a0627fe92ce2cd327c5d | fix status | project/utils/status.py | project/utils/status.py | import json
import requests
def get_alias(phone, shortname):
return shortname
def get_status(wit_json, phone):
wit_json = json.loads(wit_json)
entities = wit_json["outcomes"][0]["entities"]
server = entities["server"][0]["value"]
status_entity = entities["status_item"][0]["value"]
server = get_... | Python | 0.000001 | @@ -430,16 +430,25 @@
pe(resp)
+%5B%22value%22%5D
== list
|
0fad77fecc5b4218347a64b5e224935d12c0dc4a | Remove odd logic with max_time_ms | mongo_thingy/__init__.py | mongo_thingy/__init__.py | import collections
from pymongo import MongoClient, ReturnDocument
from pymongo.errors import ConfigurationError
from thingy import classproperty, DatabaseThingy, registry
from mongo_thingy.cursor import Cursor
class Thingy(DatabaseThingy):
"""Represents a document in a collection"""
_client = None
_col... | Python | 0.000971 | @@ -3160,62 +3160,8 @@
r%7D%0A%0A
- max_time_ms = kwargs.pop(%22max_time_ms%22, None)%0A
@@ -3210,33 +3210,8 @@
rgs)
-.max_time_ms(max_time_ms)
%0A
|
42c2690f5baa90900a31384b0404f6c740c04536 | Update colors once. | process_results.py | process_results.py | import pandas as pd
import numpy as np
import itertools
import matplotlib.pyplot as plt
# These are the "Tableau 20" colors as RGB.
tableau20 = [(31, 119, 180), (174, 199, 232), (255, 127, 14), (255, 187, 120),
(44, 160, 44), (152, 223, 138), (214, 39, 40), (255, 152, 150),
(148, ... | Python | 0 | @@ -592,230 +592,8 @@
le):
-%0A # Scale the RGB values to the %5B0, 1%5D range, which is the format matplotlib accepts. %0A for i in range(len(tableau20)): %0A r, g, b = tableau20%5Bi%5D %0A tableau20%5Bi%5D = (r / 255., g / 255., b / 255.)%0A
@@ -3320,24 +3320,250 @@
='%5Ct')%0A ... |
337810c3340195d8ddfaf2549fdd0c8b56fd5754 | Fix bug when nostem is missing | plotsummary.py | plotsummary.py | #!/usr/bin/env python
# Plots various graphs for a series of plaintext files in a directory
# Copyright Martin Paul Eve 2015
"""plotsummary: Plots various graphs for a series of plaintext files in a directory
Usage:
plotsummary.py single <directory> <term_file> [options]
plotsummary.py hist <directory> <term_... | Python | 0.000001 | @@ -3016,16 +3016,68 @@
lines())
+%0A else:%0A nostem_words = %5B%5D
%0A%0A
|
bdd8eb3f6db0592e9eebca75b595a7128c148faa | Bump Version | cwmud/__init__.py | cwmud/__init__.py | # -*- coding: utf-8 -*-
"""A modular MUD server."""
# Part of Clockwork MUD Server (https://github.com/whutch/cwmud)
# :copyright: (c) 2008 - 2016 Will Hutcheson
# :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt)
from os.path import abspath, dirname
__author__ = "Will Hutcheson"
__contact__ = "... | Python | 0 | @@ -449,17 +449,17 @@
N = (0,
-3
+4
, 0, 0,
@@ -463,21 +463,18 @@
0, %22
-Count Chocula
+Dapper Dan
%22)%0A%0A
|
24aaf4084f2c8e9333cdc4e2aa5848bc26f59df5 | Fix failing tests | corehq/apps/domain/utils.py | corehq/apps/domain/utils.py | import re
from couchdbkit import ResourceNotFound
from django.conf import settings
from corehq.util.quickcache import quickcache
from corehq.apps.domain.models import Domain
from dimagi.utils.couch.database import get_db
DOMAIN_MODULE_KEY = 'DOMAIN_MODULE_CONFIG'
ADM_DOMAIN_KEY = 'ADM_ENABLED_DOMAINS'
new_domain_re =... | Python | 0.000069 | @@ -821,24 +821,43 @@
me(domain):%0A
+ if domain:%0A
normaliz
@@ -894,16 +894,20 @@
lower()%0A
+
if s
@@ -929,16 +929,20 @@
+
+
assert(r
@@ -996,16 +996,20 @@
lized))%0A
+
retu
@@ -1022,16 +1022,34 @@
malized%0A
+ return domain%0A
%0A%0Adef ge
|
a60f6909c07cff9ec29ffbe2a77893f663702085 | Remove unused import | dash/resources.py | dash/resources.py | from copy import copy
import json
import warnings
import collections
from .development.base_component import Component
class Resources():
def __init__(self, resource_name, layout):
self._resources = []
self.resource_name = resource_name
self.layout = layout
def append_resource(self, ... | Python | 0.000001 | @@ -46,27 +46,8 @@
ings
-%0Aimport collections
%0A%0Afr
|
dcbada03dd96fa2af61c7213da1abb24a2481da4 | return field | production/models.py | production/models.py | from django.db import models
from sortedm2m.fields import SortedManyToManyField
from diffusion.models import Place
from model_utils.managers import InheritanceManager
from common.models import Website, BTBeacon
from common.utils import make_filepath
from people.models import Artist, Staff, Organization
from assets.... | Python | 0.000004 | @@ -1843,16 +1843,8 @@
turn
- u%22%25s%22 %25
sel
|
496ec2cbf4d993071536f12cc89589c56f882f5b | check that output density has enough data points | share/scripts/inverse/density_symmetrize.py | share/scripts/inverse/density_symmetrize.py | #!/usr/bin/env python2
#
# Copyright 2009-2011 The VOTCA Development Team (http://www.votca.org)
#
# 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... | Python | 0.000408 | @@ -1288,22 +1288,22 @@
of the
-adress
+AdResS
zone (x
@@ -2523,18 +2523,17 @@
ensity.p
-l
+y
: adress
@@ -2632,16 +2632,265 @@
condx)%0A%0A
+if len(secondx) %3C 4:%0A exit(%22symmetrize_density.py: symmetrize density has less than points, that usually means the range of the input density (%22+infile+%22) doe... |
9b8e5e6183ca343b31f4396f0cd7538876f529f2 | add check for large messages | proxy/PSOCryptoUtils.py | proxy/PSOCryptoUtils.py | from Crypto.Cipher import ARC4, PKCS1_v1_5
from Crypto.PublicKey import RSA
class PSO2RC4(object):
"""docstring for PSO2RC4Decrypter"""
def __init__(self, key):
self.rc4key = key
self.rc4de = ARC4.new(key)
self.rc4en = ARC4.new(key)
def decrypt(self, data):
return self.rc... | Python | 0 | @@ -901,32 +901,49 @@
5.new(self.key)%0A
+ try:%0A
return c
@@ -998,16 +998,119 @@
For now%0A
+ except ValueError:%0A log.msg(%22Message too large to decrypt%22)%0A return None%0A
%0A%0Aclass
@@ -1575,32 +1575,49 @@
5.new(self.key)%0A
+ try:%0A
r... |
70036c5df568a80639ba9990e5d8b099ccee2fa8 | Reimplement onetime task until complete | project/api/tasks.py | project/api/tasks.py | # Standard Library
import logging
# Third-Party
from django_rq import job
from django.core.mail import EmailMessage
# Django
from django.template.loader import render_to_string
log = logging.getLogger(__name__)
# Utility
def build_email(template, context, subject, to, cc=[], bcc=[], attachments=[]):
# Clean as... | Python | 0.00104 | @@ -3232,8 +3232,330 @@
ports()%0A
+%0A@job('low')%0Adef onetime_update_from_account(account):%0A auth0 = get_auth0()%0A username = account%5B'user_id'%5D%0A name = account%5B'user_metadata'%5D%5B'name'%5D%0A payload = %7B%0A 'app_metadata': %7B%0A 'name': name,%0A %7D,%0A '... |
b08bff0278ab4789e5ea718a7a85667f40d96336 | Use getattr on person instance | project/api/tasks.py | project/api/tasks.py |
# Standard Library
import csv
import logging
import time
from io import BytesIO
# Third-Party
import pydf
from auth0.v3.authentication import GetToken
from auth0.v3.exceptions import Auth0Error
from auth0.v3.management import Auth0
from django_rq import job
from openpyxl import Workbook
from openpyxl.writer.excel imp... | Python | 0 | @@ -2119,34 +2119,62 @@
erson):%0A
-if person.
+user = getattr(person, 'user')%0A if
user:%0A
@@ -2178,23 +2178,16 @@
if
-person.
user.is_
@@ -2560,23 +2560,16 @@
.update(
-person.
user.use
|
ac94bf2ce899896cd0d58cb221a9c1123fb07c4e | Make getvar() optionally return raw time data | cosima_cookbook/querying.py | cosima_cookbook/querying.py | import logging
from sqlalchemy import select
import xarray as xr
from . import database
def getvar(expt, variable, db, ncfile=None, n=None,
start_time=None, end_time=None, chunks=None,
time_units=None, offset=None):
"""For a given experiment, return an xarray DataArray containing the
sp... | Python | 0.000076 | @@ -231,16 +231,35 @@
set=None
+, decode_times=True
):%0A %22
@@ -737,16 +737,80 @@
pplied.%0A
+ Time decoding can be disabled by passing decode_times=False%0A
%22%22%22%0A
@@ -2729,16 +2729,33 @@
.coords)
+ and decode_times
:%0A
|
4d1b9e93b485085acc977a3b3cefbad286a2cb7b | Fix wrong select call | mopidy_headless/input.py | mopidy_headless/input.py | from __future__ import unicode_literals
import logging
import threading
from evdev import ecodes, InputDevice, list_devices, categorize
from select import select
logger = logging.getLogger(__name__)
class InputThread(threading.Thread):
def __init__(self):
super(InputThread, self).__init__()
self.name="I... | Python | 0.000001 | @@ -1555,16 +1555,8 @@
%5B%5D,
-timeout=
10)%0A
|
124ceb585bd8f343f913e45771f431ef40f8eac3 | remove vestigial comment | motmot/wxglvideo/demo.py | motmot/wxglvideo/demo.py | import wx
import wx.xrc as xrc
import pkg_resources
import numpy
from pygarrayimage.arrayimage import ArrayInterfaceImage
import motmot.wxglvideo.wxglvideo as vid
RESFILE = pkg_resources.resource_filename(__name__,"demo.xrc") # trigger extraction
RES = xrc.EmptyXmlResource()
RES.LoadFromString(open(RESFILE).read())... | Python | 0 | @@ -4368,40 +4368,8 @@
ay )
-%0A #gl_canvas.OnDraw()
%0A%0Ade
|
f2391e33d9aaed0aa61f486ed228fd1387af79db | Remove unused import. | rhythmbox.py | rhythmbox.py | # -*- coding: utf-8 -*-
#
# Copyright (C) 2009 Phil Sung, Samson Yeung
#
# This file is part of Zeya.
#
# Zeya 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 you... | Python | 0 | @@ -764,18 +764,8 @@
os%0A
-import re%0A
impo
|
6821e8b88ae5964b4c79a634e04c3a239d6c1428 | add test option | mriqc/utils/mriqc_run.py | mriqc/utils/mriqc_run.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: oesteban
# @Date: 2015-11-19 16:44:27
# @Last Modified by: oesteban
# @Last Modified time: 2016-05-06 11:14:22
"""
=====
MRIQC
=====
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __futur... | Python | 0.000004 | @@ -1785,16 +1785,149 @@
raph.')%0A
+ g_input.add_argument('--test-run', action='store_true', default=False,%0A help='Do not run the workflow.')%0A
g_in
@@ -4717,24 +4717,58 @@
te_graph()%0A%0A
+ if not opts.test_run:%0A
work
@@ -4826,24 +4826,46 @@
t_id is None
+ ... |
2b71a5facded00f44f23712346391ec35a67c5c8 | Compress textual resources in memory cache http server. | telemetry/telemetry/core/memory_cache_http_server.py | telemetry/telemetry/core/memory_cache_http_server.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import BaseHTTPServer
import os
import SimpleHTTPServer
import SocketServer
import sys
class MemoryCacheHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRe... | Python | 0.00003 | @@ -177,24 +177,41 @@
eHTTPServer%0A
+import mimetypes%0A
import os%0Aim
@@ -263,16 +263,28 @@
ort sys%0A
+import zlib%0A
%0A%0Aclass
@@ -940,16 +940,20 @@
ength',
+str(
resource
@@ -971,16 +971,17 @@
ength'%5D)
+)
%0A sel
@@ -1078,24 +1078,105 @@
odified'%5D))%0A
+ if resource%5B'zipped'%5D:%0A s... |
1c10ac092eee185bdf853309c7b759d48550a359 | add missing things to PICKLE_SAFE. fixes #423 | webapp/graphite/util.py | webapp/graphite/util.py | """Copyright 2008 Orbitz WorldWide
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software... | Python | 0 | @@ -2784,32 +2784,131 @@
et(%5B'object'%5D),%0A
+ 'graphite.intervals': set(%5B'Interval', 'IntervalSet'%5D),%0A 'collections': set(%5B'deque'%5D),%0A
%7D%0A%0A @clas
@@ -3640,24 +3640,123 @@
'object'%5D),%0A
+ 'graphite.intervals': set(%5B'Interval', 'IntervalSet'%5D),%0A 'collections': s... |
76f7f84c320722ba1b969fa132196dcdf0132664 | Change empty label for admin supplier module edit | shoop/admin/modules/suppliers/views/edit.py | shoop/admin/modules/suppliers/views/edit.py | # -*- coding: utf-8 -*-
# This file is part of Shoop.
#
# Copyright (c) 2012-2015, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django import forms
from djang... | Python | 0 | @@ -1034,15 +1034,10 @@
(_(%22
-Default
+No
%25s
@@ -1081,16 +1081,8 @@
ame)
-.title()
%0A
|
7eda70728e3acd8eff2ce51dad774661e16260de | add some features to the prototype | prototypes/data.py | prototypes/data.py | """This file provides abstraction over the source of data used in the server"""
import random
import json
class DataSource:
"""This class abstracts the underlying system that stores the computed
features about the developers"""
def __init__(self):
pass
class RandomData(DataSource):
def __in... | Python | 0 | @@ -100,16 +100,32 @@
rt json%0A
+import datetime%0A
%0A%0Aclass
@@ -1683,24 +1683,436 @@
ic_repos'%5D%0A%0A
+ created = datetime.datetime.strptime(dev%5B'created_at'%5D,%0A %22%25Y-%25m-%25dT%25H:%25M:%25SZ%22)%0A updated = datetime.datetime.strptime(dev%5B... |
cc9fd6e1b34c334d218fcacbf3399c8ffa79c66c | rename a variable to prevent shadowing | cs251tk/referee/__main__.py | cs251tk/referee/__main__.py | from tempfile import gettempdir
import sys
import os
from ..common import chdir
from ..specs import load_some_specs
from .args import process_args
from .process_student import process_student
from .parse_commits import parse_commits_for_assignments
from .emailify import emailify
from .send_email import send_email
de... | Python | 0.00001 | @@ -1827,16 +1827,21 @@
email
+_blob
= email
@@ -1938,16 +1938,21 @@
il(email
+_blob
)%0A
@@ -2069,10 +2069,15 @@
nt(email
+_blob
)%0A
|
a474cca425218cefb6efd39813d1c098bf1417cd | Use PEP-440 compliant version | provider/__init__.py | provider/__init__.py | __version__ = "0.2.7-depop6"
| Python | 0 | @@ -17,13 +17,16 @@
.2.7
--
++
depop
-6
+.6.1
%22%0A
|
75ad8f5b695638be75c27997c349297f681ef68c | fix return value from --version flag | nodepy/main.py | nodepy/main.py | """
The Node.py command-line interface.
"""
from nodepy.utils import pathlib
from nodepy.loader import PythonModule
import argparse
import code
import os
import pdb
import nodepy
import sys
try:
from urllib.parse import urlparse
except ImportError:
from urllib2 import urlparse
VERSION = 'node.py {} [{} {}]'.form... | Python | 0.000001 | @@ -845,17 +845,17 @@
return
-1
+0
%0A%0A sys.
|
a2daf4a378cb379399f82c8b8df70c5b08c321f9 | fix #3 (thanks to natim) | publishall.py | publishall.py | #!/usr/bin/env python
"""allows you to publish on all your repositories.
Requirements:
mercurial
Use:
hg pusha
You can also use hg pushall
Installation:
Add the following entry to the [extensions] bloc of your .hg/hgrc config.
publishall = /path/to/publishall.py
"""
from mercurial.i18n import _
from mercurial impo... | Python | 0 | @@ -14,17 +14,19 @@
v python
-%0A
+%0D%0A%0D
%0A%22%22%22allo
@@ -68,17 +68,19 @@
itories.
-%0A
+%0D%0A%0D
%0ARequire
@@ -85,16 +85,17 @@
rements:
+%0D
%0Amercuri
@@ -100,14 +100,17 @@
rial
-%0A
+%0D%0A%0D
%0AUse:
+%0D
%0Ahg
@@ -114,16 +114,17 @@
hg pusha
+%0D
%0AYou can
@@ -143,17 +143,19 @@
pushall
-%0A... |
f6cdaa2bba182fc4e333aeb5ee427032d6120742 | fix another unicode decode error | mygpo/web/views/users.py | mygpo/web/views/users.py | #
# This file is part of my.gpodder.org.
#
# my.gpodder.org 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.
#
# my.gpodder.org i... | Python | 0.000402 | @@ -6662,19 +6662,23 @@
equest,
-str
+unicode
(e))%0A%0A
|
47bbd11c02d72a350ea4fd8dc89d46935b7bc04d | disable flaky test for Python3.6 and lower | test/test_pipeline/components/feature_preprocessing/test_kernel_pca.py | test/test_pipeline/components/feature_preprocessing/test_kernel_pca.py | import unittest
from sklearn.linear_model import RidgeClassifier
from autosklearn.pipeline.components.feature_preprocessing.kernel_pca import \
KernelPCA
from autosklearn.pipeline.util import _test_preprocessing, PreprocessingTestCase, \
get_dataset
import sklearn.metrics
class KernelPCAComponentTest(Preproc... | Python | 0 | @@ -1,12 +1,23 @@
+import sys%0A
import unitt
@@ -341,16 +341,100 @@
tCase):%0A
+ @unittest.skipIf(sys.version_info %3C (3, 7), 'Random failures for Python %3C 3.7')%0A
def
|
14d53ec241a5faeb2234775ede5f938a67823038 | remove broken django_sha2 hashers and use django defaults | pto/settings/base.py | pto/settings/base.py | # This is your project's main settings file that can be committed to your
# repo. If you need to override a setting locally, use settings_local.py
from funfactory.settings_base import *
## Internationalization.
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of... | Python | 0.000002 | @@ -3478,16 +3478,504 @@
?!?!%0A%7D%0A%0A
+# because we use LDAP users only, we never have to store real passwords,%0A# we don't need django_sha2 so go back to Django defaults%0APASSWORD_HASHERS = (%0A 'django.contrib.auth.hashers.PBKDF2PasswordHasher',%0A 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',%... |
f90468dca99a2d9b1ca9933b4f8d9195cc28e44b | fix around lsof which sometimes does not return socket status for UDP sockets | psutil/_psposix.py | psutil/_psposix.py | #!/usr/bin/env python
#
# $Id$
#
"""Routines common to all posix systems."""
import os
import errno
import subprocess
import psutil
import socket
import re
try:
from collections import namedtuple
except ImportError:
from compat import namedtuple # python < 2.6
from psutil import AccessDenied, NoSuchProcess... | Python | 0.000003 | @@ -5361,15 +5361,51 @@
elds
-%5B'TST'%5D
+.get('TST', %22%22) # might not appear for UDP
%0A
|
83c27f57611d71fe6261b4419a8fbba70a4836f3 | Add additonal comment for try-except in Game.initArea | pylletTown.py | pylletTown.py | import pygame
import tmx
class Player(pygame.sprite.Sprite):
def __init__(self, location, *groups):
super(Player, self).__init__(*groups)
self.image = pygame.image.load('sprites/player.png')
self.imageDefault = self.image.copy()
self.rect = pygame.Rect(location, (64,64))
self.orient = 'down'
self.holdTim... | Python | 0 | @@ -4953,16 +4953,73 @@
bjects)%0A
+%09%09# In case there is no sprite layer for the current map%0A
%09%09except
|
57b743a411d673842bbf60dc7cf09e27bd8bfe2f | increase verbosity | run-tests.py | run-tests.py | #!/usr/bin/env python3
"""Run the tests with https://pytest.org."""
import platform
import sys
import pytest
ARGS = [#'--pdb',
#'--exitfirst',
]
if platform.system() == 'Windows' and 'idlelib' in sys.modules:
ARGS += ['--capture=sys', '--color=no']
sys.exit(pytest.main(ARGS + sys.argv[1:]))
| Python | 0.000011 | @@ -63,16 +63,31 @@
rg.%22%22%22%0A%0A
+import pathlib%0A
import p
@@ -94,16 +94,16 @@
latform%0A
-
import s
@@ -121,16 +121,47 @@
pytest%0A%0A
+SELF = pathlib.Path(__file__)%0A%0A
ARGS = %5B
@@ -318,47 +318,134 @@
'%5D%0A%0A
-sys.exit(pytest.main(ARGS + sys.argv%5B1:%5D
+%0Aprint('run', %5BSELF.name%5D + sys.ar... |
d3cbcfa3d134ef7ce158f229eff75a83418afc52 | Write the extraction script properly. | tools/dmqmc/extract_n_k.py | tools/dmqmc/extract_n_k.py | #!/usr/bin/env python
'''Extract the momentum distribution from a analysed DMQMC simulation.'''
import pandas as pd
import numpy as np
import sys
# [review] - JSS: use if __name__ == '__main__' and functions so code can easily be reused in another script if necessary.
if (len(sys.argv) < 2):
print ("Usage: extra... | Python | 0.000001 | @@ -58,16 +58,17 @@
n from a
+n
analyse
@@ -146,132 +146,30 @@
ys%0A%0A
-# %5Breview%5D - JSS: use if __name__ == '__main__' and functions so code can easily be reused in another script if necessary.%0A%0A
+%0Adef main(args):%0A%0A
if (
@@ -188,16 +188,20 @@
) %3C 2):%0A
+
prin
@@ -238,16 +238,20 @@
... |
fadeb71775c66aadf57e880186fc0878104568ab | Delete nova.endpoint module, which used Tornado to serve up the Amazon EC2 API. Replace it with nova.api.ec2 module, which serves up the same API via a WSGI app in Eventlet. Convert relevant unit tests from Twisted to eventlet. | run_tests.py | run_tests.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compli... | Python | 0 | @@ -1573,16 +1573,69 @@
twistd%0A%0A
+#TODO(gundlach): rewrite and readd this after merge%0A#
from nov
|
71647b64ca6cb29ab7f21127df4378721fea328d | Fix run_tests.py on windows | run_tests.py | run_tests.py | import sys
import os
import signal
import unittest
import subprocess
import time
import shlex
cmd = 'python -m pretenders.server.server --host 127.0.0.1 --port 50000'
p = subprocess.Popen(shlex.split(cmd))
time.sleep(2)
# Force saves to be done in temp directory
os.environ["XDG_CONFIG_HOME"] = os.path.join(os.path.di... | Python | 0.000006 | @@ -737,24 +737,65 @@
2)%0A try:%0A
+%0A if sys.platform == %22linux%22:%0A
os.k
|
95e011ce93a38fb0157ad07aee8f7ad0df6e9315 | exit with code error if failures | run_tests.py | run_tests.py | from os import getcwd
from sys import path as ppath
ppath.insert(1,getcwd()+'/modules') # TODO: win32 compatibilite (python path)
import unittest
from lifegame.test.LifeGameTestSuite import LifeGameTestSuite
from tests.TestSuite import TestSuite
# TODO: Lister les tests ailleurs ? Recuperer les suite de tests de modu... | Python | 0.000006 | @@ -655,13 +655,22 @@
r()%0A
-exit(
+test_result =
runn
@@ -685,11 +685,68 @@
unnable)
+%0A%0Aif test_result.failures or test_result.errors:%0A exit(1
)%0A%0A
|
ea41856f32e78b367681060d9f0790a209c8165e | change run host | runserver.py | runserver.py | # -*- coding: utf-8 -*-
from projectname.app import app
if(__name__ == "__main__"):
app.debug = app.config["DEBUG_MODE"]
app.run()
| Python | 0.000001 | @@ -140,11 +140,25 @@
app.run(
+host='0.0.0.0'
)%0D%0A
|
2dc57094577175e3a925e3601f4aef52ead58585 | remove \r | qdb/models.py | qdb/models.py | from sqlalchemy import Column, Integer, Text, DateTime, Boolean
from qdb.database import Base
import re
class Quote(Base):
__tablename__ = 'quotes'
id = Column(Integer, primary_key=True)
body = Column(Text)
submitted_at = Column(DateTime)
approved = Column(Boolean)
score = Column(Integer)
def __init__(self, b... | Python | 0.000057 | @@ -817,16 +817,94 @@
, quote)
+%0A%09%09# remove windows-style newline characters%0A%09%09quote = quote.replace('%5Cr', '')
%0A%0A%09%09retu
|
3c573218ddcf0e732d226cae80bea55d44a0deb4 | change template | runserver.py | runserver.py | # coding=utf-8
from bottle import route, run, install, template, error, static_file
from bottle_sqlite import SQLitePlugin
# carrega o banco de dados pelo plugin do Bottle
install(SQLitePlugin(dbfile='site.db'))
@error(404)
def error404(error):
# pagina de erros
return 'Nothing here, sorry'
@route('/static... | Python | 0.000001 | @@ -860,16 +860,19 @@
e('vagas
+_bo
', vagas
|
10042226bf0f0be21686a7a5e5fec8579dd7e8ff | Convert given default parameter to int explicitly. | numberutils.py | numberutils.py | ##-*- coding: utf-8 -*-
#!/usr/bin/python
"""
Utilities related to Number.
"""
import math
import unittest
__author__ = 'SeomGi, Han'
__credits__ = ['SeomGi, Han']
__copyright__ = 'Copyright 2015, Python Utils Project'
__license__ = 'MIT'
__version__ = '0.0.3'
__maintainer__ = 'SeomGi, Han'
__email__ = 'iandmyhand@gm... | Python | 0.00003 | @@ -2142,32 +2142,36 @@
lf._int_value =
+int(
int_value%0A
@@ -2155,32 +2155,33 @@
= int(int_value
+)
%0A self._s
|
da27dc2d476ca3876901ea6ef514f245a18af6ec | Update utils.py | pogom/utils.py | pogom/utils.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import getpass
import argparse
import re
import uuid
import os
import json
from datetime import datetime, timedelta
import ConfigParser
from . import config
from exceptions import APIKeyException
def parse_unicode(bytestring):
decoded_string = bytestring.deco... | Python | 0.000001 | @@ -2697,32 +2697,195 @@
default=False)%0A
+ parser.add_argument('-fl', '--fixed-location', help='Hides the search bar for use in shared maps.', action='store_true', default=False, dest='fixed_location')%0A
parser.add_a
|
59920c85da22327c14a3b21bb3388732fc723c91 | Check status | devicehive/api_response.py | devicehive/api_response.py | class ApiResponse(object):
"""Api response class."""
SUCCESS_STATUS = 'success'
ID_KEY = 'requestId'
ACTION_KEY = 'action'
STATUS_KEY = 'status'
CODE_KEY = 'code'
ERROR_KEY = 'error'
def __init__(self, response, key=None):
self._id = response.pop(self.ID_KEY)
self._acti... | Python | 0 | @@ -552,16 +552,37 @@
if not
+self._success or not
key:%0A
|
674f4d8e48eb0d764217d4c849818dc5c0daa5a2 | update version to 0.5.3 | obp/version.py | obp/version.py | __version__ = "0.5.2"
| Python | 0.000001 | @@ -16,7 +16,7 @@
0.5.
-2
+3
%22%0A
|
79877893b3da42389c649ae31df80d121d6c552c | Fix precedence of `not equal` (!=), assign precedences to `is/in`. | parse/core.py | parse/core.py | import collections
from . import tree
from . import libparse
class Parser (libparse.Parser):
# Whether to use indentation to delimit blocks in parentheses
#
# Requires ALLOW_BREAKS_IN_PARENTHESES
#
# on indent @ unindent
# off any indent in parentheses is ignored
#
ALLOW_IND... | Python | 0.000131 | @@ -1183,10 +1183,46 @@
'
-/=
+!=': -9,%0A 'is': -9,%0A 'in
':
|
0a989b028a1e470a8c3422e601cdca60fb0ddf4a | Convert csvsort to agate, closes #495 | csvkit/utilities/csvsort.py | csvkit/utilities/csvsort.py | #!/usr/bin/env python
import os
import agate
from csvkit import table
from csvkit.cli import CSVKitUtility, parse_column_identifiers
class CSVSort(CSVKitUtility):
description = 'Sort CSV files. Like the Unix "sort" command, but for tabular data.'
def add_arguments(self):
self.argparser.add_argumen... | Python | 0.999487 | @@ -27,50 +27,25 @@
ort
-os%0A%0Aimport agate%0A%0Afrom csvkit
+agate%0A
import
-table
+six%0A
%0Afro
@@ -319,24 +319,25 @@
dest='sniff
+_
limit', type
@@ -1371,217 +1371,125 @@
elf.
-input_file.name != '%3Cstdin%3E':%0A # Use filename as table name%0A table_name = os.path.splitext(os.pa... |
50ccb50e2fd3d1518d2c0269a6342241cd832bbf | Update reference for fixing the audio driver for the VoiceHAT. | checkpoints/check_audio.py | checkpoints/check_audio.py | #!/usr/bin/env python3
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | Python | 0 | @@ -4456,36 +4456,49 @@
rd.
-Please try reinstalling
+Refer to HACKING.md for%0Ahow to setup
the
-%0A
+
voic
@@ -4513,88 +4513,33 @@
ver:
-%22%22%22))%0A print(' cd ~/drivers-raspi && sudo ./install.sh && sudo reboot'
+ https://git.io/v99yK%22%22%22)
)%0A
|
48c440a6e93e4c91568383d1adedafb1a430ba81 | Placeholder about dialog | visram/pyqtapp.py | visram/pyqtapp.py | #!/usr/bin/env python3
"""GUI portion of Visram."""
from PyQt5 import QtGui, QtWidgets, QtCore
import matplotlib.cm as cmx
from matplotlib import colors
import sys
import time
import processes
class VisramMainWindow(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
self.initUI()
... | Python | 0.997109 | @@ -598,24 +598,193 @@
program%22)%0A%0A
+ def showAbout():%0A QtWidgets.QMessageBox.about(%0A self, %22About Visram%22, %22About Text%22)%0A%0A aboutAction.triggered.connect(showAbout)%0A%0A
help
|
a8bae77c4a096f54414062b7c5a4d9afc75682ec | Handle binary artifacts in Python 3 | telemetry/telemetry/internal/results/artifact_compatibility_wrapper.py | telemetry/telemetry/internal/results/artifact_compatibility_wrapper.py | # Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Compatibility layer for using different artifact implementations through a
# single API.
# TODO(https://crbug.com/1023458): Remove this once artifact imple... | Python | 0.000009 | @@ -403,16 +403,27 @@
mport os
+%0Aimport six
%0A%0Afrom t
@@ -1568,24 +1568,114 @@
ame, data):%0A
+ if six.PY2 or isinstance(data, bytes):%0A mode = 'w+b'%0A else:%0A mode = 'w+'%0A
with sel
@@ -1710,16 +1710,27 @@
act(name
+, mode=mode
) as f:%0A
|
bea80411c13ed72b1e7d5a5ac79fdba64b4b4661 | Add star graph for sparse.csgraph.dijkstra benchmark | benchmarks/benchmarks/sparse_csgraph_djisktra.py | benchmarks/benchmarks/sparse_csgraph_djisktra.py | """benchmarks for the scipy.sparse.csgraph module"""
import numpy as np
import scipy.sparse
from .common import Benchmark, safe_import
with safe_import():
from scipy.sparse.csgraph import dijkstra
class Dijkstra(Benchmark):
params = [
[30, 300, 900],
[True, False]
]
param_names = ['n... | Python | 0 | @@ -285,16 +285,44 @@
, False%5D
+,%0A %5B'random', 'star'%5D
%0A %5D%0A
@@ -354,16 +354,26 @@
in_only'
+, 'format'
%5D%0A%0A d
@@ -390,32 +390,40 @@
elf, n, min_only
+, format
):%0A rng =
@@ -451,16 +451,51 @@
g(1234)%0A
+ if format == 'random':%0A
@@ -530,16 +530,20 @@... |
59406b0b191a2a1d47d2d56b4c61cabdd8613f6f | Add compound role | chemdataextractor/model.py | chemdataextractor/model.py | # -*- coding: utf-8 -*-
"""
chemdataextractor.model
~~~~~~~~~~~~~~~~~~~~~~~
Data model for extracted information.
:copyright: Copyright 2016 by Matt Swain.
:license: MIT, see LICENSE file for more details.
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_functio... | Python | 0.00026 | @@ -465,16 +465,29 @@
ringType
+, BooleanType
%0Afrom sc
@@ -4061,24 +4061,71 @@
default=%5B%5D)%0A
+ roles = ListType(StringType(), default=%5B%5D)%0A
nmr_spec
@@ -7206,28 +7206,345 @@
n False%0A return True%0A
+%0A @property%0A def is_id_only(self):%0A %22%22%22Return True if identifie... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.