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 |
|---|---|---|---|---|---|---|---|
7876322f2ae4b7a306ac7ad4d61a2a10c0638be6 | fix randomization test | sympy/combinatorics/polyhedron.py | sympy/combinatorics/polyhedron.py | from sympy.core import Basic, Tuple, FiniteSet
from sympy.core.sympify import sympify
from sympy.combinatorics import Permutation
from sympy.utilities.misc import default_sort_key
from random import choice
class Polyhedron(Basic):
"""
Represents the Polyhedral symmetry group.
It is one of the symmetry gr... | Python | 0.000027 | @@ -3385,16 +3385,31 @@
e_perm(3
+, seed=range(3)
)%0A
@@ -3429,16 +3429,16 @@
(%5B1,
- 3,
0, 2
+, 3
%5D)%0A%0A
@@ -5150,16 +5150,122 @@
n times
+.%0A%0A %60%60seed%60%60 is used to set the seed for the random selection%0A of permutations from pgroups.
%0A
@@ -5471,16 +5471,46 @@
up... |
e519b05d5137764b298c471e3b3566a25cb859d0 | Add depth first search | python_practice/graph/undirectedGraph.py | python_practice/graph/undirectedGraph.py |
class undirectedGraph(object):
def __init__(self, degrees):
self.degrees = degrees
self.adjacent_matrix = []
for i in range(degrees):
self.adjacent_matrix.append([0]*degrees)
def __str__(self):
output = ""
for row in self.adjacent_matrix:
for item in row:
output += "|"+str(item)
output += "|\... | Python | 0.000005 | @@ -460,8 +460,339 @@
x1%5D+=1%0A%0A
+ def isTree(self):%0A%09 %09return True%0A%0A%09def depthFirstSeach(self, start_vertex, finded_vertexes):%0A%09%09for node in range(self.degrees):%0A%09%09%09if self.adjacent_matrix%5Bstart_vertex%5D%5Bnode%5D != 0:%0A%09%09%09%09finded_vertexes.append(node)%0A%09%09%09%0... |
ba64752915055014cf586ab854d64a6e30dc1690 | Add hours_since and minutes_since | coffee/models.py | coffee/models.py | import redis
from datetime import datetime
from coffee.config import app_config
class Status (object):
def __init__(self):
self.redis = redis.Redis(
host=app_config['REDIS_HOST'],
port=app_config['REDIS_PORT'],
password=app_config['REDIS_PW']
)
try:
... | Python | 0.999814 | @@ -468,32 +468,206 @@
%25Y-%25m-%25d %25H:%25M')
+%0A span = datetime.now() - self.last_start%0A self.hours_since = (span.days*24)+(span.seconds//3600)%0A self.minutes_since = (span.seconds//60)%2560
%0A%0A def save(s
@@ -947,16 +947,178 @@
%25H:%25M')
+%0A span = datetim... |
73e2c6e7ec1bc3623b2aebdf9d0f826f6d298ef6 | Update face detect script | esper/query/management/commands/face_detect.py | esper/query/management/commands/face_detect.py | from django.core.management.base import BaseCommand
from query.base_models import ModelDelegator
from scannerpy import Database, DeviceType, Job
from scannerpy.stdlib import parsers, pipelines
import os
import cv2
import math
import random
DATASET = os.environ.get('DATASET')
models = ModelDelegator(DATASET)
Video, Lab... | Python | 0 | @@ -1333,171 +1333,116 @@
-# Choose stride based on framerate (3 frames / second)%0A c = db.new_collection('tmp', filtered, force=True)%0A faces_c = pipelines.detect_faces(
+faces_c = pipelines.detect_faces(%0A db, %5Bdb.table(path).column('frame') for path in filtered%5D,
%0... |
ded9217b55e1c0afdec4579cef133d8ae8be9553 | Disable debug logfile in automated ci tests | raiden/tests/integration/cli/conftest.py | raiden/tests/integration/cli/conftest.py | import os
import sys
from copy import copy
import pexpect
import pytest
from raiden.settings import RED_EYES_CONTRACT_VERSION
from raiden.tests.utils.smoketest import setup_raiden, setup_testchain
@pytest.fixture(scope='session')
def testchain_provider():
testchain = setup_testchain(print_step=lambda x: None)
... | Python | 0 | @@ -2010,24 +2010,59 @@
_address'%5D,%0A
+ '--disable-debug-logfile',%0A
%5D%0A%0A f
|
e82888c92c80a9985f8c31d1afebe79914cb55f9 | Fix usage of default-graph for POST and introduce POST_FORM | rdflib/plugins/stores/sparqlconnector.py | rdflib/plugins/stores/sparqlconnector.py | import logging
from urllib.request import urlopen, Request
from urllib.parse import urlencode
from urllib.error import HTTPError, URLError
import base64
from io import BytesIO
from rdflib.query import Result
from rdflib import BNode
log = logging.getLogger(__name__)
class SPARQLConnectorException(Exception):
p... | Python | 0.000001 | @@ -1924,16 +1924,29 @@
, %22POST%22
+, %22POST_FORM%22
):%0A
@@ -2008,17 +2008,28 @@
GET%22
- or
+, %22POST%22,
%22POST
+_FORM
%22')%0A
@@ -2269,22 +2269,8 @@
= %7B
-%22query%22: query
%7D%0A
@@ -2804,24 +2804,60 @@
d == %22GET%22:%0A
+ params%5B%22query%22%5D = query%0A
@@ -3... |
1363c54be71cfa67e6da09e4b8d7b346dbeea789 | Add doc | examples/coherent_velocimeter.py | examples/coherent_velocimeter.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import initExample
from lase.core import KClient
from lase.drivers import Spectrum
import numpy as np
from scipy import signal
import matplotlib.pyplot as plt
import peakutils
class CoherentVelocimeter:
def __init__(self, lambda_opt=1.55E-6):
self.lambd... | Python | 0 | @@ -254,89 +254,368 @@
-%0A def __init__(self, lambda_opt=1.55E-6):%0A self.lambda_opt = lambda_opt
+%22%22%22 Coherent velocitor based on the Spectrum bitstream%0A %22%22%22%0A %0A def __init__(self, lambda_opt=1.55E-6):%0A %22%22%22%0A Args:%0A - lambda_opt: O... |
2bd9fc58866b9768a838518a39580c847d4bb18c | Add support for any characters in would you rather questions. | plugins/wyr.py | plugins/wyr.py | """ Would you rather? This plugin includes would you rather functionality
"""
import random
import re
import discord
import plugins
from pcbot import Config
client = plugins.client # type: discord.Client
db = Config("would-you-rather", data=dict(timeout=10, responses=["Registered {choice}, {name}!"], questions=[]... | Python | 0 | @@ -361,22 +361,17 @@
pile(r%22(
-%5B%5Cw%5Cs%5D
+.
+)(?:%5Cs+
@@ -387,12 +387,10 @@
s+(%5B
-%5Cw%5Cs
+%5E?
%5D+)%5C
|
7cc3a43739936b23d8cae2536f819d7ad0b92f44 | remove unused variables | plyer/utils.py | plyer/utils.py | '''
Utils
=====
'''
__all__ = ('platform', )
from os import environ
from os import path
from sys import platform as _sys_platform
_platform_ios = None
_platform_android = None
class Platform(object):
# refactored to class to allow module function to be replaced
# with module variable
def __init__(sel... | Python | 0.000014 | @@ -131,55 +131,8 @@
rm%0A%0A
-_platform_ios = None%0A_platform_android = None%0A%0A
%0Acla
|
351c7645c43e217d9173362f0939648fd2c6123f | Fix Siri VM test | busstops/management/tests/test_import_sirivm.py | busstops/management/tests/test_import_sirivm.py | import os
from vcr import use_cassette
# from mock import patch
from django.test import TestCase
from ...models import DataSource
# with patch('time.sleep', return_value=None):
from ..commands import import_sirivm
@use_cassette(os.path.join('data', 'vcr', 'import_sirivm.yaml'), decode_compressed_response=True)
class ... | Python | 0.000132 | @@ -36,33 +36,8 @@
tte%0A
-# from mock import patch%0A
from
@@ -102,55 +102,8 @@
rce%0A
-# with patch('time.sleep', return_value=None):%0A
from
@@ -137,16 +137,54 @@
irivm%0A%0A%0A
+class SiriVMImportTest(TestCase):%0A
@use_cas
@@ -277,42 +277,8 @@
ue)%0A
-class SiriVMImportTest(TestCase):%0A
@@ -605,1... |
159fa9d96a2182b9cf445f60c18fe465a298d5fb | Fix test logic | readthedocs/search/tests/test_proxied_api.py | readthedocs/search/tests/test_proxied_api.py | import pytest
from readthedocs.search.tests.test_api import BaseTestDocumentSearch
@pytest.mark.proxito
@pytest.mark.search
class TestProxiedSearchAPI(BaseTestDocumentSearch):
host = 'pip.readthedocs.io'
@pytest.fixture(autouse=True)
def setup_settings(self, settings):
settings.PUBLIC_DOMAIN = ... | Python | 0.000626 | @@ -173,16 +173,88 @@
arch):%0A%0A
+ # This project slug needs to exist in the %60%60all_projects%60%60 fixture.%0A
host
@@ -261,11 +261,12 @@
= '
-pip
+docs
.rea
|
8e1992b9a8a3f7c3835f87038da8f3fac7b0f1fd | Fix error when a gallery is empty in stuartmccall.ca theme | common/utils.py | common/utils.py | from django.utils.html import format_html
from markdown import markdown
from sorl.thumbnail import get_thumbnail
IMAGE_STYLES = {
'thumb': {
'width': 80,
'height': 80,
'crop': 'center',
'upscale': False,
'quality': 95,
'progressive': False,
'srcset': [1, 1.5... | Python | 0 | @@ -963,16 +963,34 @@
xist%22)%0A%0A
+ if image:%0A
retu
@@ -1030,16 +1030,46 @@
_kwargs)
+%0A else:%0A return None
%0A%0Adef ge
|
3d3325f5ad654b8b14f0935883eaab579fc13780 | bump version | backslash/__version__.py | backslash/__version__.py | __version__ = "2.4.0"
| Python | 0 | @@ -16,7 +16,7 @@
2.4.
-0
+1
%22%0A
|
21d7bebba7422b8fa821665f062e4c35b137f2d7 | support party identifier for Spain | account_banking_pain_base/company.py | account_banking_pain_base/company.py | # -*- encoding: utf-8 -*-
##############################################################################
#
# PAIN Base module for OpenERP
# Copyright (C) 2013 Akretion (http://www.akretion.com)
# Copyright (C) 2013 Noviat (http://www.noviat.com)
# @author: Alexis de Lattre <alexis.delattre@akretion.com>
# ... | Python | 0.000006 | @@ -2137,24 +2137,151 @@
ce(' ', '')%0A
+ if company_vat and company_vat%5B0:2%5D.upper() in %5B'ES'%5D:%0A party_identifier = company.sepa_creditor_identifier%0A
retu
|
ee6637dd9d63227a018b8a24ddae88a64a758f70 | bump version | Atomic/__init__.py | Atomic/__init__.py | import sys
from .pulp import PulpServer
from .config import PulpConfig
from .atomic import Atomic
__version__ = "1.1"
def writeOut(output, lf="\n"):
sys.stdout.flush()
sys.stdout.write(str(output) + lf)
def push_image_to_pulp(image, server_url, username, password, verify_ssl,
docker_... | Python | 0 | @@ -109,17 +109,17 @@
__ = %221.
-1
+2
%22%0A%0A%0Adef
|
87eb311d812af6cc7297dbdabe41b51ef16fc6e9 | Remove useless code. Leancloud can not get real IP | towerslack.py | towerslack.py | # coding: utf-8
import sys
import json
import requests
from werkzeug.wrappers import BaseRequest
try:
import gevent
except ImportError:
gevent = None
print('gevent is not available')
HOMEPAGE = 'https://github.com/lepture/tower-slack'
TOWER_ICON = (
'https://tower.im/assets/mobile/icon/'
'icon@5... | Python | 0.000005 | @@ -156,45 +156,8 @@
None
-%0A print('gevent is not available')
%0A%0AHO
@@ -3261,110 +3261,8 @@
n)%0A%0A
- if req.path == '/ip':%0A return response(start_response, body=str(req.remote_addr))%0A%0A
|
0fc759a2142c2733b74ae5283ef46b29c31dd94f | update version number | pythonpath/mytools_Mri/values.py | pythonpath/mytools_Mri/values.py | # Copyright 2011 Tsutomu Uchino
#
# 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 ... | Python | 0.000002 | @@ -670,17 +670,17 @@
ON = '1.
-0
+1
.0'%0AMRI_
|
58653f0c43557e0a5fc91302b8c5ab35d57417a3 | Version 1.5: Automated new automation package generation | attila/__init__.py | attila/__init__.py | """
Automation framework.
"""
from . import abc, db, fs, notifications, security
from . import configurations, context, exceptions, plugins, strings
__author__ = 'Aaron Hosford'
__author_email__ = 'Aaron.Hosford@Ericsson.com'
__description__ = 'Saint Attila: Automation Library'
__long_description__ = __... | Python | 0.000001 | @@ -155,16 +155,39 @@
gs%0D%0A%0D%0A%0D%0A
+__version__ = '1.5'%0D%0A%0D%0A
__author
@@ -280,21 +280,24 @@
= '
-Saint
Attila:
+ A Python
Aut
@@ -308,15 +308,17 @@
ion
-Library
+Framework
'%0D%0A_
@@ -649,31 +649,8 @@
a'%0D%0A
-__version__ = '1.4.1'%0D%0A
__pa
@@ -729,24 +729,50 @@
ttila.fs',%0D%0A
+ 'a... |
0a5009112bc6834438a30fbd7629cceb15e7d7af | Add test to ensure PetPoint import copes with different animals sharing the same name. | bvspca/animals/tests/test_sync_petpoint_data.py | bvspca/animals/tests/test_sync_petpoint_data.py | import datetime
import pytest
from django.core.management import call_command
from lxml import etree
from wagtail.core.models import Page
from bvspca.animals.petpoint import extract_animal_ids, extract_animal, extract_animal_adoption_dates
from bvspca.animals.models import Animal
@pytest.fixture(scope='session')
de... | Python | 0 | @@ -1316,16 +1316,544 @@
07476%0A%0A%0A
+@pytest.mark.django_db(transaction=False)%0Adef test_create_animals_from_petpoint_data_with_duplicate_names():%0A # first animal%0A animal_one = create_animal_object()%0A retrieved_animal_one = Animal.objects.get(pk=animal_one.pk)%0A assert retrieved_animal_one.petp... |
d83e8acbd13da3fb7303b6914d1ebe76ec549174 | Change 'action_invoice_draft' method to keep the date. | account_ux/models/account_invoice.py | account_ux/models/account_invoice.py | ##############################################################################
# For copyright and license notices, see __manifest__.py file in module root
# directory
##############################################################################
from odoo import models, fields, api, _
from odoo.exceptions import UserE... | Python | 0 | @@ -3554,20 +3554,16 @@
-
%5D),%0A
@@ -3567,32 +3567,303 @@
)
+%0A return res%0A%0A @api.multi%0A def action_invoice_draft(self):%0A invoice_data = %5B(x, x.date) for x in self.filtered('date')%5D%0A res = super(AccountInvoice, self).action_invoice_draft()%0... |
6d50d0ad1c6032c059ba53ef930792a14509bfa2 | Use deterministic ordering for appinfo.json. | ide/utils/sdk.py | ide/utils/sdk.py | import json
__author__ = 'katharine'
def generate_wscript_file(project, for_export=False):
jshint = project.app_jshint
wscript = """
#
# This file is the default set of rules to compile a Pebble project.
#
# Feel free to customize this to your needs.
#
try:
from sh import CommandNotFound, jshint, cat, E... | Python | 0 | @@ -4015,16 +4015,32 @@
', ': ')
+, sort_keys=True
) + %22%5Cn%22
|
27851abc94147270f1e67ce13b153c494dca0f8b | fix hm attribute name in sg | acos_client/v30/slb/service_group.py | acos_client/v30/slb/service_group.py | # Copyright 2014, Jeff Buttars, A10 Networks.
#
# 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 appli... | Python | 0.996807 | @@ -2093,23 +2093,21 @@
%22health-
-monitor
+check
%22: hm_na
|
a29563dab552d45a8ec6766246bacf4af2d16246 | Remove newimages method from ClosedSite | pywikibot/site/_obsoletesites.py | pywikibot/site/_obsoletesites.py | """Objects representing obsolete MediaWiki sites."""
#
# (C) Pywikibot team, 2019-2021
#
# Distributed under the terms of the MIT license.
#
import pywikibot
from pywikibot.exceptions import NoPage
from pywikibot.site._apisite import APISite
from pywikibot.site._basesite import BaseSite
from pywikibot.tools import rem... | Python | 0.000001 | @@ -2125,162 +2125,4 @@
.')%0A
-%0A def newimages(self, *args, **kwargs):%0A %22%22%22An error instead of pointless API call.%22%22%22%0A self._closed_error('No new images can be returned.')%0A
|
4ba41078a2b574fede57e5e4580e6e0f67eac228 | use 12 hour clock on image print | scripts/current/stage4_today_total.py | scripts/current/stage4_today_total.py | """
Sum up the hourly precipitation from NCEP stage IV and produce maps
"""
import pygrib
import datetime
from pyiem.plot import MapPlot
import os
import sys
import pytz
import numpy as np
def doday(ts, realtime):
"""
Create a plot of precipitation stage4 estimates for some day
We should total files... | Python | 0.000006 | @@ -1271,17 +1271,17 @@
ftime(%22%25
-H
+I
:%25M %25p %25
|
b43b18b70cfc82947a198394cd23b64b62546888 | Use distro_short | actions/create_workroom_test_rule.py | actions/create_workroom_test_rule.py | #! /usr/bin/env python
import argparse
import json
import requests
import sys
INSTALL_URLS = {
'UBUNTU14': 'https://stackstorm.com/install.sh',
'RHEL6': 'https://raw.githubusercontent.com/StackStorm/st2workroom/master/script/bootstrap-st2',
'RHEL7': 'https://raw.githubusercontent.com/StackStorm/st2workroo... | Python | 0.000003 | @@ -1694,24 +1694,103 @@
ease=None):%0A
+ # last 3 chars is distro short%0A distro_short = distros%5Blen(distros)-3:%5D%0A
rule_met
@@ -2813,24 +2813,30 @@
(distro
+_short
, branch),%0A
|
6a1c42fb34826e54a604903b010f71f63a991784 | Update PyPI homepage link (refs #101) | paver/release.py | paver/release.py | """Release metadata for Paver."""
from paver.options import Bunch
from paver.tasks import VERSION
setup_meta=Bunch(
name='Paver',
version=VERSION,
description='Easy build, distribution and deployment scripting',
long_description="""Paver is a Python-based build/distribution/deployment scripting tool a... | Python | 0 | @@ -736,22 +736,16 @@
'http://
-paver.
github.c
@@ -747,16 +747,27 @@
hub.com/
+paver/paver
',%0A p
|
ac0523cbc7b0b545720f9bca157165a8c2675954 | support not json parsable data | pyArango/index.py | pyArango/index.py | import json
from .theExceptions import (CreationError, DeletionError, UpdateError)
class Index(object) :
"""An index on a collection's fields. Indexes are meant to de created by ensureXXX functions of Collections.
Indexes have a .infos dictionary that stores all the infos about the index"""
def __init__(self... | Python | 0.000012 | @@ -1038,16 +1038,29 @@
postData
+, default=str
))%0A
|
2a8cec8ba0ee72a84b88b078f7ac22005bfd07a8 | Fix file paths | code/utils/load_data.py | code/utils/load_data.py | from __future__ import print_function, division
import random
import numpy as np
import pandas as pd
import nibabel as nib
from nums import n_convert
def get_image(s, r):
"""Load .nii file for subject `s` on run `r`
Parameters
----------
s : int
subject number
r : int
run numbe... | Python | 0.000029 | @@ -487,27 +487,24 @@
f_img = '../
-../
data/ds005/s
@@ -1183,27 +1183,24 @@
_cond = '../
-../
data/ds005/s
@@ -2157,19 +2157,16 @@
v = '../
-../
data/ds0
|
8c18cf97ff0ff2a6347865443052913c598d7ee6 | Fix indent in pull request #1042. | misc/ninja_syntax.py | misc/ninja_syntax.py | #!/usr/bin/python
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that already
use Python.
"""
import re
import textwrap
def escape_path(word):
return word.replace('$ ', '$$ ').replace(' ', ... | Python | 0 | @@ -606,24 +606,26 @@
:%0A
+
args%5B'break_
|
de2f12c3433237e2194eab535ba4fd54acb4b487 | fix options in case of term2term answers | proso_flashcards/flashcard_construction.py | proso_flashcards/flashcard_construction.py | from django.core.cache import cache
from functools import reduce
from proso.django.config import instantiate_from_config
from proso.list import flatten
from proso_flashcards.models import FlashcardAnswer, Category, Context, Flashcard
from proso_models.models import Item
import abc
import random
def get_option_set():
... | Python | 0.999995 | @@ -4032,20 +4032,16 @@
-
if fc%5Bke
@@ -4074,20 +4074,16 @@
y_keys:%0A
-
@@ -4215,16 +4215,33 @@
options
+_by_keys.values()
%5D%0A%0A
|
34c7d0c66a5f80ef79df0cea8eca13973b60810e | make long/double fn settable | v3/primitives/pushbutton.py | v3/primitives/pushbutton.py | # pushbutton.py
# Copyright (c) 2018-2020 Peter Hinch
# Released under the MIT License (MIT) - see LICENSE file
import uasyncio as asyncio
import utime as time
from . import launch
from primitives.delay_ms import Delay_ms
# An alternative Pushbutton solution with lower RAM use is available here
# https://github.com... | Python | 0.002243 | @@ -1450,96 +1450,357 @@
rgs%0A
-%0A def long_func(self, func, args=()):%0A self._lf = func%0A self._la = args
+ if self._df:%0A self._dd = Delay_ms(self._ddto)%0A else:%0A self._dd = False%0A%0A def long_func(self, func, args=()):%0A self._lf = func%0A ... |
afac8a69b7d19e689075076705f9ff3ba28d5fa0 | Correct signal variance computation. | pyGPGO/covfunc.py | pyGPGO/covfunc.py | import numpy as np
from scipy.special import gamma, kv
from scipy.spatial.distance import cdist
def l2norm(x, xstar):
return (np.sqrt(np.sum((x - xstar) ** 2, axis=1)))
def l2norm_(X, Xstar):
return cdist(X, Xstar)
class squaredExponential:
def __init__(self, l=1, sigmaf=1.0, bounds=[[10e-4, 10e3], [1... | Python | 0 | @@ -95,87 +95,8 @@
t%0A%0A%0A
-def l2norm(x, xstar):%0A return (np.sqrt(np.sum((x - xstar) ** 2, axis=1)))%0A%0A%0A
def
|
095d8d0136ff3942a9fcc76564a61e17dae56b71 | Fix breakage. The website is looking for user-agent header | goldprice.py | goldprice.py | #!/usr/bin/python
# Maybank Gold Investment Account price scraper
# Using BeautifulSoup package
# Developed and tested on Debian Testing (Jessie)
# Initial development 25 July 2012
# Copyright (C) 2012,2013 Sharuzzaman Ahmat Raslan (sharuzzaman@gmail.com)
#
# This program is free software: you can redistribute it an... | Python | 0.00359 | @@ -986,24 +986,69 @@
me%0A%0A
-website=
+#maybank website looking for user-agent header%0Areq =
urllib2.
urlo
@@ -1047,15 +1047,15 @@
ib2.
-urlopen
+Request
('ht
@@ -1103,16 +1103,85 @@
e.htm')%0A
+req.add_header('User-Agent', 'Mozilla')%0Awebsite=urllib2.urlopen(req)%0A
data=web
|
a2582b3352582034af1b8dff99d4ac39a15d9b54 | Fix script to pass pep8 | shuffler.py | shuffler.py | #!/usr/bin/env python3
import argparse
import random
import sys
DESCRIPTION = '''Shuffle the arguments received, if called without arguments
the lines read from stdin will be shuffled and printed to
stdout'''
def get_list():
return sys.stdin.readlines()
def print_list(list_):
... | Python | 0 | @@ -139,10 +139,9 @@
ents
-
%0A
+
@@ -239,16 +239,17 @@
out'''%0A%0A
+%0A
def get_
@@ -290,16 +290,17 @@
ines()%0A%0A
+%0A
def prin
@@ -329,32 +329,32 @@
elem in list_:%0A
-
print(el
@@ -367,16 +367,17 @@
rip())%0A%0A
+%0A
def main
@@ -607,16 +607,17 @@
list_)%0A%0A
+%0A
if __nam
|
a77d7a89960dbf0f90c746a88cf3fc2d168fe38b | entities should be pandas dataframe | ddf_utils/chef/procedure/merge.py | ddf_utils/chef/procedure/merge.py | # -*- coding: utf-8 -*-
"""merge procedure for recipes"""
import fnmatch
import logging
import time
import warnings
from collections import Mapping, Sequence
from typing import Dict, List, Optional, Union
import numpy as np
import pandas as pd
import dask.dataframe as dd
from ddf_utils.chef.cook import Chef
from .... | Python | 0.999996 | @@ -5374,18 +5374,8 @@
d(df
-.compute()
, ig
|
99d03ebf6e3ad6d66354c4245f1d5cc0f222ae67 | debug print | pyamg/__init__.py | pyamg/__init__.py | """PyAMG: Algebraic Multigrid Solvers in Python"""
from __future__ import absolute_import
import numpy as np
import re
import scipy as sp
from .version import version_tuple as __version_tuple__
from .version import version as __version__
from .multilevel import coarse_grid_solver, multilevel_solver
from .classical i... | Python | 0.000003 | @@ -510,16 +510,41 @@
rnings%0A%0A
+print(__version_tuple__)%0A
__git_re
|
019745ca24c238488a4be2b490dc8f4847bf70ff | fix HELP_ROOT_URL | src/chapter1/minspect.py | src/chapter1/minspect.py | import pymel.core as pmc
import sys
import types
def syspath():
print 'sys.path:'
for p in sys.path:
print ' ' + p
def info(obj):
"""Prints information about the object."""
lines = ['Info for %s' % obj.name(),
'Attributes:']
# Get the name of all attributes
for a in ob... | Python | 0.000029 | @@ -3335,17 +3335,17 @@
en_us/Py
-M
+m
el')# (2
|
9926e94aea511904ce4d8a5fd6a738e5a9ba26d0 | Remove deprecated html escaping code (#533) | pybatfish/util.py | pybatfish/util.py | # coding=utf-8
# Copyright 2018 The Batfish Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless requi... | Python | 0.000001 | @@ -902,19 +902,8 @@
son%0A
-import six%0A
from
@@ -6665,135 +6665,23 @@
ml(s
-):%0A # type: (str) -%3E str%0A if six.PY2:%0A from cgi import escape%0A%0A return escape(s, quote=True)%0A else:%0A
+: str) -%3E str:%0A
@@ -6705,20 +6705,16 @@
escape%0A%0A
-
retu
|
7f356e3191344ad300f8b59f35e861833d09f693 | Fix typo | avedata/avedata.py | avedata/avedata.py | import os
import connexion
from flask import Flask, request, session, g, redirect, url_for, abort, \
render_template, flash
from flask_corse import CORS
connexion_app = connexion.App(__name__, specification_dir='../')
app = connexion_app.app
CORS(app)
app.config.update(dict(
DATABASE='ave.db'
))
app.conf... | Python | 0.999999 | @@ -137,17 +137,16 @@
ask_cors
-e
import
|
a556674523972bf4cb1f9cced73e6783bcf2f492 | update load and transform function to simplify data | inaworld/data.py | inaworld/data.py | """Load the corpus of data.
"""
import re
import pandas as pd
import toolz as tz
def strlst_to_lststr(genres):
"""Convert a string of list entries to a list of lowercase strings.
Examples
--------
>>> strlst_to_lststr('["Banking Hijinks", "Actuarial adventure"]')
['banking hijinks', "actuarial a... | Python | 0 | @@ -76,16 +76,75 @@
as tz%0A%0A
+from . import utils%0A%0ADEFAULT_DATA_PATH = 'movie_data.csv'%0A%0A
%0Adef str
@@ -909,16 +909,21 @@
oad(path
+=None
):%0A %22
@@ -1031,217 +1031,578 @@
cts%0A
+%0A
-%22%22%22%0A%0A def tx(d):%0A return tz.merge(d, %7B%0A 'genres': strlst_to_lststr(d%... |
6a83c4808d7f1104aba832f53bcd25fb98be1686 | Bump to 1.0 dev version | pycrs/__init__.py | pycrs/__init__.py | """
# PyCRS
PyCRS is a pure Python GIS package for reading, writing, and converting between various
common coordinate reference system (CRS) string and data source formats.
- [Home Page](http://github.com/karimbahgat/PyCRS)
- [API Documentation](http://pythonhosted.org/PyCRS)
"""
__version__ = "0.1.4"
from . imp... | Python | 0 | @@ -298,13 +298,17 @@
= %22
-0.1.4
+1.0.0-dev
%22%0A%0A%0A
|
f17971d339c943277afb5d7b2731cd87a23c0a83 | Update documentation of AxesMiddleware | axes/middleware.py | axes/middleware.py | from typing import Callable
from django.conf import settings
from axes.helpers import (
get_lockout_response,
get_failure_limit,
get_client_username,
get_credentials,
)
from axes.handlers.proxy import AxesProxyHandler
class AxesMiddleware:
"""
Middleware that calculates necessary HTTP reque... | Python | 0 | @@ -424,16 +424,242 @@
onses.%0A%0A
+ If a project uses %60django rest framework%60%60 then the middleware updates the%0A request and checks whether the limit has been exceeded. It's needed only%0A for integration with DRF because it uses its own request object.%0A%0A
This
|
c1a9882a91d8914e52d67ccab59c4e4121a93198 | bump version | pygam/__init__.py | pygam/__init__.py | """
GAM toolkit
"""
from __future__ import absolute_import
from pygam.pygam import GAM
from pygam.pygam import LinearGAM
from pygam.pygam import LogisticGAM
from pygam.pygam import GammaGAM
from pygam.pygam import PoissonGAM
from pygam.pygam import InvGaussGAM
__all__ = ['GAM', 'LinearGAM', 'LogisticGAM', 'GammaGAM'... | Python | 0 | @@ -377,10 +377,9 @@
'0.
-2.17
+3.0
'%0A
|
698f07a93dea9b57010b9c3ac33608165123bef5 | Extend timeout. | src/__init__.py | src/__init__.py | import os
import logging
from socket import gethostbyname, gethostname
from kaa import ipc
from client import *
from server import *
__all__ = [ 'connect', 'DEFAULT_EPG_PORT', 'GuideClient', 'GuideServer' ]
# connected client object
_client = None
def connect(epgdb, address='127.0.0.1', logfile='/tmp/kaa-epg.log', ... | Python | 0.999755 | @@ -1098,17 +1098,17 @@
-2
+5
, GuideC
|
3a6aacb27823849ae35a45634c426ae729932b3b | Remove unused import | bin/commands/tuck.py | bin/commands/tuck.py | """Stash specific files."""
import os
import re
import subprocess
import sys
from subprocess import PIPE
import snapshot
from utils import directories, git, messages
def _status(show_color='auto'):
return subprocess.check_output(['git', '-c', 'color.ui=' + show_color, 'status', '--short'])
def _resolve_files(... | Python | 0.000001 | @@ -74,36 +74,8 @@
sys
-%0Afrom subprocess import PIPE
%0A%0Aim
|
9a0bf448d65cddd61836ced26750add19babfb68 | Fix error in setting proto of base_url | pymacaron/test.py | pymacaron/test.py | import os
from pymacaron_unit import testcase
def load_port_host_token():
"""Find out which host:port to run acceptance tests against,
using the environment variables PYM_SERVER_HOST, PYM_SERVER_PORT
"""
server_host, server_port, token = (None, None, None)
if 'PYM_SERVER_HOST' in os.environ:
... | Python | 0 | @@ -1233,14 +1233,23 @@
ort
-==
+in (443, '
443
+')
els
|
46e71ba47059892638720cb3183f8321b945445c | Update test | tests/render/test_page_renderer.py | tests/render/test_page_renderer.py | import json
import pypandoc
from great_expectations.render.renderer import (
ExpectationSuitePageRenderer,
ProfilingResultsPageRenderer,
ValidationResultsPageRenderer
)
def test_ExpectationSuitePageRenderer_render_asset_notes():
# import pypandoc
# print(pypandoc.convert_text("*hi*", to='html', f... | Python | 0.000001 | @@ -5005,18 +5005,10 @@
0.7.
-9__develop
+10
%22%0A
@@ -5070,23 +5070,23 @@
09-1
-8T201035.118325
+9T203700.240912
Z%22%0A
|
08a1c46d99211776b43788efc97539329af66953 | Fix request method (POST) | backend-app/app.py | backend-app/app.py | from __future__ import absolute_import
import json
import os
from urlparse import urlparse
from flask import Flask, render_template, request, redirect, session
from flask_sslify import SSLify
from rauth import OAuth2Service
import requests
app = Flask(__name__, static_folder='static', static_url_path='')
app.request... | Python | 0 | @@ -2726,34 +2726,35 @@
cts', methods=%5B'
-GE
+POS
T'%5D)%0Adef product
|
5fbde9ebf820b09e6bf84d9495a7a66aa1a92eec | update version 0.11.6 | pymzn/__init__.py | pymzn/__init__.py | # -*- coding: utf-8 -*-
"""PyMzn is a Python library that wraps and enhances the MiniZinc tools for CSP
modelling and solving. It is built on top of the libminizinc library (version
2.0) and provides a number of off-the-shelf functions to readily solve problems
encoded in MiniZinc and evaluate the solutions into Python... | Python | 0 | @@ -518,9 +518,9 @@
.11.
-5
+6
'%0A__
|
1d1ac3fa0538bba2135627b972d268c90b8d3051 | Add exception | blckur/exceptions.py | blckur/exceptions.py | class TestException(Exception):
pass
class TestStatusFailed(TestException):
pass
class TestExpectFailed(TestException):
pass
| Python | 0.000556 | @@ -27,32 +27,80 @@
ion):%0A pass%0A%0A
+class TestCheckFailed(TestException):%0A pass%0A%0A
class TestStatus
|
9c038b210b6ce1edb29e1a0bef62524f567bd788 | Fix template lookup description (#55557) | lib/ansible/plugins/lookup/template.py | lib/ansible/plugins/lookup/template.py | # Copyright: (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# Copyright: (c) 2012-17, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
lookup... | Python | 0 | @@ -510,117 +510,158 @@
-
-this is mostly a noop, to be used as a with_list loop when you do not want the content transformed in any way
+Returns a list of strings; for each template in the list of templates you pass in, returns a string containing the results of processing that template
.%0A
|
a74d1cced778282182bfc50ca11dc91592337081 | Fix unit test due to change r15911. | tests/gcl_unittest.py | tests/gcl_unittest.py | #!/usr/bin/python
# Copyright (c) 2009 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.
"""Unit tests for gcl.py."""
import StringIO
import os
import sys
import unittest
# Local imports
import gcl
class GclTestsBase(uni... | Python | 0.000008 | @@ -2568,11 +2568,11 @@
), 1
-718
+813
)%0A
|
41de1454875edde375bc8933efc76b1ae765e6ef | add error handler for dbapi. when there is an exception in the db layer, this handler gets called instead of after_execute. | tomograph/tomograph.py | tomograph/tomograph.py | # Copyright (c) 2012 Yahoo! 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/licenses/LICENSE-2.0 Unless required by
# applicable law or agree... | Python | 0 | @@ -4666,16 +4666,266 @@
- pass
+return handler%0A%0Adef dbapi_error(name):%0A def handler(conn, cursor, statement, parameters, context, exception):%0A if not config.db_tracing_enabled:%0A return%0A annotate('database exception %7B0%7D'.format(exception))%0A stop('execute')
... |
f4a4b161d881f7c1970e8f111d2e02ee6d19a488 | Correct buffer tests | tests/sentry/buffer/redis/tests.py | tests/sentry/buffer/redis/tests.py | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import mock
from sentry.buffer.redis import RedisBuffer
from sentry.models import Group, Project
from sentry.testutils import TestCase
class RedisBufferTest(TestCase):
def setUp(self):
self.buf = RedisBuffer(hosts={
0: {'db': 9}... | Python | 0.000004 | @@ -1737,68 +1737,8 @@
%7D)%0A
- group = Group.objects.create(project=Project(id=1))%0A
@@ -1798,16 +1798,9 @@
k':
-group.pk
+1
%7D%0A
|
50a481a68365effde25a6c3df60f0e9daf1bed72 | fix bestfit case when index is datetimeindex | cufflinks/pandastools.py | cufflinks/pandastools.py | import pandas as pd
import re
def _screen(self,include=True,**kwargs):
"""
Filters a DataFrame for columns that contain the given strings.
Parameters:
-----------
include : bool
If False then it will exclude items that match
the given filters.
This is the same as passing a regex ^keyword
kwargs : ... | Python | 0.999815 | @@ -1537,16 +1537,129 @@
els%22 )%0A%0A
+%09if isinstance(self.index, pd.DatetimeIndex):%0A%09%09x=pd.Series(list(range(1,len(self)+1)),index=self.index)%0A%09else:%0A%09
%09x=self.
@@ -1671,16 +1671,19 @@
.values%0A
+%09%09%0A
%09x=sm.ad
|
843c0a6701b26685d9cd2ec799c78ad44e718de0 | change coding style | cupy/logic/comparison.py | cupy/logic/comparison.py | from cupy import core
from cupy.creation.from_data import asanyarray
from numpy import complex64, complex128
_is_close = core.create_ufunc(
'cupy_is_close',
('eeee?->?', 'ffff?->?', 'dddd?->?'),
'''
bool equal_nan = in4;
if (isfinite(in0) && isfinite(in1)) {
out0 = fabs(in0 - in1) <= in3 + i... | Python | 0.000001 | @@ -1,81 +1,37 @@
-from cupy import core%0Afrom cupy.creation.from_data import asanyarra
+import numpy%0A%0Aimport cup
y%0Afrom
-num
+cu
py i
@@ -38,35 +38,18 @@
mport co
-mplex64, complex128
+re
%0A%0A%0A_is_c
@@ -2626,16 +2626,21 @@
a =
+cupy.
asanyarr
@@ -2653,16 +2653,21 @@
b =
+cupy.
asanyarr
@@... |
f9f2ab2ae65f8ba65c431dbfa6810c079e21972e | Allow move to be False if not assigned | purchase_discount/models/purchase_order.py | purchase_discount/models/purchase_order.py | # Copyright 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright 2016 ACSONE SA/NV (<http://acsone.eu>)
# Copyright 2015-2019 Tecnativa - Pedro M. Baeza
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl).
from odoo import api, fields, models
class PurchaseOrder(models.Model):
_inherit = "purchase.ord... | Python | 0.000033 | @@ -3480,16 +3480,22 @@
lf, move
+=False
):%0A
|
a510d20cebe2aff86a6bf842d063b5df8937a7ec | Update site and project names for pylons integration. Fix behavior of empty lists. Add DSN. | raven/contrib/pylons/__init__.py | raven/contrib/pylons/__init__.py | """
raven.contrib.pylons
~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from raven.middleware import Sentry as Middleware
from raven.base import Client
class Sentry(Middleware):
def __init__(self, app, config):
... | Python | 0 | @@ -242,16 +242,153 @@
lient%0A%0A%0A
+def list_from_setting(config, setting):%0A value = config.get(setting)%0A if not value:%0A return None%0A return value.split()%0A%0A%0A
class Se
@@ -579,52 +579,219 @@
-client = Client(%0A servers=
+servers = config.get('sentry_servers')%0A ... |
21815e95dbe48651ba793b25bce11c799c3cf296 | Fix 'threads can only be started once' issue | pystemon/proxy.py | pystemon/proxy.py | import logging.handlers
import threading
import time
import random
import os
logger = logging.getLogger('pystemon')
class ThreadProxyList(threading.Thread):
'''
Threaded file listener for proxy list file. Modification to the file results
in updating the proxy list.
'''
def __init__(self, proxies_l... | Python | 0.000001 | @@ -2158,30 +2158,8 @@
ue)%0A
- t.start()%0A
|
9cafe3e641a010cb78361b4339e2213c9fa4f6b4 | Update test_divide_cell_by_plane.py | tests/test_divide_cell_by_plane.py | tests/test_divide_cell_by_plane.py | from __future__ import absolute_import
import mimpy.mesh.hexmesh as hexmesh
import numpy as np
import unittest
class TestCellDivide(unittest.TestCase):
def test_single_hex_cell_1(self):
normals = [np.array([1., 0., 0.]),
np.array([0., 1., 0.]),
np.array([0.,... | Python | 0.000009 | @@ -33,16 +33,17 @@
import%0A%0A
+#
import m
@@ -71,16 +71,17 @@
hexmesh%0A
+#
import n
|
06c9e1c47ca37903fd98fc83f80a67baa2a2c5e8 | use rstrip | readthedocs/search/parse_json.py | readthedocs/search/parse_json.py | """Functions related to converting content into dict/JSON structures."""
import codecs
import json
import logging
from pyquery import PyQuery
log = logging.getLogger(__name__)
def generate_sections_from_pyquery(body):
"""Given a pyquery object, generate section dicts for each section."""
# Capture text in... | Python | 0.000001 | @@ -3083,16 +3083,28 @@
.strip()
+.rstrip('.')
for tex
|
8e7660bdd782d7490e9948ddf9e6fdab61630c41 | Make a default UnitConv object that returns the input value unchanged. | pytac/load_csv.py | pytac/load_csv.py | """Module to load the elements of the machine from csv files.
The csv files are stored in one directory with specified names:
* elements.csv
* devices.csv
* families.csv
* unitconv.csv
* uc_poly_data.csv
* uc_pchip_data.csv
"""
from __future__ import print_function
import sys
import os
import csv
import pytac
... | Python | 0 | @@ -397,16 +397,58 @@
ctions%0A%0A
+UNIT_UNITCONV = units.PolyUnitConv(%5B1, 0%5D)
%0AELEMENT
@@ -6730,24 +6730,21 @@
-units.UnitConv()
+UNIT_UNITCONV
)%0A%0A
|
602c04c400b53524dfaa67bbc649b5ccee905074 | support create featureset from pytorch dataloader creator functions. (#2630) | python/dllib/src/bigdl/dllib/utils/nest.py | python/dllib/src/bigdl/dllib/utils/nest.py | #
# Copyright 2018 Analytics Zoo Authors.
#
# 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... | Python | 0 | @@ -1174,16 +1174,21 @@
turn %5Bt.
+data.
numpy()
|
826429100092f449f73827bff3098f74ed4b0eff | Fix trakt_list test | tests/test_trakt_list_interface.py | tests/test_trakt_list_interface.py | from __future__ import unicode_literals, division, absolute_import
import pytest
from flexget.entry import Entry
from flexget.manager import Session
from flexget.plugins.api_trakt import TraktUserAuth
from flexget.plugins.list.trakt_list import TraktSet
@pytest.mark.online
class TestTraktList(object):
"""
C... | Python | 0.000001 | @@ -1350,22 +1350,29 @@
='White
-c
+C
ollar
+ (2009)
')%0A%0A
|
cc894fea8e357f4bfdb3b34cf249f9f0ca817aff | make sample number a required argument in pair-test.py | pair-test.py | pair-test.py | #!/usr/bin/python3
import sys, os
import subprocess as sp
import numpy as np
import matplotlib.pyplot as plt
if len(sys.argv) not in [3,4]:
print("usage: {} cutoff_start cutoff_end [samples]".format(sys.argv[0]))
exit(1)
start = int(sys.argv[1])
end = int(sys.argv[2])
try:
samples = sys.argv[3]
except:
... | Python | 0.000015 | @@ -184,17 +184,15 @@
end
-%5B
samples
-%5D
%22.fo
@@ -275,17 +275,8 @@
2%5D)%0A
-try:%0A
samp
@@ -281,16 +281,20 @@
mples =
+int(
sys.argv
@@ -300,36 +300,9 @@
v%5B3%5D
-%0Aexcept:%0A samples = %22100%22
+)
%0A%0Aif
@@ -835,23 +835,28 @@
ffs%5Bi%5D),
+str(
samples
+)
%5D)%0A%0A
|
212a20bd21b4b9c23b471aa1eb2d7a1485992631 | Add regression test for fd.o #15198 | tests/twisted/test-capabilities.py | tests/twisted/test-capabilities.py |
"""
Test capabilities.
"""
import dbus
from twisted.words.xish import domish
from servicetest import match
from gabbletest import go, make_result_iq
basic_caps = [
(2, u'org.freedesktop.Telepathy.Channel.Type.Text', 3, 0),
]
def make_presence(from_jid, type, status):
presence = domish.Element((None, 'pres... | Python | 0 | @@ -2575,16 +2575,270 @@
ny more%0A
+%0A # regression test for fd.o #15198: getting caps of invalid handle crashed%0A try:%0A caps_iface(data%5B'conn'%5D).GetCapabilities(%5B31337%5D)%0A except dbus.DBusException, e:%0A pass%0A else:%0A assert False, %22Should have had an error!%22%0A%... |
28154b14aae40aa9e961d97151aaab024c93a37b | Add batch_emails sending | manage.py | manage.py | import os
import json
import csv
from flask_script import Manager
from pymongo import MongoClient
from forum import app
import wget
manager = Manager(app)
client = MongoClient(host=os.environ.get('MONGODB_URI'))
db = client.get_default_database()
@manager.command
def split_companies():
fs = os.path.join(os.path... | Python | 0.000001 | @@ -125,16 +125,95 @@
ort wget
+%0Aimport sendgrid%0Afrom sendgrid.helpers.mail import Email, Mail, Personalization
%0A%0Amanage
@@ -319,24 +319,766 @@
atabase()%0A%0A%0A
+@manager.command%0Adef batch_emails():%0A recipients = %5B'elmehdi.baha@forumorg.org'%5D%0A me = 'no-reply@forumorg.org'%0A subject = 'M... |
595c6a01601422fd8cd25a8818be6c02a564acfd | Fix out-of-date names in oauth_utils | d4s2_auth/oauth_utils.py | d4s2_auth/oauth_utils.py | import requests
from requests_oauthlib import OAuth2Session
from models import OAuthService
def make_oauth(oauth_service):
return OAuth2Session(oauth_service.client_id,
redirect_uri=oauth_service.redirect_uri,
scope=oauth_service.scope.split())
def authorizatio... | Python | 0.999964 | @@ -1500,42 +1500,8 @@
t()%0A
- state = OAuthState.generate()%0A
@@ -1740,16 +1740,21 @@
et_token
+_dict
(duke_se
|
147f085b17c13c6712abead73f4c9115223b99de | version 0.22 final | src/robotide/version.py | src/robotide/version.py | # Automatically generated by 'package.py' script.
VERSION = 'trunk'
RELEASE = '20100203'
TIMESTAMP = '20100203-154311'
def get_version(sep=' '):
if RELEASE == 'final':
return VERSION
return VERSION + sep + RELEASE
if __name__ == '__main__':
import sys
print get_version(*sys.argv[1:])
| Python | 0 | @@ -59,13 +59,12 @@
= '
-trunk
+0.22
'%0ARE
@@ -72,24 +72,21 @@
EASE = '
-20100203
+final
'%0ATIMEST
@@ -101,18 +101,18 @@
0100
-203-154311
+324-181509
'%0A%0Ad
|
484425c6b3ca98ebea2d7a05071ed6175377264b | fix docs | chainercv/links/model/ssd/multibox_loss.py | chainercv/links/model/ssd/multibox_loss.py | from __future__ import division
import numpy as np
import chainer
import chainer.functions as F
def _elementwise_softmax_cross_entropy(x, t):
assert x.shape[:-1] == t.shape
shape = t.shape
x = F.reshape(x, (-1, x.shape[-1]))
t = F.flatten(t)
return F.reshape(
F.softmax_cross_entropy(x, t... | Python | 0.000001 | @@ -770,16 +770,17 @@
x losses
+.
%0A%0A Th
@@ -814,16 +814,283 @@
in %5B#%5D_.
+%0A This function returns :obj:%60loc_loss%60 and :obj:%60conf_loss%60.%0A :obj:%60loc_loss%60 is a loss for localization and%0A :obj:%60conf_loss%60 is a loss for classification.%0A The formulas of these losses can be fo... |
e91a8ebe5858d6ce039f64fb28cb964ad72faa5c | add a manange command to serve with prod config | manage.py | manage.py | #!/usr/bin/env python
import flask_migrate
import flask_script
from seabus.web.socketio import socketio
from seabus.common.database import db
from seabus.web.web import create_app
from seabus.nmea_listen.listener import listen
app = create_app('Dev')
manager = flask_script.Manager(app)
flask_migrate.Migrate(app, db)... | Python | 0 | @@ -245,11 +245,12 @@
pp('
-Dev
+Prod
')%0Am
@@ -550,16 +550,73 @@
%0A )%0A%0A
+@manager.command%0Adef serveprod():%0A socketio.run(app)%0A%0A
@manager
|
57965873b33a0cf519871a945dd29384efdcc1a0 | Format vendor.bzl with buildifier | tools/bazel/vendor.bzl | tools/bazel/vendor.bzl | """A module defining a repository rule for vendoring the dependencies
of a crate in the current workspace.
"""
load("@rules_rust//rust:repositories.bzl", "load_arbitrary_tool")
load("@rules_rust//rust:defs.bzl", "rust_common")
def _impl(repository_ctx):
# Link cxx repository into @third-party.
lockfile = repo... | Python | 0 | @@ -899,16 +899,17 @@
h%22, %22%22)%0A
+%0A
# Fi
@@ -1080,33 +1080,32 @@
arch64:%0A
-
target_triple =
@@ -1144,17 +1144,16 @@
is_mac:%0A
-
|
98b5d34316917e0bdb26404c6f3816108ce7f42e | Fix more mkdocs path issues | readthedocs/doc_builder/backends/mkdocs.py | readthedocs/doc_builder/backends/mkdocs.py | import os
import logging
import json
import yaml
from django.conf import settings
from django.template import Context, loader as template_loader
from readthedocs.doc_builder.base import BaseBuilder
log = logging.getLogger(__name__)
TEMPLATE_DIR = '%s/readthedocs/templates/mkdocs/readthedocs' % settings.SITE_ROOT
OV... | Python | 0 | @@ -1246,16 +1246,21 @@
+user_
docs_dir
@@ -1266,34 +1266,11 @@
r =
+u
se
-lf.docs_dir(docs_dir=use
r_co
@@ -1289,16 +1289,170 @@
cs_dir')
+%0A if user_docs_dir:%0A user_docs_dir = os.path.join(self.root_path, user_docs_dir)%0A docs_dir = self.docs_dir(docs_dir=user_docs_dir
)%... |
9253641fc47d3a097c7e843adc0522e9daf68f89 | Use new socket location | calico_containers/tests/st/utils/docker_host.py | calico_containers/tests/st/utils/docker_host.py | import os
import sh
from sh import docker
from functools import partial
from subprocess import check_output, CalledProcessError, STDOUT
from calico_containers.tests.st.utils.utils import retry_until_success, get_ip
from workload import Workload
from network import DockerNetwork
CALICO_DRIVER_SOCK = "/usr/share/docker... | Python | 0 | @@ -301,17 +301,11 @@
= %22/
-usr/share
+run
/doc
|
3955aa821415f1e7630b7f1511bcd3609d26334d | fix division name | ca_mb_winnipeg/people.py | ca_mb_winnipeg/people.py | from __future__ import unicode_literals
from utils import CanadianScraper, CanadianPerson as Person
import re
from six.moves.urllib.parse import urljoin
COUNCIL_PAGE = 'http://winnipeg.ca/council/'
class WinnipegPersonScraper(CanadianScraper):
def scrape(self):
page = self.lxmlize(COUNCIL_PAGE, 'utf-8... | Python | 0.99974 | @@ -564,125 +564,183 @@
-# South Winnipeg %E2%80%93 St. Norbert%0A ward = ward.replace('South Winnipeg %E2%80%93 ', '').replace(' - ', '%E2%80%94') # m-dash
+ward = ward.replace(' %E2%80%93 ', '%E2%80%94').replace(' - ', '%E2%80%94') # n-dash, m-dash, hyphen, m-dash%0A ward = ward.replace(... |
87c0fa5c71dd1d9c1591a63165a57a403ee55b45 | simplify test | tests/test_adapter.py | tests/test_adapter.py | from __future__ import print_function
import collections
import imp
import inspect
import unittest
from typing import Iterable
import wrapt
from compat import PY2, PY3, exec_
DECORATORS_CODE = """
import wrapt
def prototype(arg1, arg2, arg3=None, *args, **kwargs): pass
@wrapt.decorator(adapter=prototype)
def adapt... | Python | 0.999302 | @@ -6830,57 +6830,14 @@
-%22%22%22argspec factory stub.%22%22%22%0A argspec =
+return
ins
@@ -6868,35 +6868,8 @@
ped)
-%0A return argspec
%0A%0A
@@ -7109,99 +7109,36 @@
-# Call the function.%0A ret = func(*args, **kwargs)%0A return ret
+return func(*... |
3017a23893a21a7783480c69cecfcabf70c1f446 | Fix tests | tests/test_algolia.py | tests/test_algolia.py | # Copyright 2013-2014 MongoDB, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writin... | Python | 0.000003 | @@ -1527,16 +1527,24 @@
ctor'),
+algolia_
auto_com
@@ -1559,16 +1559,24 @@
rval=0,
+algolia_
commit_s
|
4ebf63772505d562f6b95c6a2a72b8b34fa9686c | Update aligner tests | tests/test_aligner.py | tests/test_aligner.py | import os
import pytest
from aligner.aligner import TrainableAligner
def test_sick_mono(sick_dict, sick_corpus, generated_dir):
a = TrainableAligner(sick_corpus, sick_dict, os.path.join(generated_dir, 'sick_output'),
temp_directory=os.path.join(generated_dir, 'sickcorpus'))
a.train_m... | Python | 0 | @@ -290,34 +290,51 @@
r, 'sickcorpus')
+, skip_input=True
)%0A
-
a.train_mono
@@ -562,32 +562,49 @@
r, 'sickcorpus')
+, skip_input=True
)%0A a.train_tr
@@ -758,32 +758,32 @@
'sick_output'),%0A
-
@@ -847,16 +847,33 @@
corpus')
+, skip_input=True
)%0A a.
|
a3570205c90dd8757a833aed4f4069fbd33028e0 | Remove fixed owner and make loged in user instead | course/views.py | course/views.py | from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse
from mainmodels.models import Category, Course, CourseInCategory
from django.contrib.auth.models import User
# Create your views here.
def createCourse(req):
if req.method == 'POST':
try:
courseName ... | Python | 0 | @@ -159,52 +159,8 @@
ory%0A
-from django.contrib.auth.models import User%0A
# Cr
@@ -531,40 +531,16 @@
r =
-User.objects.get(username='nut')
+req.user
%0A%0A
|
06f9598601a4701bf56b213764d645135ac5815e | Create Asciinema | bears/python/PythonPackageInitBear.py | bears/python/PythonPackageInitBear.py | import os
from coalib.results.Result import Result
from coalib.bears.GlobalBear import GlobalBear
class PythonPackageInitBear(GlobalBear):
LANGUAGES = {'Python', 'Python 3', 'Python 2'}
AUTHORS = {'The coala developers'}
AUTHORS_EMAILS = {'coala-devel@googlegroups.com'}
LICENSE = 'AGPL-3.0'
def... | Python | 0 | @@ -304,16 +304,69 @@
GPL-3.0'
+%0A ASCIINEMA_URL = 'https://asciinema.org/a/151310'
%0A%0A de
|
ee5ef2ae9b146a6fb06fd9891502a8f66af06cce | remove hard coded path | tests/test_biosqlx.py | tests/test_biosqlx.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Tests for `biosqlx` package."""
import unittest
from io import StringIO
from click.testing import CliRunner
from biosqlx import biosqlx
from biosqlx import cli
class TestExportSequence(unittest.TestCase):
"""Tests for `biosqlx` package."""
def setUp(self):... | Python | 0.001619 | @@ -76,16 +76,25 @@
ge.%22%22%22%0A%0A
+import os
%0Aimport
@@ -380,97 +380,140 @@
s
-elf.database_connection_params = %5B'-d', '/home/cts/local/BioSQL-Extensions/tests/test.db'
+qlite3_db_file = os.path.join(os.path.dirname(__file__), 'test.db')%0A self.database_connection_params = %5B'-d', sqlite3_db_fi... |
93295cfc87bfeb62658bdd55feb1ef3ff790a9c2 | change character encoding on file writer in full test | service/tests/functional/test_full.py | service/tests/functional/test_full.py | from octopus.modules.es import testindex
from octopus.core import app
from service import workflow
import codecs, os, time
TEST_SUBMISSION = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "resources", "test_submission.csv")
UPLOAD_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "..", "... | Python | 0 | @@ -2250,24 +2250,32 @@
.csv%22), %22wb%22
+, %22utf8%22
) as f:%0A
|
32a92a8c11631c0b5117fcbaa2c2b73ded11a8b3 | Clarify comment | services/presence2/presenceservice.py | services/presence2/presenceservice.py | # Copyright (C) 2007, Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in... | Python | 0.000034 | @@ -2825,12 +2825,12 @@
': '
-olpc
+blah
@col
|
00e42da665ac25e9d793f331adf4ce58c5bd67b9 | Remove not existing import | tests/test_content.py | tests/test_content.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from logya.content import read, write
def test_read_markdown():
doc = read('tests/fixtures/site/content/markdown.md')
assert isinstance(doc, dict)
assert '/test/markdown/' == doc['url']
| Python | 0.000002 | @@ -73,15 +73,8 @@
read
-, write
%0A%0A%0Ad
|
dd635d5ae86f39b8746de01a1320fe7b970df554 | mark test as "run last" using pytest-ordering | tests/test_corpora.py | tests/test_corpora.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Author: Arne Neumann <discoursegraphs.programming@arne.cl>
from copy import deepcopy
import pkgutil
from tempfile import NamedTemporaryFile, mkdtemp
import networkx as nx
import pytest
import discoursegraphs as dg
from discoursegraphs.corpora import pcc
@pytest.mark.... | Python | 0.000003 | @@ -300,16 +300,73 @@
t pcc%0A%0A%0A
+@pytest.mark.last # this should be the last test to run%0A
@pytest.
|
3410921a133c626f1bdac335b84a8d0292e9c332 | make sure the test actually works | tests/test_datadog.py | tests/test_datadog.py | import logging
import sys
import unittest
from tempfile import NamedTemporaryFile
from checks.datadog import Dogstream
class TestDogstream(unittest.TestCase):
def setUp(self):
self.log_file = NamedTemporaryFile()
self.config = {
'dogstream_log': self.log_file.name
}
... | Python | 0.000004 | @@ -390,16 +390,42 @@
stream')
+, %0A self.config
)%0A
@@ -1923,25 +1923,9 @@
a':
-(1000000002.5, 5)
+5
,%0A
@@ -1955,25 +1955,9 @@
b':
-(1000000002.2, 2)
+2
,%0A
@@ -1986,27 +1986,11 @@
.c':
- (1000000002.2,
47
-)
,%0A
@@ -2584,24 +2584,10 @@
e':
-(
10
-00000002, 10)
%0A
@@ -2... |
86847172f732f2b27a82336f5da1f29592bf6cd6 | Put some parentheses there | monitoring/post_to_slack/src/snapshot_reports.py | monitoring/post_to_slack/src/snapshot_reports.py | # -*- encoding: utf-8
import datetime as dt
import boto3
def pprint_timedelta(seconds):
"""
Returns a pretty-printed summary of a duration as seconds.
e.g. "1h", "2d 3h", "1m 4s".
"""
days, seconds = divmod(seconds, 86400)
hours, seconds = divmod(seconds, 3600)
minutes, seconds = divmo... | Python | 0.000386 | @@ -1600,16 +1600,17 @@
s)%7D ago
+(
%7Blast_mo
@@ -1633,16 +1633,17 @@
ormat()%7D
+)
'%0A
|
109dc7d3813b544f9a971648a042c4730d247d56 | Create bars with color tables | busfactor/counter.py | busfactor/counter.py | from functools import reduce
import sys
import git
import glob
from astropy.table import Table
from tqdm import tqdm
import numpy as np
import matplotlib.pyplot as plt
import subprocess
import datetime
def analyse_file(filename, repo):
commits = repo.iter_commits(paths=filename)
allcommits = [c for c in comm... | Python | 0 | @@ -150,22 +150,109 @@
tlib
-.pyplot as plt
+ as mpl%0Aimport matplotlib.pyplot as plt%0Aimport matplotlib.cm as cm%0Aimport matplotlib.colors as colors
%0Aimp
@@ -1077,24 +1077,296 @@
_lastdate):%0A
+%0A colors_author = np.array(%5Bauthor_lastdate%5Bx%5D for x in author_commits%5B'author'%5D%5D)%0A colors_aut... |
c77e14bb83def8a6922ae485bf4183028cb99bc0 | Bug #50461: Add test with no timeout | tests/test_generic.py | tests/test_generic.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Author: Andreas Büsching <crunchy@bitkipper.net>
#
# test programm for generic notifier implementation
#
# Copyright (C) 2004, 2005, 2006, 2007
# Andreas Büsching <crunchy@bitkipper.net>
#
# This library is free software; you can redistribute it and/or modify
# it und... | Python | 0.997834 | @@ -955,20 +955,545 @@
est_
-generic
+dispatch():%0A%09dispatch = mock.Mock()%0A%09# when no argument is given to init default is GENERIC%0A%09notifier.init(notifier.GENERIC, recursive_depth=5)%0A%09#notifier.timer_add( 0, notifier.Callback( zero, 'hello' ) )%0A%09notifier.dispatcher_add(notifier.Callback(dispatch, 'h... |
6f7890c8b29670f613b6a551ebac2b383f3a7a64 | Test units mismatch in recipe | tests/test_recipes.py | tests/test_recipes.py | import unittest
from brew.constants import IMPERIAL_UNITS
from brew.constants import SI_UNITS
from brew.recipes import Recipe
from fixtures import grain_additions
from fixtures import hop_additions
from fixtures import recipe
class TestRecipe(unittest.TestCase):
def setUp(self):
# Define Grains
... | Python | 0.000001 | @@ -220,16 +220,43 @@
recipe%0A
+from fixtures import yeast%0A
%0A%0Aclass
@@ -438,32 +438,83 @@
hop_additions%0A%0A
+ # Define Yeast%0A self.yeast = yeast%0A%0A
# Define
@@ -912,16 +912,16 @@
ption):%0A
-
@@ -950,24 +950,710 @@
its('bad')%0A%0A
+ def test_grains_units_mismat... |
e9e18bd7769184643375c93259a7afcdaf9a28b8 | Fixed failure by lowering decimal level. | Lib/lib/lapack/tests/esv_tests.py | Lib/lib/lapack/tests/esv_tests.py |
from scipy_test.testing import *
from scipy_base import *
class _test_ev:
def check_syev(self,level=1,sym='sy',suffix=''):
a = [[1,2,3],[2,2,3],[3,3,6]]
exact_w = [-0.6699243371851365,0.4876938861533345,9.182230451031804]
f = getattr(self.lapack,sym+'ev'+suffix)
w,v,info=f(a)
... | Python | 0.999954 | @@ -1053,32 +1053,45 @@
,i%5D),w%5Bi%5D*v%5B:,i%5D
+,self.decimal
)%0A%0A def check
|
59c8c407df2aec220677324b77f5910f25a5d062 | Make binary_accuracy's type-checking stricter | chainer/functions/evaluation/binary_accuracy.py | chainer/functions/evaluation/binary_accuracy.py | import numpy
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class BinaryAccuracy(function.Function):
def check_type_forward(self, in_types):
type_check.expect(in_types.size() == 2)
x_type, t_type = in_types
type_check.expect(
x_type... | Python | 0.000993 | @@ -403,19 +403,16 @@
pe.shape
-%5B0%5D
== x_ty
@@ -423,11 +423,8 @@
hape
-%5B0%5D
,%0A
@@ -573,16 +573,8 @@
ape(
-len(y),
-1)%0A
@@ -599,16 +599,8 @@
ape(
-len(t),
-1)%0A
|
28ae68d405514364855fbdece5b22f636e802d12 | Update versions | cpt/__init__.py | cpt/__init__.py |
__version__ = '0.37.0'
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
from os import getenv
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace("-dev", ""... | Python | 0 | @@ -16,11 +16,15 @@
'0.3
-7
+9
.0
+-dev
'%0A%0A%0A
|
8822c04cee576e1157dde342d505e5c450446429 | fix typooo | base/test_views.py | base/test_views.py | from django.test import TestCase
from django.contrib.staticfiles.testing import StaticLiveServerTestCase
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.urls import reverse
from splinter import Browser
from perfiles_usuario.utils import ADMINISTRADOR_GROUP, CAPTU... | Python | 0.999303 | @@ -5409,20 +5409,25 @@
f.assert
-True
+Redirects
(respons
@@ -5428,26 +5428,50 @@
esponse, reverse('home')
+, target_status_code=302
)%0A
|
d5aef03683f77400cd56160852c650de09d0a8bb | Fix deprecated unittest API usage. | Cython/Build/Tests/TestStripLiterals.py | Cython/Build/Tests/TestStripLiterals.py | from Cython.Build.Dependencies import strip_string_literals
from Cython.TestUtils import CythonTest
class TestStripLiterals(CythonTest):
def t(self, before, expected):
actual, literals = strip_string_literals(before, prefix="_L")
self.assertEquals(expected, actual)
for key, value in liter... | Python | 0 | @@ -262,17 +262,16 @@
ertEqual
-s
(expecte
@@ -397,17 +397,16 @@
ertEqual
-s
(before,
|
3a9684a73c994149728540db706237edda7595c7 | introduce sequence `max_len` during compile | phrasematcher.py | phrasematcher.py | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import io
import re
from collections import defaultdict
class PhraseMatcher(object):
def __init__(self, pattern_file, tokenizer=lambda x: x.split()):
self.tokenizer = tokenizer
self._build_vocab(pattern_file)
self._compile(p... | Python | 0.000001 | @@ -182,16 +182,28 @@
rn_file,
+ max_len=10,
tokeniz
@@ -223,24 +223,24 @@
x.split()):%0A
-
self
@@ -336,16 +336,33 @@
ern_file
+, max_len=max_len
)%0A%0A d
@@ -822,32 +822,44 @@
pile(self, fname
+, max_len=10
):%0A self.
@@ -1204,24 +1204,83 @@
= len(arr)%0A
+ if arr_len %3E max... |
2129d83bcdb8562757924e7c5dd3784e239cbc87 | Fix IPython | phy/utils/cli.py | phy/utils/cli.py | # -*- coding: utf-8 -*-
# flake8: noqa
"""CLI tool."""
#------------------------------------------------------------------------------
# Imports
#------------------------------------------------------------------------------
import logging
import os
import os.path as op
import sys
from traceback import format_excep... | Python | 0.000015 | @@ -1976,40 +1976,65 @@
, '-
-c=%22%7B%7D%22'.format(cmd), '--gui=qt'%5D
+-gui=qt'%5D%0A ns = glob.copy()%0A ns.update(loc)
%0A
@@ -2077,18 +2077,18 @@
user_ns=
-%7B%7D
+ns
)%0A #
|
74b3c7e2a40c8a54ccb9eef06a72040379a6440f | fix sentence bleu | neuralmonkey/trainers/self_critical_objective.py | neuralmonkey/trainers/self_critical_objective.py | """Training objective for self-critical learning.
Self-critic learning is a modifcation of the REINFORCE algorithm that uses the
reward of the train-time decoder output as a baselie in the update step.
For more details see: https://arxiv.org/pdf/1612.00563.pdf
"""
from typing import Callable, Iterable, Tuple
from it... | Python | 0.999999 | @@ -2298,16 +2298,27 @@
ction, %5B
+reference,
train_de
@@ -2318,35 +2318,24 @@
rain_decoded
-, reference
%5D, tf.float3
@@ -2396,16 +2396,27 @@
ction, %5B
+reference,
runtime_
@@ -2426,19 +2426,8 @@
oded
-, reference
%5D, t
@@ -4163,16 +4163,65 @@
ision)%0A%0A
+ assert all(0 %3C= s %3C= 1 for s in bleu_s... |
7e1ed594dadca06c256424f7a950a323138171f3 | Support Conan 1.23 | cpt/__init__.py | cpt/__init__.py |
__version__ = '0.31.1'
NEWEST_CONAN_SUPPORTED = "1.22.200"
def get_client_version():
from conans.model.version import Version
from conans import __version__ as client_version
# It is a mess comparing dev versions, lets assume that the -dev is the further release
return Version(client_version.replace(... | Python | 0 | @@ -16,11 +16,15 @@
'0.3
-1.1
+2.0-dev
'%0ANE
@@ -54,11 +54,11 @@
%221.2
-2.2
+3.0
00%22%0A
|
6a8eaf63e2359da5071a7dfff8de1c80a2e701a5 | add draw_piechart function | physics/tests.py | physics/tests.py | #coding=utf-8
"""
Bar chart demo with pairs of bars grouped for easy comparison.
"""
import numpy as np
import matplotlib.pyplot as plt
plt.rcParams['font.sans-serif'] = ['SimHei'] # set default font
def draw_result(a_num, b_num, c_num, d_num, n_groups):
"""Draw result.
:param a_num: tuple of select A use... | Python | 0.000001 | @@ -203,30 +203,33 @@
%0A%0A%0Adef draw_
-result
+histogram
(a_num, b_nu
@@ -2010,16 +2010,655 @@
png')%0A%0A%0A
+def draw_piechart(question_info):%0A %22%22%22Draw pie chart of each question.%0A%0A :param: question_info is a list of users. eg: %5B12, 23, 43, 13%5D%0A means 12 people select A, 23 s... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.