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 |
|---|---|---|---|---|---|---|---|
d44e4bf7f73ecc68ded083008a2e753410edfa0e | implement name_not_equal_shortName | oparlvalidator/schema.py | oparlvalidator/schema.py | # -*- encoding: utf-8 -*-
from __future__ import (unicode_literals, absolute_import,
division, print_function)
import json
from os.path import dirname, join
with open(join(dirname(__file__), 'schema.json')) as json_file:
OPARL = json.load(json_file)
# Additional validation functions here
... | Python | 0.999222 | @@ -480,29 +480,123 @@
-pass #TODO: implement
+if 'name' not in data or 'nameShort' not in data:%0A return True%0A return not data%5B'name'%5D == data%5B'nameShort'%5D
%0A
|
53ea29812a55a52c1a1b037340a4c4ddb5567197 | Add main method using ArgumentParser | new_editor.py | new_editor.py | #!/usr/bin/python
import json
def new_editors(old_period, new_period):
# new editors list
new_editors = []
# Loading old period json filehandle
data_old = json.load(old_period)["result"]["Individual Results"][0]
# iteration on each user of individual results list
# counts editor w... | Python | 0 | @@ -1408,8 +1408,911 @@
t_new)%0A%0A
+%0Adef main():%0A %22%22%22Main method, entry point of the script.%22%22%22%0A from argparse import ArgumentParser%0A description = %22Computes new editor numbers based on WikiMetrics data%22%0A parser = ArgumentParser(description=description)%0A%0A parser.add_argum... |
652b87210168ea046b76240daee51ba7d12bd27a | Bump version to 0.2.3 | ogn_lib/__init__.py | ogn_lib/__init__.py | from ogn_lib.client import OgnClient # noqa: F401
from ogn_lib.parser import Parser # noqa: F401
from ogn_lib.constants import AirplaneType, AddressType, BeaconType # noqa: F401
__title__ = 'ogn-lib'
__description__ = 'Beacon processor for the OGN data stream.'
__version__ = '0.2.2'
__author__ = 'Anze Kolar'
__auth... | Python | 0.000001 | @@ -278,17 +278,17 @@
= '0.2.
-2
+3
'%0A__auth
|
5e9045584dc0c22305b921cbfbc3e96a9c41db43 | Version Bump | omniture/version.py | omniture/version.py | # 1) we don't load dependencies by storing it in __init__.py
# 2) we can import it in setup.py for the same reason
# 3) we can import it into your module module
__version__ = '0.4.14'
| Python | 0.000001 | @@ -174,11 +174,11 @@
= '0.4.1
-4
+5
'%0A
|
e73d10341d227cd6bc1d5b0e1388b7784dd2dfce | This is a test | create_db.py | create_db.py | #Address Book Program
from sqlalchemy import Column, Integer, String
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import create_engine
Base = declarative_base()
#Contact Model
class Contact(Base):
__tablename__ = 'contact'
id = Column(Integer, primary_key=True)
name = Column(String(250)... | Python | 0.999461 | @@ -156,16 +156,32 @@
engine%0A%0A
+#This is a test%0A
%0ABase =
|
27002e193436aa1ff4acda9decbaf11cb08eb5b6 | version bump for 0.25.8. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.25.7.2'
| Python | 0 | @@ -14,10 +14,8 @@
.25.
-7.2
+8
'%0A%0A
|
747982e6cb3e83083a990b909d56e455ff1568f6 | Fix NamedTemporaryFile file reopen issue on Win #9412 | mesonbuild/mesonlib/vsenv.py | mesonbuild/mesonlib/vsenv.py | import os
import subprocess
import json
import pathlib
import shutil
import tempfile
from .. import mlog
from .universal import MesonException, is_windows
bat_template = '''@ECHO OFF
call "{}"
ECHO {}
SET
'''
# If on Windows and VS is installed but not set up in the environment,
# set it to be runnable. In this w... | Python | 0 | @@ -2401,18 +2401,32 @@
='utf-8'
+, delete=False
)%0A
-
bat_
@@ -2471,16 +2471,37 @@
flush()%0A
+ bat_file.close()%0A
bat_
@@ -2537,20 +2537,16 @@
put(
-str(
bat_file
), u
@@ -2541,17 +2541,21 @@
bat_file
-)
+.name
, univer
@@ -2573,16 +2573,45 @@
s=True)%0A
+ os.unlink(bat_file.name)%0A
b... |
3fc0f46fa96615c59cce044e3e58e502923edae4 | Use cleaner version from cookiecutter OpenStack template | openstack/common/test.py | openstack/common/test.py | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2010-2011 OpenStack Foundation
# 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.... | Python | 0.36222 | @@ -764,16 +764,61 @@
ttools%0A%0A
+_TRUE_VALUES = ('True', 'true', '1', 'yes')%0A%0A
%0Aclass B
@@ -1535,33 +1535,32 @@
lf):%0A if
-(
os.environ.get('
@@ -1583,80 +1583,23 @@
E')
-== 'True' or%0A os.environ.get('OS_STDOUT_CAPTURE') == '1')
+in _TRUE_VALUES
:%0A
@@ -1756,17 +1756,16 @@
... |
cb4856e903649c91d80ccf4679311d4d6c450f86 | Correct path | connect.py | connect.py | import os
import argparse
import signal
import sys
import json
import uuid
from connect_ffi import ffi, lib, C
from console_callbacks import audio_arg_parser, mixer, error_callback, connection_callbacks, debug_callbacks, playback_callbacks, playback_setup
from utils import print_zeroconf_vars
class Connect:
def __... | Python | 0.000347 | @@ -874,15 +874,12 @@
ath.
-dirname
+join
(os.
@@ -875,36 +875,39 @@
th.join(os.path.
-join
+dirname
(os.path.realpat
|
f8b1165e9c96e7e6e555dad0ab27dfe91b8582d1 | Refactor variable name | src/crawler.py | src/crawler.py | from flask import Flask, render_template, request
from pyquery import PyQuery as pq
import pyjade
import requests
import json
TEMPLATE_NAME = "index.jade"
TEMPLATE_FOLDER = "../templates/"
app = Flask(__name__, template_folder=TEMPLATE_FOLDER)
app.jinja_env.add_extension('pyjade.ext.jinja.PyJadeExtension')
app.debug ... | Python | 0.000004 | @@ -1710,19 +1710,31 @@
-daw
+singe_card_href
= r.url
@@ -1770,11 +1770,24 @@
rn %5B
-daw
+single_card_href
%5D%0A%0A
|
8461df5a05473baad1a40918a346fadfdb9e63d6 | Add more standard library modules | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/_stdlib.py | com.ibm.streamsx.topology/opt/python/packages/streamsx/topology/_stdlib.py | #
# Standard library module names:
# https://docs.python.org/3/library/
#
_STD_LIB_MODULES = {
# 6. Text Processing Services',
'string',
're',
'difflib',
'textwrap',
'unicodedata',
'stringprep',
'readline',
'rlcompleter',
# 7. Binary Data Services'
'struct',
'codecs',
... | Python | 0 | @@ -1671,11 +1671,897 @@
'ctypes'
+,%0A%0A # 17. Concurrent Execution%0A 'threading',%0A 'multiprocessing',%0A 'concurrent',%0A 'concurrent.futures',%0A 'subprocess',%0A 'sched',%0A 'queue',%0A 'dummy_threading',%0A '_thread',%0A ' _dummy_thread',%0A%0A # 18. Interprocess Communicat... |
aa1140543a858be8c53fc180c343e1cdd08b182a | version bump for 0.25.11.16. | oneflow/__init__.py | oneflow/__init__.py |
VERSION = '0.25.11.15'
| Python | 0 | @@ -14,12 +14,12 @@
.25.11.1
-5
+6
'%0A%0A
|
08291f3948108da15b9832c495fade04cf2e22c4 | Add test to check title of index | tests/tests.py | tests/tests.py | #!/usr/bin/env python3
from selenium import webdriver
import unittest
class AdminPageTest(unittest.TestCase):
def setUp(self):
self.browser = webdriver.Firefox()
self.browser.implicitly_wait(3)
def tearDown(self):
self.browser.quit()
def test_visit_admin_page(self):
# V... | Python | 0 | @@ -476,16 +476,17 @@
title)%0A%0A
+%0A
class AP
@@ -746,16 +746,319 @@
pass%0A%0A%0A
+class ReactAppTests(unittest.TestCase):%0A%0A def setUp(self):%0A self.browser = webdriver.Firefox()%0A%0A def tearDown(self):%0A self.browser.quit()%0A%0A def test_fetch_index(self):%0A self.browser... |
d1769565f3820e7e7144630b5aa61f6bf4fe2f31 | create Container api (get) | opps/containers/views.py | opps/containers/views.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.core.paginator import Paginator, InvalidPage
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import get_current_site
from django.shortcuts import get_object_or_404
from django.utils import timezone
from django.http import Http4... | Python | 0 | @@ -442,17 +442,16 @@
Channel%0A
-%0A
from opp
@@ -540,93 +540,350 @@
iew%0A
-%0A%0Aclass ContainerList(ListView):%0A model = Container%0A%0A%0Aclass ContainerDetail(Detail
+from opps.api.views.generic.list import ListView as ListAPIView%0Afrom opps.api.views.generic.detail import DetailView as DetailAPIView%0A%0... |
ff1dbbfb83549500a5c0ea1181c8f03fd544a61e | Return True/False from mysql.is_running | osgtest/library/mysql.py | osgtest/library/mysql.py | import os
import re
from osgtest.library import core
from osgtest.library import service
def name():
if core.el_release() < 7:
return 'mysql'
else:
return 'mariadb'
def daemon_name():
if core.el_release() < 7:
return 'mysqld'
else:
return 'mariadb'
def pidfile():
... | Python | 0.999949 | @@ -589,32 +589,39 @@
_running():%0A
+return
service.is_runni
|
9310d1eac242d29e799ae517697a9081152dac68 | Add more messages | tests/utils.py | tests/utils.py | from __future__ import print_function
import boto
import colorama
import subprocess
import sys
from boto.s3.key import Key as S3Key
from boto.exception import NoAuthHandlerFound
from os.path import join, isfile
#
# Output to stdout
#
colorama.init()
def write(*values, **kwargs):
end = kwargs.get('end', '\n')
... | Python | 0 | @@ -2086,24 +2086,73 @@
(ref=None):%0A
+ fail(%22In get_version_from_git ref=%25s%22 %25 ref)%0A
cmd = %5B%22
@@ -2588,17 +2588,42 @@
fail(%22
-T
+In get_version_from_git, t
he versi
|
878aa7b1f6752d988782ef0a4f9fe05a861e163e | Increment version | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = 'thinc'
__version__ = '6.9.1'
__summary__ = "Practical Machine Learning for NLP"
__uri__ = 'https://github.com/explosion/thinc'
__au... | Python | 0.000002 | @@ -210,11 +210,12 @@
'6.
-9.1
+10.0
'%0A__
|
029d556540b8b03b2b260934ca01cd2811cceb99 | Set version to v7.1.0 | thinc/about.py | thinc/about.py | # inspired from:
# https://python-packaging-user-guide.readthedocs.org/en/latest/single_source_version/
# https://github.com/pypa/warehouse/blob/master/warehouse/__about__.py
__name__ = "thinc"
__version__ = "7.1.0.dev0"
__summary__ = "Practical Machine Learning for NLP"
__uri__ = "https://github.com/explosion/thinc"... | Python | 0.00001 | @@ -213,13 +213,8 @@
.1.0
-.dev0
%22%0A__
@@ -431,10 +431,9 @@
_ =
-Fals
+Tru
e%0A
|
8e7375142aa02ee2af2394251d0224faad0df38d | Add check for is_int | thinc/check.py | thinc/check.py | from collections import defaultdict, Sequence, Sized, Iterable
import inspect
import wrapt
from cytoolz import curry
from numpy import ndarray
from .exceptions import UndefinedOperatorError, DifferentLengthError
from .exceptions import ExpectedTypeError, ShapeMismatchError
from .exceptions import ConstraintError
def... | Python | 0.000057 | @@ -2027,158 +2027,730 @@
is_
-array(arg_id, args, func_kwargs, **kwargs):%0A arg = args%5Barg_id%5D%0A if not isinstance(arg, ndarray):%0A raise ExpectedTypeError(arg, %5B'ndarray
+int(arg_id, args, func_kwargs, **kwargs):%0A arg = args%5Barg_id%5D%0A if not isinstance(arg, int):%0A raise E... |
5c4a42ac4ecb586d3fde8272c0c7834d9d614812 | Add a basic TimerThing class to simplify benchmarking stuff | thing/stuff.py | thing/stuff.py | import gzip
from cStringIO import StringIO
try:
import xml.etree.cElementTree as ET
except:
import xml.etree.ElementTree as ET
from thing.models import *
def handle_skillplan_upload(request):
name = request.POST['name'].strip()
uf = request.FILES['file']
visibility = request.POST['visibility']
... | Python | 0 | @@ -5,16 +5,28 @@
rt gzip%0A
+import time%0A
from cSt
@@ -171,16 +171,364 @@
ort *%0A%0A%0A
+class TimerThing:%0A def __init__(self):%0A self.times = %5B%5D%0A self.add_time('start')%0A%0A def add_time(self, name):%0A self.times.append(%5Btime.time(), name%5D)%0A%0A def finished(self):%... |
9f66ac0a6e5b76b024fe4982fad7d2aec9e7d040 | Write output to a file, not just stdout. | convert.py | convert.py | import sys
import tokenizer
import tree
import copy
import string_stream
class VariableAssigner:
def __init__(self, variables):
self._variables = copy.deepcopy(variables)
def next_name(self, kind):
return self._variables[kind].pop(0)
class Convert:
def __init__(self):
self._variables = {}
def s... | Python | 0.000004 | @@ -1886,24 +1886,29 @@
)%0A input =
+open(
sys.argv%5B1%5D%0A
@@ -1906,16 +1906,22 @@
.argv%5B1%5D
+, %22r%22)
%0A outpu
@@ -1924,16 +1924,21 @@
utput =
+open(
sys.argv
@@ -1944,66 +1944,51 @@
v%5B2%5D
-%0A%0A result = Wiki().convert(open(input, %22r%22))%0A print result
+, %22w%22)%0A%0A output.write(Wi... |
2f4820a50b77b9dd150d30c9d9c47daafc9061e0 | Add Hangpoint class - Add Hangpoint class to represent position material is hung from/to. Hangpoint will replace RectRoom's midpoint tuple in future commits | tulle.py | tulle.py | #calculate the length of a hanging strand
# RectRoom object to hang fabric in
class RectRoom(object):
'''
RectRoom(length,width) initiates object that represents a rectangular
room in which fabric will be hung in.
Automatically declares a midpoint of the room to hang fabric from as... | Python | 0 | @@ -133,16 +133,36 @@
th,width
+,height,units='feet'
) initia
@@ -190,16 +190,25 @@
sents a
+%0A
rectangu
@@ -210,24 +210,16 @@
tangular
-%0A
room in
@@ -415,16 +415,36 @@
th,width
+,height,units='feet'
):%0A
@@ -491,24 +491,53 @@
th = width%0A
+ self.height = height%0A
s... |
1bd74f8a597eb2e11280eb008c7da8a8d429f2f0 | Fix response table title | SoftLayer/CLI/autoscale/scale.py | SoftLayer/CLI/autoscale/scale.py | """Scales an Autoscale group"""
# :license: MIT, see LICENSE for more details.
import click
from SoftLayer.CLI import environment
from SoftLayer.CLI import formatting
from SoftLayer.managers.autoscale import AutoScaleManager
from SoftLayer import utils
@click.command()
@click.argument('identifier')
@click.option('-... | Python | 0.029253 | @@ -1560,27 +1560,22 @@
-cancel_date
+status
= resul
@@ -1600,38 +1600,24 @@
'%5D%5B'
-billingItem'%5D%5B'cancellationDat
+status'%5D%5B'keyNam
e'%5D
@@ -1679,27 +1679,22 @@
-cancel_date
+status
= False
@@ -1706,19 +1706,26 @@
if
-cancel_date
+status == 'ACTIVE'
:%0A
@@ -1804,15 +1804,1... |
13f20e294a30a43744356badeb301e28aadde93a | Revert 64 bit storage and use 32 bit again. I didn't notice that we verify that randomly created uids don't already exist in the DB, so the chance of collision isn't really an issue until we get to tens of thousands of machines. Even then we should only expect a few retries before finding a free ID. | nova/utils.py | nova/utils.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 | @@ -4177,10 +4177,10 @@
2**
-64
+32
-1)%0A
|
7dd3b029e76de502b59e0337bb63f8d6c0dcb056 | update migrations for south | cmsplugin_iconlist/migrations/0001_initial.py | cmsplugin_iconlist/migrations/0001_initial.py | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'IconList'
db.create_table(u'cmsplugin_iconlist_iconlist',... | Python | 0 | @@ -553,16 +553,39 @@
ength=32
+, null=True, blank=True
)),%0A
@@ -4577,16 +4577,49 @@
h': '32'
+, 'null': 'True', 'blank': 'True'
%7D)%0A
|
8c6386547380eb0a58110ae3e7ef1550627d92c8 | Fix #1, non OS dependant speech | Stephanie/TextManager/speaker.py | Stephanie/TextManager/speaker.py | import os
import eyed3
import time
from pygame import mixer
class Speaker:
def __init__(self):
self.speak_result = ""
self.audio_file = None
def speak_from_os(self, speech_result_filename):
try:
self.speak_result = self.get_abs_filename(speech_result_filename)
... | Python | 0.000005 | @@ -317,21 +317,142 @@
-os.startfile(
+if sys.platform == %22win32%22:%0A os.startfile(self.speak_result)%0A else:%0A os.system(%22xdg-open %22 +
self
|
74a5c8e58a52963feb3047329f33256903b3bb8c | Create the directory in which we record the training examples. | code/webcam-emotion-recognition/emotionweb.py | code/webcam-emotion-recognition/emotionweb.py | import argparse
import cv2
import os
import scipy
import signal
import sys
import time
import faceRecognition
import ignoreoutput
import emotionrecognition
import cPickle as pickle
# We need this to import other modules
sys.path.append("..")
from lib import deepbelief
WINDOW_NAME = "Emotion recognition"
TIME_BETWEE... | Python | 0 | @@ -4679,16 +4679,162 @@
unt = 0%0A
+%0A # Create the directory in which we record the faces.%0A if not os.path.exists(args.recording_emotion):%0A os.makedirs(args.recording_emotion)%0A%0A
while
|
de98d66f8716b8c71c110f2f57cd3c140cc6d984 | Set version to v2.2.2 | spacy/about.py | spacy/about.py | # fmt: off
__title__ = "spacy"
__version__ = "2.2.2.dev5"
__release__ = True
__download_url__ = "https://github.com/explosion/spacy-models/releases/download"
__compatibility__ = "https://raw.githubusercontent.com/explosion/spacy-models/master/compatibility.json"
__shortcuts__ = "https://raw.githubusercontent.com/explos... | Python | 0.000048 | @@ -48,13 +48,8 @@
.2.2
-.dev5
%22%0A__
|
9e08f137245f524a99db09aff9605c26f0309cf9 | remove unused import | spring/main.py | spring/main.py | from argparse import ArgumentParser
from logger import logger
from spring.settings import WorkloadSettings, TargetSettings
from spring.version import VERSION
from spring.wgen import WorkloadGen
class CLIParser(ArgumentParser):
PROG = 'spring'
USAGE = (
'%(prog)s [-crud PERCENTAGE] [-o #OPS] [-i #ITE... | Python | 0.000001 | @@ -33,33 +33,8 @@
ser%0A
-from logger import logger
%0A%0Afr
|
312e4640d631c80f52b926b2bed31c650d9a6336 | Sort the keys for safety | sparse_list.py | sparse_list.py | #!/usr/bin/env python
'''
Inspired by the post "Populating a sparse list with random 1's" on
StackOverflow:
http://stackoverflow.com/q/17522753/78845
A "sparse list" is a list where most (say, more than 95% of) values will be
None (or some other default) and for reasons of memory efficiency you don't
wish to stor... | Python | 0.998558 | @@ -2371,20 +2371,22 @@
or k in
-list
+sorted
(self.el
|
301bd160ce4891a52b2c9928dd8b8e8282da4cb6 | Clean up old commented code | spiffe_test.py | spiffe_test.py | import docker
import glob
import os
import pytest
class ImageBuilder:
"""A class to build test modules images"""
def __init__(self, docker, modules):
"""Initialize with docker client and a list of modules"""
self._docker = docker
self._modules = modules
self._images = []
def run(self):
"""Discover availa... | Python | 0.000001 | @@ -2373,56 +2373,8 @@
()%0A%0A
-%09# def setup_class(cls):%0A%09# %09_helper.prepare()%0A%0A
%09def
@@ -2428,167 +2428,8 @@
up()
-%0A%09# @pytest.fixture(scope=%22module%22)%0A%09# def suite_helper():%0A%09# %09helper = SuiteHelper(docker.from_env())%0A%09# %09helper.prepare()%0A%09# %09yield helper%0A%09# %09helpe... |
d40049cb81cc83ef69301104065228c62597d666 | Update test.py | com/ggcoke/stocks/test.py | com/ggcoke/stocks/test.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
__author__ = 'ggcoke'
import wmcloud_helper
HOST = 'api.wmcloud.com'
PORT = 9763
TOKEN = 'bc486a2662eb4a2e4d19a0f15abfbddc'
if __name__ == '__main__':
params = {'field': None,
'ticker': '000001',
'secID': None,
'callback': Non... | Python | 0.000001 | @@ -133,40 +133,13 @@
= '
-bc486a2662eb4a2e4d19a0f15abfbddc
+token
'%0A%0A%0A
@@ -624,12 +624,13 @@
'typeName'%5D)
+%0A
|
8599b95d7af44dc243dda67d94df03eef4c24694 | use scaled reward | common/learning_agents.py | common/learning_agents.py | import sys, collections, math, random, copy
import numpy as np
from eligibility_traces import EligibilityTraces
class RLAlgorithm(object):
"""
:description: abstract class defining the interface of a RL algorithm
"""
def getAction(self, state):
raise NotImplementedError("Override me")
de... | Python | 0 | @@ -4929,33 +4929,39 @@
target =
-r
+scaledR
eward%0A
|
17841fcdd486008d71d1cf0406d4690ac739ffe8 | Revert "allow rsyslog to be none" | common/lib/logsettings.py | common/lib/logsettings.py | import os
import platform
import sys
from logging.handlers import SysLogHandler
LOG_LEVELS = ['DEBUG', 'INFO', 'WARNING', 'ERROR', 'CRITICAL']
def get_logger_config(log_dir,
logging_env="no_env",
tracking_filename="tracking.log",
edx_filename="edx.log... | Python | 0.000002 | @@ -3216,32 +3216,259 @@
%0A %7D,%0A
+ 'syslogger-remote': %7B%0A 'level': 'INFO',%0A 'class': 'logging.handlers.SysLogHandler',%0A 'address': syslog_addr,%0A 'formatter': 'syslog_format',%0A %7D,%0A
'new
@@ -4135... |
9f23f6a5d40c7aeec1f4759c0837feb46f90b4ea | 更新 modules Groups 中的 apps.py, 新增函式功能宣告註解 | commonrepo/groups/apps.py | commonrepo/groups/apps.py | # -*- coding: utf-8 -*-
#
# Copyright 2016 edX PDR Lab, National Central University, Taiwan.
#
# http://edxpdrlab.ncu.cc/
#
# 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://w... | Python | 0 | @@ -738,16 +738,85 @@
.org%0A#%0A%0A
+%22%22%22%0AApp configurations for Groups in Common Repository project.%0A%22%22%22%0A%0A
from __f
|
571deee29f35f76e505b7aee58762a67416a490a | fix error | src/15-3Sum.py | src/15-3Sum.py | class Solution(object):
def threeSumDup(self, nums):
"""
:type nums: List[int]
:rtype: List[List[int]]
"""
numDict = {}
for i in xrange(len(nums)):
if numDict.has_key(nums[i]):
numDict[nums[i]].append(i)
else:
nu... | Python | 0.000002 | @@ -1265,32 +1265,40 @@
-for i in xrange(
+i = 0%0A while i %3C
len(nums
@@ -1308,17 +1308,16 @@
ted) - 2
-)
:%0A
@@ -1370,16 +1370,39 @@
d%5Bi-1%5D:%0A
+ i += 1%0A
@@ -2215,32 +2215,51 @@
k -= 1%0A
+ i += 1%0A
return r
@@ -2309,21 +2309... |
de84fa59c4b97835d70de5dc1f4e8b47e3658c36 | fix formatting | ninja/management/commands/export_openapi_schema.py | ninja/management/commands/export_openapi_schema.py | import json
from typing import Any, Optional
from django.core.management.base import BaseCommand, CommandError, CommandParser
from django.urls.base import resolve
from django.utils.module_loading import import_string
from ninja.main import NinjaAPI
from ninja.management.utils import command_docstring
from ninja.respo... | Python | 0.001459 | @@ -1729,16 +1729,28 @@
sorted%22,
+%0A
dest=%22s
@@ -1759,16 +1759,28 @@
t_keys%22,
+%0A
default
@@ -1790,16 +1790,28 @@
lse,
+%0A
action=
'sto
@@ -1806,17 +1806,17 @@
action=
-'
+%22
store_tr
@@ -1821,10 +1821,22 @@
true
-',
+%22,%0A
hel
@@ -1853,16 +1853,17... |
cc412d23662b023357b40539edb481832d9e3a2d | change VERSION to 0.2 beta | rest_framework_gis/__init__.py | rest_framework_gis/__init__.py | VERSION = (0, 1, 0, 'final')
__version__ = VERSION # alias
def get_version():
version = '%s.%s' % (VERSION[0], VERSION[1])
if VERSION[2]:
version = '%s.%s' % (version, VERSION[2])
if VERSION[3:] == ('alpha', 0):
version = '%s pre-alpha' % version
else:
if VERSION[3] != 'final'... | Python | 0.000001 | @@ -11,20 +11,19 @@
(0,
-1
+2
, 0, '
-final
+beta
')%0A_
|
2d71fb157bf53dfde30af5f352656b6de68cba13 | Fix for better test. | exp/sandbox/test/RandomisedSVDTest.py | exp/sandbox/test/RandomisedSVDTest.py |
import unittest
import numpy
import scipy.sparse
from exp.sandbox.RandomisedSVD import RandomisedSVD
from apgl.util.Util import Util
import numpy.testing as nptst
class RandomisedSVDTest(unittest.TestCase):
def setUp(self):
numpy.random.rand(21)
numpy.set_printoptions(suppress=True, linewidth... | Python | 0 | @@ -374,16 +374,31 @@
= 100 %0A
+ m = 80%0A
@@ -419,17 +419,17 @@
se.rand(
-n
+m
, n, 0.1
|
c9cfb935bf582f17a5734abf6bf338e6a2dbf568 | Use assertItemsEqual() instead of assertListEqual() | openstackclient/tests/common/test_parseractions.py | openstackclient/tests/common/test_parseractions.py | # Copyright 2012-2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | Python | 0.000236 | @@ -2904,155 +2904,8 @@
%5D%0A
- # Need to sort the lists before comparing them%0A key = lambda x: x%5B'req1'%5D%0A expect.sort(key=key)%0A actual.sort(key=key)%0A
@@ -2911,36 +2911,37 @@
self.assert
-List
+Items
Equal(expect, ac
@@ -3614,155 +3614,8 @@
%5D%0A
- # N... |
9bfcc3f837df2b9342dfb4d7f3616ca4d9401969 | add unfolding of symlink into a directory of symlinks | dploy/__init__.py | dploy/__init__.py | """
dploy script
"""
import sys
assert sys.version_info >= (3, 4), 'Requires Python 3.4 or Greater'
import os
import pathlib
from dploy.util import resolve_abs_path
def dploy(source, dest):
"""
main script entry point
"""
source_absolute = resolve_abs_path(source)
dest_absolute = resolve_abs_pat... | Python | 0.999997 | @@ -13,14 +13,103 @@
ript
+ is an attempt at creating a clone of GNU stow that will work on%0AWindows as well as *nix
%0A%22%22%22%0A%0A
+%0A
impo
@@ -525,16 +525,17 @@
ute))%0A%0A%0A
+%0A
def _dpl
@@ -751,17 +751,16 @@
e.stem)%0A
-%0A
@@ -783,19 +783,26 @@
e =
-os.
+_
path
-.rel
+lib_relative_
path... |
67e41dadd80d5ac9dc419d4883906ce505bffa17 | Add interface | nowcasts/interface.py | nowcasts/interface.py |
def get_method():
""""""
pass
| Python | 0.000002 | @@ -1,8 +1,60 @@
+%0Afrom . import simple_advection%0Afrom . import steps%0A
%0Adef get
@@ -61,16 +61,20 @@
_method(
+name
):%0A %22
@@ -79,17 +79,1197 @@
%22%22%22
-%22%22%22%0A pass
+Return one callable function to produce deterministic or ensemble %0A precipitation nowcasts.%5Cn%5C%0A %0A Methods... |
31f662a9dbf3246582a6eced3312854946ae12d4 | remove trailing whitespace | stump/stump.py | stump/stump.py | #!/usr/bin/env python
# Written by Eric Crosson
# 2016-02-13 <3
import time
import inspect
import logging
def parametrized(dec):
def layer(*args, **kwargs):
def repl(f):
return dec(f, *args, **kwargs)
return repl
return layer
def configure(logger):
"""Pass stump a logger to ... | Python | 0.999996 | @@ -7593,10 +7593,9 @@
turn aux
-
%0A
|
52e51af4b9aaa274ef727ce428f129d042dfc595 | Complete delete_min() and its helper functions | ds_binary_heap.py | ds_binary_heap.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
class BinaryHeap(object):
def __init__(self):
# Put single zero as the 1st element, so that
# integer division can be used in later methods.
self.heap_ls = [0]
self.current_... | Python | 0.000004 | @@ -757,132 +757,874 @@
ef _
-percolate_down(self, i):%0A pass%0A%0A def _get_min_child(self, i):%0A pass%0A%0A def delete_min(self):%0A pass
+get_min_child(self, i):%0A if (i * 2 + 1) %3E self.current_size:%0A return i * 2%0A else:%0A if self.heap_ls%5Bi ... |
d5a103ae769ddf0da35d18c631040a40151cbcdf | Revise main(): test for search() & index() | ds_linked_list.py | ds_linked_list.py | from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from numpy import inf
class Node(object):
"""Node class as building block for linked list."""
def __init__(self, data):
self.data = data
self.next = None
class LinkedList(object):
... | Python | 0.000044 | @@ -4321,160 +4321,8 @@
():%0A
- # - is_empty()%0A # - size()%0A # - prepend(data)%0A # - append(data)%0A # - delete_with_data(data)%0A # - insert(pos, data)%0A # - pop(pos)%0A%0A
@@ -5086,16 +5086,254 @@
show()%0A%0A
+ print('Search non-existed 100: %7B%7D'.format(a_list.search(100)))%0... |
411672c069638c9d6dd5b3aab7dfcc23894f7ae1 | Update the pic build flag used for Sun CC | waflib/Tools/suncc.py | waflib/Tools/suncc.py | #!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2006-2010 (ita)
# Ralf Habacker, 2006 (rh)
from waflib import Utils
from waflib.Tools import ccroot, ar
from waflib.Configure import conf
@conf
def find_scc(conf):
"""
Detect the Sun C compiler
"""
v = conf.env
cc = conf.find_program('cc', var='CC')
try:
... | Python | 0 | @@ -1252,12 +1252,19 @@
%5B'-
-K
+xcode=
pic
+32
', '
@@ -1585,9 +1585,8 @@
flags()%0A
-%0A
|
3aa34e2e0b256a1f0bcc3959464147aeed58de8d | Document and comment svg.css | weasyprint/svg/css.py | weasyprint/svg/css.py | import cssselect2
import tinycss2
from .utils import parse_url
def find_stylesheets_rules(tree, stylesheet_rules, url):
for rule in stylesheet_rules:
if rule.type == 'at-rule':
if rule.lower_at_keyword == 'import' and rule.content is None:
# TODO: support media types in @impor... | Python | 0.000001 | @@ -1,12 +1,101 @@
+%22%22%22%0A weasyprint.svg.css%0A ------------------%0A%0A Apply CSS to SVG documents.%0A%0A%22%22%22%0A%0A
import cssse
@@ -201,24 +201,81 @@
ules, url):%0A
+ %22%22%22Find rules among stylesheet rules and imports.%22%22%22%0A
for rule
@@ -1049,32 +1049,34 @@
media':%0A ... |
44520918dc0fad40f3afcfc2cdfde6f3208543cd | Use wiringPiSetupGpio, which required root. With wiringPiSetupSys some gpios stayed on low after boot. | garden_lighting/MCP23017/raspberry.py | garden_lighting/MCP23017/raspberry.py | import time
import os
import wiringpi
from garden_lighting.MCP23017.MCP23017 import MCP23017
class RaspberryMCP23017(MCP23017):
def __init__(self, dev_addr, rst_pin=0xFF, i2cport=1):
super().__init__(dev_addr, rst_pin, i2cport)
def initDevice(self):
'''
Does a reset to put all registe... | Python | 0 | @@ -9,18 +9,8 @@
ime%0A
-import os%0A
impo
@@ -348,181 +348,142 @@
-os.system(%22gpio export %22 + str(self.RstPin) + %22 out%22)%0A # Set pin numbering mode%0A # We don't need performance, don't want root and don't want to interfer
+# Set pin numbering mode%0A # wiringPiSetupSys() did no... |
8b6aafdac18e4a8b2e929619d8f668edb01ad1aa | fix typo in participant gender enum | gdcdatamodel/models/nodes/clinical.py | gdcdatamodel/models/nodes/clinical.py | from psqlgraph import Node, pg_property
class Clinical(Node):
__nonnull_properties__ = []
@pg_property(str, enum=['male', 'femle'])
def gender(self, value):
self._set_property('gender', value)
@pg_property(str, enum=[
'not reported',
'white',
'american indian or alas... | Python | 0.002675 | @@ -131,16 +131,17 @@
e', 'fem
+a
le'%5D)%0A
|
053c045adf1f26db059adc244d6b7aa97e292604 | fix password dialog | gui/kivy/uix/dialogs/installwizard.py | gui/kivy/uix/dialogs/installwizard.py | from electrum import Wallet
from electrum_gui.kivy.i18n import _
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.core.window import Window
from kivy.clock import Clock
from kivy.factory import Factory
import sys
import threading
from functools import partial
import weakref
from create_restore i... | Python | 0.000005 | @@ -5111,16 +5111,37 @@
dDialog(
+)%0A popup.init(
'Choose
@@ -5488,16 +5488,37 @@
dDialog(
+)%0A popup.init(
'Confirm
|
c1d60b3930d9a85c5d41d3bacc81316b2865c3a2 | bump version | pantable/version.py | pantable/version.py | __version__ = '0.0.7'
| Python | 0 | @@ -16,7 +16,7 @@
0.0.
-7
+8
'%0A
|
7bc80439aa42501ec4f7757724a99097ca0e7ad9 | Configure to load all server extensions apart from `nbextensions`. | configure_nbextensions.py | configure_nbextensions.py | # -*- coding: utf-8 -*-
# Install notebook extensions
from jupyter_core.paths import jupyter_config_dir, jupyter_data_dir
from traitlets.config.loader import Config, JSONFileConfigLoader
import os
import sys
import json
import psutil
marker = '#--- nbextensions configuration ---'
debug = False
def remove_old_config(... | Python | 0 | @@ -5118,62 +5118,407 @@
sion
- of /nbextension/ configuration tool and template path
+s and template path%0Adef list_server_ext(path_ext):%0A ext = set()%0A for f in os.listdir(path_ext):%0A names = f.split('.')%0A if len(names) not in %5B1,2%5D or len(names%5B0%5D)==0: # server extension should ... |
f201fc9efd56c78d37432402501fed47992553df | Remove unused imports | backend/globaleaks/tests/handlers/test_custodian.py | backend/globaleaks/tests/handlers/test_custodian.py | # -*- coding: utf-8 -*-
import unittest
import random
from twisted.internet.defer import inlineCallbacks
from globaleaks.tests import helpers
from globaleaks.handlers import custodian
from globaleaks.rest import errors
class TestIdentityAccessRequestInstance(helpers.TestHandlerWithPopulatedDB):
_handler = custod... | Python | 0.000001 | @@ -37,22 +37,8 @@
est%0A
-import random%0A
from
@@ -168,43 +168,8 @@
ian%0A
-from globaleaks.rest import errors%0A
%0A%0Acl
@@ -1112,13 +1112,14 @@
= 'o
-u i
+h y
ea
+h
!'%0A%0A
|
13b613a76e409d352f866dd6de8c199ad8772c2f | Add 5-min timeout | parse_for_submit.py | parse_for_submit.py | #!/usr/bin/python
import json
import sys
if len(sys.argv) != 3:
print sys.argv[0], "<json file with hashes> <output json file>"
sys.exit(1)
outmap = {
"tasks": [
{"isolate_hash": "fa0fee63c6d4e540802d22464789c21de12ee8f5",
"description": "andrew test task"}
]
}
tasks = []
inmap = j... | Python | 0.000083 | @@ -463,16 +463,45 @@
str(k),%0A
+ %22timeout%22: 300%0A
|
e91bc56c853a5dcc0415340f00a9989df09dcab4 | STORE TRUE(net_sale_mex and week_num) IN BACKORDER PEDIDO VENTA SIMPLE | backorder_pedido_ventas_simple/models/sale_order.py | backorder_pedido_ventas_simple/models/sale_order.py | # -*- coding: utf-8 -*-
# © <YEAR(S)> <AUTHOR(S)>
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
from openerp import fields, models, api
import datetime
from openerp.addons import decimal_precision as dp
class SaleOrder(models.Model):
_inherit = 'sale.order'
week_number = fields.Intege... | Python | 0.00002 | @@ -385,16 +385,67 @@
_number%22
+,%0A store=True, # STORE DEL NUMERO DE SEMANA
%0A )%0A%0A
@@ -1078,32 +1078,77 @@
e_total_rate_%22,%0A
+ store=True, #CAMPO DEL NET SALE MEX%0A
)%0A%0A amoun
|
643f4d8e178e35337381f5afbb3c926be153743a | remove x-based matplotlib rendering | gamma_limits_sensitivity/tests/test_high_level_api.py | gamma_limits_sensitivity/tests/test_high_level_api.py | '''
The reader of the paper just saw there is a github repo
she installs it with
pip install github.com/mahnen/gamma_limits_sensitivity
then she finds the callable in her path named also gamma_limits_sensitivity,
as stated in the README and wants to try it on an upper limit calculation
she calls it as explained:
... | Python | 0.000001 | @@ -1362,16 +1362,103 @@
plotlib%0A
+matplotlib.use('Agg') # needed to remove x-based rendering in cont. integration testing
%0A%0Adef te
|
68c702e0a6461ac4d65f12d0d9bd04a40bfece36 | make use_cache false by default. seems buggy | explorer/catalog.py | explorer/catalog.py | import numpy as np
import pandas as pd
import dask.dataframe as dd
from distributed import Future
import fastparquet
import glob, re
import logging
class Catalog(object):
index_column = 'id'
def __init__(self, data):
self.data
self.columns = data.columns
self._coords = None
def _s... | Python | 0.999997 | @@ -860,20 +860,16 @@
= cat2%0A%0A
-
%0A%0A de
@@ -1738,19 +1738,20 @@
e_cache=
-Tru
+Fals
e):%0A
|
d2f78b1b708b4c5de0ecf68ce3246a14163383b0 | fix a test where list order was assumed | nova/tests/test_db_api.py | nova/tests/test_db_api.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.001161 | @@ -3985,30 +3985,38 @@
self.assert
-Equal(
+In(inst1.id, %5B
result%5B0%5D.id
@@ -4017,24 +4017,29 @@
%5B0%5D.id,
-inst1
+result%5B1%5D
.id
+%5D
)%0A
@@ -4055,38 +4055,92 @@
sert
-Equal(result%5B1%5D.id,
+In(inst2.id, %5Bresult%5B0%5D.id, result%5B1%5D.id%5D)%0A if
inst
-2.id)%0A
+1.id == result... |
e5cdc0d50f557d81d3b01968f51166a01f729233 | update mappings for geonode model | server/plugins/repository/geonode/mappings.py | server/plugins/repository/geonode/mappings.py | # -*- coding: ISO-8859-15 -*-
# =================================================================
#
# $Id$
#
# Authors: Tom Kralidis <tomkralidis@hotmail.com>
#
# Copyright (c) 2012 Tom Kralidis
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentat... | Python | 0 | @@ -2186,19 +2186,41 @@
mat': 's
-tor
+patial_representation_typ
e',%0A
|
cc271c69d2bbc96298b3e914fee3ff46c08e161b | add logger | src/python/expedient/common/backends/remoteuser.py | src/python/expedient/common/backends/remoteuser.py | '''
Created on Jun 15, 2010
@author: jnaous
'''
from django.contrib.auth.backends import RemoteUserBackend
class NoCreateRemoteUserBackend(RemoteUserBackend):
"""
Extends the RemoteUserBackend by simply setting C{create_unknown_user} to
False instead of the default True, so that unknown users are not crea... | Python | 0.000026 | @@ -100,16 +100,82 @@
rBackend
+%0Aimport logging%0A%0Alogger = logging.getLogger(%22backends.remoteuser%22)
%0A%0Aclass
|
3c7cd1543d216747401fc07c5bf4f0524aea015e | Make YAPF happy | src/python/grpcio/grpc/experimental/aio/_server.py | src/python/grpcio/grpc/experimental/aio/_server.py | # Copyright 2019 The gRPC 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 in writ... | Python | 0.000007 | @@ -725,16 +725,17 @@
cygrpc%0A%0A
+%0A
class Se
|
9c1b55c0aec215a96f25b7964e4a2ff1fedf857e | Fix finger mistake word of instead of or (#236) | travis/apis.py | travis/apis.py | # coding: utf-8
import base64
import os
import re
import subprocess
import tempfile
import time
import json
from contextlib import contextmanager
import requests
class ApiException(Exception):
pass
class Request(object):
def __init__(self):
self.session = requests.Session()
def _check(self):
... | Python | 0 | @@ -2192,17 +2192,17 @@
port'%5D o
-f
+r
'22')%0A
|
5756a6b92c411d758af3fcbe75e937de4e1f2a68 | remove comment | reports/management/commands/upload.py | reports/management/commands/upload.py | # coding: utf-8
from __future__ import unicode_literals
import codecs
import csv
import importlib
import os
import re
import sys
from boto.s3.connection import S3Connection
from boto.s3.key import Key
from django.core.management.base import BaseCommand
from django.template.defaultfilters import slugify
from opencivic... | Python | 0 | @@ -5346,20 +5346,8 @@
name
- # @todo 0.4
%0A
|
7e62920231c877ca4753709ab10e526e10987005 | fix (for videos not shown public) | src/you_get/extractors/vimeo.py | src/you_get/extractors/vimeo.py | #!/usr/bin/env python
__all__ = ['vimeo_download', 'vimeo_download_by_id', 'vimeo_download_by_channel', 'vimeo_download_by_channel_id']
from ..common import *
from json import loads
access_token = 'f6785418277b72c7c87d3132c79eec24' #By Beining
#----------------------------------------------------------------------
... | Python | 0 | @@ -1301,24 +1301,37 @@
y = False):%0A
+ try:%0A
html = g
@@ -1371,18 +1371,8 @@
id)
-%0A%0A try:
%0A
|
bcc334a3c66f2465cd63be284e389cc4c7a78203 | Fix extraction (closes #18741) | youtube_dl/extractor/dtube.py | youtube_dl/extractor/dtube.py | # coding: utf-8
from __future__ import unicode_literals
import json
import re
from socket import timeout
from .common import InfoExtractor
from ..utils import (
int_or_none,
parse_iso8601,
)
class DTubeIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?d\.tube/(?:#!/)?v/(?P<uploader_id>[0-9a-z.-]+)/(?... | Python | 0 | @@ -1545,15 +1545,23 @@
s://
-ipfs.io
+video.dtube.top
/ipf
|
c2a453b46177787d5cc17e09cedb3eca215ab159 | Fix width and height extraction (Closes #10325) | youtube_dl/extractor/imgur.py | youtube_dl/extractor/imgur.py | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_urlparse
from ..utils import (
int_or_none,
js_to_json,
mimetype2ext,
ExtractorError,
)
class ImgurIE(InfoExtractor):
_VALID_URL = r'https?://(?:i\.)?imgur\.com/(?:(?:gallery|topic/[^/... | Python | 0 | @@ -1632,36 +1632,42 @@
_none(self._
+og_
search_
-regex
+property
(%0A
@@ -1672,89 +1672,43 @@
-r'%3Cparam name=%22width%22 value=%22(%5B0-9%5D+)%22',%0A webpage, 'width', fatal=Fals
+'video:width', webpage, default=Non
e))%0A
@@ -1738,36 +1738,42 @@
_none(self._
+og_
search_
-regex
+p... |
7dc31b745405d41a0fdfaeba62570d8bd5e0b617 | Remove decode function from speex module | pebblecomm/speex.py | pebblecomm/speex.py | from subprocess import call
import argparse
import array
import struct
import binascii
MAX_FRAME_LEN = 255
MAX_FRAME_COUNT = 255
def decode(in_file, out_file):
call(["speexdec", in_file, out_file])
bitswap = b''.join(chr(sum(((val >> i) & 1) << (7 - i) for i in range(8))) for val in range(256))
to_uint_be = lamb... | Python | 0.000003 | @@ -128,82 +128,8 @@
55%0A%0A
-def decode(in_file, out_file):%0A call(%5B%22speexdec%22, in_file, out_file%5D)%0A%0A
bits
|
1e39f42df5d75e4eeae7a0033beb4c3c0f23ea51 | Add default ports for Nibe heatpump (#79695) | homeassistant/components/nibe_heatpump/config_flow.py | homeassistant/components/nibe_heatpump/config_flow.py | """Config flow for Nibe Heat Pump integration."""
from __future__ import annotations
import errno
from typing import Any
from nibe.connection.nibegw import NibeGW
from nibe.exceptions import CoilNotFoundException, CoilReadException, CoilWriteException
from nibe.heatpump import HeatPump, Model
import voluptuous as vol... | Python | 0 | @@ -1024,24 +1024,38 @@
STENING_PORT
+, default=9999
): cv.port,%0A
@@ -1092,24 +1092,38 @@
TE_READ_PORT
+, default=9999
): cv.port,%0A
@@ -1165,16 +1165,31 @@
ITE_PORT
+, default=10000
): cv.po
|
c44dfb03f59e850775670abd77812624321b9ba3 | switch to generator | zeus/web/views/auth_github.py | zeus/web/views/auth_github.py | import zeus
from flask import current_app, redirect, request, url_for
from flask.views import MethodView
from oauth2client.client import FlowExchangeError, OAuth2WebServerFlow
from sqlalchemy.exc import IntegrityError
from zeus import auth
from zeus.config import db
from zeus.constants import GITHUB_AUTH_URI, GITHUB_... | Python | 0 | @@ -2638,17 +2638,17 @@
= next(
-%5B
+(
%0A
@@ -2745,19 +2745,18 @@
-%5D)%0A
+))
%0A
|
694400fce6c1e360287cdef9115e1ad2da375a28 | Refactor VLAN actions into seperate function. | faucet/valve_acl.py | faucet/valve_acl.py | # Copyright (C) 2013 Nippon Telegraph and Telephone Corporation.
# Copyright (C) 2015 Brad Cowie, Christopher Lorier and Joe Stringer.
# Copyright (C) 2015 Research and Education Advanced Network New Zealand Ltd.
# Copyright (C) 2015--2017 The Contributors
#
# Licensed under the Apache License, Version 2.0 (the "Licens... | Python | 0 | @@ -813,16 +813,596 @@
lve_of%0A%0A
+%0Adef rewrite_vlan(output_dict):%0A vlan_actions = %5B%5D%0A if 'pop_vlans' in output_dict:%0A for _ in range(output_dict%5B'pop_vlans'%5D):%0A vlan_actions.append(valve_of.pop_vlan())%0A # if vlan tag is specified, push it.%0A if 'vlan_vid' in output... |
d3bbf2b47834f2e64006e56703744e9efd97072a | Add related items and change links to model | project/apps/api/admin.py | project/apps/api/admin.py | # import logging
# log = logging.getLogger(__name__)
from django.contrib import admin
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse
from django_object_actions import (
DjangoObjectActions,
takes_instance_or_queryset,
)
from easy_select2 import select2_modelform
f... | Python | 0 | @@ -663,32 +663,60 @@
r%0A extra = 0%0A
+ show_change_link = True%0A
%0A%0Aclass GroupAwa
@@ -3890,28 +3890,124 @@
in):%0A save_on_top = True%0A
+%0A%0A@admin.register(GroupFinish)%0Aclass GroupFinishAdmin(admin.ModelAdmin):%0A save_on_top = True%0A
|
e64917aeaddecd51862ce32480c8ee1dfede961b | add LOGIN_REDIRECT_URL to settings.py | eatup/settings.py | eatup/settings.py | """
Django settings for eatup project.
Generated by 'django-admin startproject' using Django 1.11.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | Python | 0 | @@ -3183,8 +3183,34 @@
tatic')%0A
+%0ALOGIN_REDIRECT_URL = '/'%0A
|
958dbf6fd86823b71740d4daaf92c79075f1dd6c | Update settings.py | Metronus-Project/metronus/settings.py | Metronus-Project/metronus/settings.py | """
Django settings for metronus project.
Generated by 'django-admin startproject' using Django 1.10.4.
For more information on this file, see
https://docs.djangoproject.com/en/1.10/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.10/ref/settings/
"""
import o... | Python | 0.000001 | @@ -5810,11 +5810,52 @@
MAIN
-=%22.
+ = %22.metronus.es%22%0A SERVER_EMAIL = %22error@
metr
|
a103a825975b70708f6a592d97192b234995c7f3 | handle unicode issue with http-auth | subauth/__init__.py | subauth/__init__.py | import time
import hashlib
import hmac
import sys
import subauth.config
import subauth.auth
from flask import Flask, request, Response
app = Flask(__name__)
conf = subauth.config.Config('subauth.conf')
auth_backend = subauth.auth.PasswdAuth(conf)
def make_digest(message):
return hmac.new(conf.get('ticket.secre... | Python | 0.000001 | @@ -4989,16 +4989,20 @@
nd.auth(
+str(
request.
@@ -5023,18 +5023,23 @@
username
+)
,
+str(
request.
@@ -5061,16 +5061,17 @@
assword)
+)
:%0A
@@ -5103,16 +5103,20 @@
esponse(
+str(
request.
@@ -5134,24 +5134,25 @@
on.username)
+)
%0A except
|
1104037e0631c2d48e6b5b26abfd492ce38903cd | Fix merge_base. | ellen/git/diff.py | ellen/git/diff.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from pygit2 import GIT_OBJ_COMMIT
from pygit2 import GIT_DIFF_IGNORE_WHITESPACE
from ellen.utils import JagareError
from ellen.utils.git import resolve_version
from ellen.utils.format import format_diff
# FIXME: make args explicit
def diff_wrapper(repository, *w, **kw):... | Python | 0 | @@ -3158,16 +3158,20 @@
rents%5B0%5D
+.hex
, parent
@@ -3175,16 +3175,20 @@
ents%5B-1%5D
+.hex
)%0A
|
bee01dab6c03ab06c09af90b08d19970437dffde | fix missing border in opengl renderer | src/c3nav/mapdata/render/engines/opengl.py | src/c3nav/mapdata/render/engines/opengl.py | import io
import threading
from collections import namedtuple
from itertools import chain
from queue import Queue
from typing import Optional
import ModernGL
import numpy as np
from PIL import Image
from shapely.geometry import CAP_STYLE, JOIN_STYLE, Polygon
from shapely.ops import unary_union
from c3nav.mapdata.rend... | Python | 0.000005 | @@ -5683,16 +5683,17 @@
itude =
+(
np.vstac
@@ -5765,13 +5765,15 @@
x()+
+1)/1
0
-.
00
-1
%0A
|
8ca3d32dcd0ce3433213bed5cdab5e580fee73a2 | update pingallm-local.py (use 10 ping pkts) | web/pingallm-local.py | web/pingallm-local.py | #! /usr/bin/env python
import sys
import time
import os
import re
import json
ping_cnt=3
wait1=ping_cnt
wait2=10
CONFIG_FILE=os.getenv("HOME") + "/ONOS/web/config.json"
def read_config():
global controllers, cluster_basename
f = open(CONFIG_FILE)
conf = json.load(f)
controllers = conf['controllers']
cluste... | Python | 0 | @@ -85,9 +85,10 @@
cnt=
-3
+10
%0Awai
|
e60ef90523da38561a065f94050865229664f793 | Fix output model type | enzynet/models.py | enzynet/models.py | """Model definitions."""
# Authors: Afshine Amidi <lastname@mit.edu>
# Shervine Amidi <firstname@stanford.edu>
# MIT License
import keras
import numpy as np
from enzynet import constants
from keras import initializers
from keras import layers
from keras.layers import advanced_activations
from keras import m... | Python | 0.999972 | @@ -133,20 +133,8 @@
nse%0A
-import keras
%0Aimp
@@ -395,18 +395,24 @@
-%3E
-keras.Mode
+models.Sequentia
l:%0A
|
f30a923b881e908fa607e276de1d152d803248f1 | Update main to run a profiler | pgpdump/__main__.py | pgpdump/__main__.py | import sys
from . import BinaryData
for filename in sys.argv[1:]:
with open(filename) as infile:
data = BinaryData(infile.read())
for packet in data.packets():
print hex(packet.key_id), packet.creation_date
| Python | 0 | @@ -3,16 +3,32 @@
port sys
+%0Aimport cProfile
%0A%0Afrom .
@@ -34,16 +34,27 @@
. import
+ AsciiData,
BinaryD
@@ -62,70 +62,149 @@
ta%0A%0A
-for
+def parse
file
+(
name
- in sys.argv%5B1:%5D:%0A with open(filename) as infil
+):%0A with open(name) as infile:%0A if name.endswith('.asc'):%0A ... |
b99c076baec6f73631a70910e399401897ee6c0b | Fix for string operation | escpos/printer.py | escpos/printer.py | #!/usr/bin/python
"""
@author: Manuel F Martinez <manpaz@bashlinux.com>
@organization: Bashlinux
@copyright: Copyright (c) 2012 Bashlinux
@license: GPL
"""
import usb.core
import usb.util
import serial
import socket
from .escpos import *
from .constants import *
from .exceptions import *
class Usb(Escpos):
""" D... | Python | 0 | @@ -4357,32 +4357,124 @@
raw format %22%22%22%0A
+ if type(msg) is str:%0A self.device.write(msg.encode());%0A else:%0A
self.dev
|
f4fcf5abee232afb8419ddb43c4662006ad76232 | Remove unused import from brain.py | espresso/brain.py | espresso/brain.py | from tinydb import TinyDB
from tinydb import where
class Brain(object):
def __init__(self, db_location):
self.db = TinyDB(db_location)
| Python | 0.000001 | @@ -22,33 +22,8 @@
nyDB
-%0Afrom tinydb import where
%0A%0Acl
|
e4d6cb9744d94d9a84369f4b8afda6ce89f1d1d3 | Change contrib/bayesflow/custom_grad tests to assertAllClose. | tensorflow/contrib/bayesflow/python/kernel_tests/custom_grad_test.py | tensorflow/contrib/bayesflow/python/kernel_tests/custom_grad_test.py | # Copyright 2017 The TensorFlow Authors. 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 applica... | Python | 0 | @@ -1767,37 +1767,37 @@
self.assertAll
-Equal
+Close
(f(x_), fx_)%0A
@@ -1805,37 +1805,37 @@
self.assertAll
-Equal
+Close
(g(x_), gx_)%0A%0A
@@ -2213,21 +2213,21 @@
ssertAll
-Equal
+Close
(f(x_),
@@ -2251,21 +2251,21 @@
ssertAll
-Equal
+Close
(g(x_),
|
31ea71b07f49df05a646684bb540730da89929db | add 04_division.py | 01_Introduction/04_division.py | 01_Introduction/04_division.py | #!/usr/bin/python3.6
"""
Jerod Gawne, 2017-04-19
Division
https://www.hackerrank.com/challenges/python-division/
"""
def main():
"""
Main-Logic
"""
a = int(input())
b = int(input())
if b != 0:
print(a//b)
print(a/b)
if __name__ == '__main__':
try:
main()
exc... | Python | 0.000829 | @@ -17,17 +17,16 @@
n3.6%0A%22%22%22
-%0A
Jerod Ga
@@ -106,16 +106,90 @@
ivision/
+%0A%0AEditorial%0A%0Aa = int(input())%0Ab = int(input())%0A%0Aprint(a // b)%0Aprint(a / b)
%0A%22%22%22%0A%0A%0Ad
@@ -235,16 +235,19 @@
%22%22%0A a
+, b
= int(i
@@ -257,16 +257,9 @@
t())
-%0A b =
+,
int
@@ -272,27 +272,9 ... |
20378bb1c911091007b20a7ce9d7d29921b49fa3 | Make is_connected more readable | win_unc/connecting.py | win_unc/connecting.py | """
Contains classes for dealing with UNC paths on Windows.
"""
from win_unc.disk_drive import get_available_disk_drive
from win_unc.internal import sanitize as S
from win_unc.internal.loggers import no_logging
from win_unc.internal.net_use_table import parse_net_use_table
from win_unc.internal.shell import run, Shell... | Python | 0.0003 | @@ -2689,22 +2689,24 @@
-return
+status =
matchin
@@ -2724,16 +2724,42 @@
status'%5D
+%0A return status
.lower()
|
98d78e3b855a89bcc22a531cf882418b071d2524 | inline this stuff. it's simple enough. | unsubscribe.py | unsubscribe.py | #!/usr/bin/env python
import string
from passlib.hash import sha1_crypt
from random import SystemRandom
from sqlalchemy import MetaData, Table, Column, String, ForeignKey, create_engine, Integer
from sqlalchemy.orm import mapper, relationship, sessionmaker
from sqlalchemy.ext.declarative import declarative_base
from s... | Python | 0.998255 | @@ -2286,90 +2286,8 @@
)%0A%0A%0A
-def block_email(address, db):%0A if not db.find(address):%0A db.add(address)%0A%0A
def
@@ -3205,26 +3205,125 @@
-block_email(email)
+if not db.find(args.email):%0A db.add(args.email)%0A else:%0A print %22That email is already unsubscribed%22
%0A%0A... |
7cdc7879cc2f9d23f62975d2ede50311db94f501 | read MapPackage | src/c3nav/mapdata/utils/cache/package.py | src/c3nav/mapdata/utils/cache/package.py | import os
import struct
from collections import namedtuple
from io import BytesIO
from tarfile import TarFile, TarInfo
from c3nav.mapdata.utils.cache import AccessRestrictionAffected, GeometryIndexed, MapHistory
CachePackageLevel = namedtuple('CachePackageLevel', ('history', 'restrictions'))
class CachePackage:
... | Python | 0.000001 | @@ -1965,8 +1965,717 @@
ession)%0A
+%0A @classmethod%0A def read(cls, f):%0A f = TarFile.open(fileobj=f)%0A files = %7Binfo.name: info for info in f.getmembers()%7D%0A%0A bounds = tuple(i/100 for i in struct.unpack('%3CIIII', f.extractfile(files%5B'bounds'%5D).read()))%0A%0A levels = ... |
c398e25ec852ef0a2db12000249964f76027f316 | Remove nose test args from conftest | conftest.py | conftest.py | import os
from django.conf import settings
import fancypages as fp
location = lambda x: os.path.join(os.path.dirname(os.path.realpath(__file__)), x)
sandbox = lambda x: location("sandbox/%s" % x)
def pytest_configure():
from fancypages.defaults import FANCYPAGES_SETTINGS
settings.configure(
DATABA... | Python | 0.000002 | @@ -97,16 +97,21 @@
th.join(
+%0A
os.path.
@@ -148,16 +148,17 @@
e__)), x
+%0A
)%0Asandbo
|
14d2d5f2f6c97ccf75373702dd42a335aa0a8063 | Allow dots in usernames | users/forms.py | users/forms.py | from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.models import User
class UserCreationForm(forms.ModelForm):
"""
A form that creates a user, with no privileges, from the given username,
email, and password.
"""
error_messages = {
'du... | Python | 0.000362 | @@ -484,16 +484,17 @@
=r'%5E%5B%5Cw-
+.
%5D+$'%0A
|
ba2ae47f1c41cd26afd5a14c8889de12d0b26d1e | Remove filter() duplicating list comprehension | users/views.py | users/views.py | # This file is part of e-Giełda.
# Copyright (C) 2014 Mateusz Maćkowski and Tomasz Zieliński
#
# e-Giełda 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 ... | Python | 0.000002 | @@ -1287,62 +1287,8 @@
ied%5D
-%0A users = filter(lambda user: user.verified, users)
%0A%0A
|
aed5c05475f53e287d2d0c550c73f6a11f43bb8b | delete code in form_valid() from ResetPasswordView. That code is now in get_form() | users/views.py | users/views.py | from django import forms
from django.db import transaction, IntegrityError
from django.shortcuts import redirect
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.forms import AuthenticationForm, PasswordResetForm, SetPasswordForm
from django.views.generic import CreateView
from djang... | Python | 0 | @@ -3303,499 +3303,24 @@
-UserModel = get_user_model()%0A assert uidb64 is not None and token is not None #checked by URLFconf%0A try:%0A uid = urlsafe_base64_decode(uidb64)%0A user = UserModel._default_manager.get(pk=uid)%0A except (TypeError, ValueError, OverflowError,... |
688eb257160a6e72b8738b28dc39d68107f67cbd | Empty line includes whitespace | src/collectors/hadoop/test/testhadoop.py | src/collectors/hadoop/test/testhadoop.py | #!/usr/bin/python
# coding=utf-8
################################################################################
from test import *
from diamond.collector import Collector
from hadoop import HadoopCollector
import os
################################################################################
class TestHadoo... | Python | 0.999998 | @@ -711,24 +711,16 @@
llect()%0A
-
%0A
@@ -769,24 +769,16 @@
d.pkl')%0A
-
%0A
|
e41b9dc02f021000677d53bc4bf25a3d20fce425 | - is no option | lixian_cli_parser.py | lixian_cli_parser.py |
__all__ = ['expand_command_line', 'parse_command_line', 'Parser', 'command_line_parse', 'command_line_option', 'command_line_value', 'command_line_parser', 'with_parser']
def expand_windows_command_line(args):
from glob import glob
expanded = []
for x in args:
try:
xx = glob(x)
except:
xx = None
if xx:... | Python | 0.999994 | @@ -844,16 +844,31 @@
ith('-')
+ and len(x) %3E 1
:%0A%09%09%09k =
|
d817f9b7b9e760475fda68a57dfb6f8ba3e4a5aa | Add comments to dashcam code | dashcam.py | dashcam.py | # dashcam.py
# A Raspberry Pi powered, GPS enabled, 3D printed bicycle dashcam
# By Matthew Timmons-Brown, The Raspberry Pi Guy
# Import necessary modules
import pygame
import picamera
import fnmatch
import os
import sys
import io
import atexit
import time
# Change path and import Adafruit's yuv2rgb library
sys.path.i... | Python | 0 | @@ -1106,18 +1106,92 @@
s Icon:%0A
+%09%22%22%22A simple icon bitmap class that connects a name to a pygame image%22%22%22 %0A
%09%0A
-
%09def __i
@@ -1351,17 +1351,84 @@
Button:%0A
+%09%22%22%22A button class to control all aspects of touchscreen buttons%22%22%22
%0A
-
%09def __i
@@ -1561,16 +1561,118 @@
= Non... |
3b6ff536d31e0e15101f2b19fc61352be5e920ca | fix expanded coefficient matrix for rectangular systems | symbolic/solvers.py | symbolic/solvers.py | import re
import itertools as it
from symbolic import core
def get_independent_term_vector(expression_list, var_names):
vector = []
N = len(expression_list)
M = len(var_names)
D = N - M
for expression in expression_list:
for i in range(M):
expression = expression.replace(var_n... | Python | 0 | @@ -2350,17 +2350,17 @@
n range(
-N
+M
)%5D for j
@@ -2369,17 +2369,17 @@
n range(
-N
+M
)%5D%0A%0A
@@ -2464,28 +2464,28 @@
coeff
-_column_expr
+icients_rows
= %5B%5D%0A
@@ -2575,25 +2575,23 @@
coeff
-_row_expr
+icients
= %5B%5D%0A
@@ -2786,33 +2786,31 @@
coeff
-_row_expr
+icients
.appe... |
de875418621c1d604507fbd095cf666ee5cac742 | Bump version | synapse/__init__.py | synapse/__init__.py | # -*- coding: utf-8 -*-
# Copyright 2014, 2015 OpenMarket Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | Python | 0 | @@ -693,11 +693,11 @@
%220.9.0-r
-2
+3
%22%0A
|
fd2070a483cbec1c93bf815130216b97b3ca023b | Improve URL validator | wtforms/validators.py | wtforms/validators.py | """
wtforms.validators
~~~~~~~~~~~~~~~~~~
TODO
:copyright: 2007-2008 by James Crasta, Thomas Johansson.
:license: MIT, see LICENSE.txt for details.
"""
import re
class ValidationError(ValueError):
pass
def email(form, field):
if not re.match(r'^.+@[^.].+\.[a-z]{2,4}$', field.data... | Python | 0.000003 | @@ -1019,16 +1019,35 @@
z%5D+://.*
+%5C.%5Ba-z%5D%7B2,4%7D(%5C/.*)?
', field
@@ -1496,37 +1496,34 @@
Error(u'Invalid
-email
+ip
address.')%0A
@@ -1591,10 +1591,24 @@
t_empty'
+, 'ip_address'
)%0A
|
42fd070f4d7b10ca1966f1aa52b63e3d0205cf7a | Made the trivia less "nice" to wrong spelled answers | pajbot/modules/trivia.py | pajbot/modules/trivia.py | import datetime
import logging
import Levenshtein
import requests
from apscheduler.schedulers.background import BackgroundScheduler
from pajbot.models.command import Command
from pajbot.models.handler import HandlerManager
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
log = logging.g... | Python | 0.997865 | @@ -6100,11 +6100,10 @@
= 0.
-875
+94
%0A%0A
|
d5d49791ffa6f2e4c19ab2f889c78b29289209f2 | attach created timestamp to trace | ui/app/index/views.py | ui/app/index/views.py | import json
from time import time
from urllib import unquote
from flask import request, redirect, render_template
from . import index
from .. import db
@index.route('/', methods=['GET'])
def index():
# read GET values
spanName = request.args.get('spanName')
serviceName = request.args.get('serviceName') o... | Python | 0 | @@ -2002,16 +2002,71 @@
ace_id'%5D
+%0A trace%5B'startTime'%5D = row%5B'created_ts'%5D
%0A%0A
|
bbe4391154f989140cd8b3252c63bc7f1bbd232b | Disable screenshot_sync_tests on Mac. For real, this time. | content/test/gpu/gpu_tests/screenshot_sync.py | content/test/gpu/gpu_tests/screenshot_sync.py | # Copyright 2014 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 os
import screenshot_sync_expectations as expectations
from telemetry import test
from telemetry.core import util
from telemetry.page import page
fro... | Python | 0.000031 | @@ -559,16 +559,38 @@
'gpu')%0A%0A
+@test.Disabled('mac')%0A
class _S
@@ -984,16 +984,17 @@
ssage)%0A%0A
+%0A
@test.Di
@@ -1479,16 +1479,38 @@
=120)%0A%0A%0A
+@test.Disabled('mac')%0A
class Sc
|
400c463097d9454a2d3780f2266186d97b2fa7fc | Create __init__.py | finufft/__init__.py | finufft/__init__.py | # -*- coding: utf-8 -*-
__version__ = "0.0.1.dev0"
try:
__FINUFFT_SETUP__
except NameError:
__FINUFFT_SETUP__ = False
if not __FINUFFT_SETUP__:
__all__ = ["nufft1d1", "nufft1d2", "nufft1d3"]
from .interface import (
nufft1d1, nufft1d2, nufft1d3,
)
| Python | 0.000429 | @@ -16,16 +16,604 @@
tf-8 -*-
+%0A#%0A# Copyright 2017 Daniel Foreman-Mackey%0A#%0A# Licensed under the Apache License, Version 2.0 (the %22License%22);%0A# you may not use this file except in compliance with the License.%0A# You may obtain a copy of the License at%0A#%0A# http://www.apache.org/licenses/LICENSE-2.0... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.