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 |
|---|---|---|---|---|---|---|---|
8080128d2ca5718ac971160bf964c3ca73b235b7 | add downloader | operators/downloader.py | operators/downloader.py | Python | 0.000001 | @@ -0,0 +1,904 @@
+import os%0A%0Afrom drivers import driver%0Afrom file_utils import file_util%0A%0A%0Aclass Downloader(object):%0A def __init__(self, server_driver):%0A %22%22%22Init a Uploader object%0A%0A Args:%0A server_driver: a driver already connected to cloud service%0A %22%2... | |
5be32f4022135a10585cf094b6fb8118dd87a2f6 | Add files via upload (#396) | ciphers/Atbash.py | ciphers/Atbash.py | Python | 0 | @@ -0,0 +1,360 @@
+def Atbash():%0A inp=raw_input(%22Enter the sentence to be encrypted %22)%0A output=%22%22%0A for i in inp:%0A extract=ord(i)%0A if extract%3E=65 and extract%3C=90:%0A output+=(unichr(155-extract))%0A elif extract%3E=97 and extract%3C=122:%0A outpu... | |
8d1016437e87794fb39b447b51427bae98a51bc2 | Add one public IP provider | classes/jsonip.py | classes/jsonip.py | Python | 0 | @@ -0,0 +1,245 @@
+from json import load%0Afrom urllib2 import urlopen%0A%0Aclass JsonIp:%0A%0A def __init__(self):%0A url = 'https://jsonip.com/'%0A uri = urlopen(url)%0A response = load(uri)%0A self.ip = response%5B%22ip%22%5D%0A # self.ip = '1.1.1.1'%0A
| |
b1be1bbf785406f4d286c7eb85ea459309ea03a2 | Fix file hierarchy. | batch_image_resizer2/batch_image_resizer.py | batch_image_resizer2/batch_image_resizer.py | Python | 0 | @@ -0,0 +1,559 @@
+%22%22%22Resize images in a folder using imagemagick command line tools.%0A%0Ahttp://hakanu.net%0A%22%22%22%0A%0Aimport glob%0Aimport os%0A%0Adef main():%0A print 'Started'%0A images = glob.glob(%22/home/h/Desktop/all_karikatur_resized/*.jpg%22)%0A counter = 0%0A for image in images:%0A print ... | |
6cbc9230e241511ccc922eb179f62e08db78bf14 | 1689. Partitioning Into Minimum Number Of Deci-Binary Numbers | LeetCode/PartitioningIntoMinimumNumberOfDeciBinaryNumbers.py | LeetCode/PartitioningIntoMinimumNumberOfDeciBinaryNumbers.py | Python | 0.999999 | @@ -0,0 +1,180 @@
+%22%22%22 a convoluted way of describing finding the biggest decimal digit :D %22%22%22%0A%0Aclass Solution:%0A def minPartitions(self, n: str) -%3E int:%0A return max(int(d) for d in str(n))%0A
| |
98b85a9fd8d5082e40996dfba0359b0ec32a9267 | Add solution for "Cakes" kata https://www.codewars.com/kata/525c65e51bf619685c000059 | codewars/cakes.py | codewars/cakes.py | Python | 0.000191 | @@ -0,0 +1,1176 @@
+# Cakes%0A# https://www.codewars.com/kata/525c65e51bf619685c000059%0A%0Aimport math%0Aimport unittest%0Afrom typing import Dict%0A%0A%0Adef cakes_1(recipe, available):%0A # type: (Dict%5Bstr, int%5D, Dict%5Bstr, int%5D) -%3E int%0A lowest_available = math.inf%0A%0A for i, a in recipe.items(... | |
5b97e6fc0446912d5b9b8da65e60d06165ed1b8b | Add profile tests | budgetsupervisor/users/tests/test_models.py | budgetsupervisor/users/tests/test_models.py | Python | 0.000001 | @@ -0,0 +1,464 @@
+from users.models import Profile%0A%0A%0Adef test_profile_is_created_when_user_is_created(user_foo):%0A assert len(Profile.objects.all()) == 1%0A assert hasattr(user_foo, %22profile%22)%0A%0A%0Adef test_profile_is_not_created_when_user_is_updated(user_foo):%0A assert len(Profile.objects.all(... | |
275adbea5477bbc6938e59edab23e1df182435ea | Create split-array-with-equal-sum.py | Python/split-array-with-equal-sum.py | Python/split-array-with-equal-sum.py | Python | 0.009008 | @@ -0,0 +1,933 @@
+# Time: O(n%5E2)%0A# Space: O(n)%0A%0Aclass Solution(object):%0A def splitArray(self, nums):%0A %22%22%22%0A :type nums: List%5Bint%5D%0A :rtype: bool%0A %22%22%22%0A if len(nums) %3C 7:%0A return False%0A %0A accumulated_sum = %5B0%5D *... | |
5e427315f46c026dd3b72b49349d3dcdbf04d138 | add financial_insights | financial_insights.py | financial_insights.py | Python | 0.000242 | @@ -0,0 +1,1036 @@
+'''%0ACreated on Apr, 2017%0A%0A@author: hugo%0A%0A'''%0A%0Aimport numpy as np%0A%0Adef calc_ranks(x):%0A %22%22%22Given a list of items, return a list(in ndarray type) of ranks.%0A %22%22%22%0A n = len(x)%0A index = list(zip(*sorted(list(enumerate(x)), key=lambda d:d%5B1%5D, reverse=Tru... | |
877644f7325b8abb585c06b2b2bf77a2a59d4c8f | set default button in tx detail window | gui/qt/transaction_dialog.py | gui/qt/transaction_dialog.py | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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 3 of the License, or
# (at... | Python | 0 | @@ -2783,16 +2783,62 @@
Button)%0A
+ cancelButton.setDefault(True)%0A
%0A
|
b566663291301bb3f84348d1208d8bf69b517421 | update URL on language match only | flexget/plugins/urlrewrite_serienjunkies.py | flexget/plugins/urlrewrite_serienjunkies.py | from __future__ import unicode_literals, division, absolute_import
import re
import logging
from flexget import plugin
from flexget.event import event
from flexget.plugins.plugin_urlrewriting import UrlRewritingError
from flexget.utils import requests
from flexget.utils.soup import get_soup
log = logging.getLogger('s... | Python | 0.000001 | @@ -1645,16 +1645,117 @@
entry)%0A
+ if download_url is None:%0A download_url = entry%5B'url'%5D %0A #Debug Information%0A
@@ -3072,35 +3072,36 @@
-log.verbose
+entry.reject
('Language d
@@ -3105,34 +3105,71 @@
e doesn%5C't match
-')
+ selected')%0A re... |
6c133d4de6a79eab6bfc2da9ff9a0045e0a0994d | add problem hanckerrank 009 | hackerrank/009_sherlock_and_the_beast.py | hackerrank/009_sherlock_and_the_beast.py | Python | 0.999803 | @@ -0,0 +1,2162 @@
+#!/bin/python3%0D%0A%0D%0A%22%22%22%0D%0Ahttps://www.hackerrank.com/challenges/sherlock-and-the-beast?h_r=next-challenge&h_v=zen%0D%0A%0D%0ASherlock Holmes suspects his archenemy, Professor Moriarty, is once again plotting something diabolical. Sherlock's companion, Dr. Watson, suggests Moriarty may... | |
ef1fa03d753f5d8a0b32831320a1b3e076ace363 | Add a test runner for our jqplot demo too | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | moksha/apps/demo/MokshaJQPlotDemo/run_tests.py | Python | 0 | @@ -0,0 +1,152 @@
+#!/usr/bin/env python%0A%22%22%22%0Anose runner script.%0A%22%22%22%0A__requires__ = 'moksha'%0A%0Aimport pkg_resources%0Aimport nose%0A%0Aif __name__ == '__main__':%0A nose.main()%0A
| |
d8c5fa6ebe1ae5d690d832a8e1d8403922a27403 | create a tmpfs at /tmp for verify on prow | scenarios/kubernetes_verify.py | scenarios/kubernetes_verify.py | #!/usr/bin/env python
# Copyright 2016 The Kubernetes 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 appli... | Python | 0 | @@ -4275,32 +4275,149 @@
depends on this%0A
+ '-e', 'TMPDIR=/tmp', # https://golang.org/src/os/file_unix.go%0A '--tmpfs /tmp:exec,mode=777',%0A
'gcr
|
b261704bc0ada9cfae773eaf1e40b18dc49d6ceb | add outline of backgrond job processor and task interface | portality/background.py | portality/background.py | Python | 0 | @@ -0,0 +1,2207 @@
+from portality import models%0Afrom portality.core import app%0A%0Aclass BackgroundApi(object):%0A%0A @classmethod%0A def execute(self, background_task):%0A job = background_task.background_job%0A ctx = None%0A if job.user is not None:%0A ctx = app.test_request_... | |
c8ec0689950a5fea0aff98afe54b172bd84e2ce9 | Add example using Tom's registration code in scipy. | examples/coregister.py | examples/coregister.py | Python | 0 | @@ -0,0 +1,653 @@
+%22%22%22Example using Tom's registration code from scipy.%0A%0A%22%22%22%0A%0Afrom os import path%0Afrom glob import glob%0A%0Aimport scipy.ndimage._registration as reg%0A%0A# Data files%0Abasedir = '/Users/cburns/data/twaite'%0Aanatfile = path.join(basedir, 'ANAT1_V0001.img')%0Afuncdir = path.join(... | |
114f8012a7faec4fe107c1d68c2ead10cdd88fbe | update zero.1flow.io settings for sparks 2.x. | oneflow/settings/zero_1flow_io.py | oneflow/settings/zero_1flow_io.py | # -*- coding: utf-8 -*-
# Settings for zero.1flow.io, a master clone used to validate migrations.
import os
from sparks.django.settings import include_snippets
include_snippets(
os.path.dirname(__file__), (
'000_nobother',
'00_production',
'1flow_io',
'common',
'db_common',... | Python | 0 | @@ -96,18 +96,8 @@
s.%0A%0A
-import os%0A
from
@@ -170,35 +170,8 @@
%0A
- os.path.dirname(__file__),
(%0A
@@ -449,16 +449,26 @@
),%0A
+ __file__,
globals
|
db60219a1446bb75dd98bfbb12ee6ec4eda6d6bb | add structure for the pcaptotal API | web/api.py | web/api.py | Python | 0 | @@ -0,0 +1,1183 @@
+from flask import jsonify, abort, make_response%0Afrom flask.ext.httpauth import HTTPBasicAuth%0Aauth = HTTPBasicAuth()%0Afrom app import app%0Atasks = %5B%0A %7B%0A 'id': 1,%0A 'title': u'Buy groceries',%0A 'description': u'Milk, Cheese, Pizza, Fruit, Tylenol', %0A 'd... | |
62b01c3c1614d5719cc69be951b2f6c660e40faa | Add generic function for iterating arrays. | pyldap/libldap/tools.py | pyldap/libldap/tools.py | Python | 0 | @@ -0,0 +1,162 @@
+def iterate_array(arr, f=None):%0A i = 0%0A while True:%0A if not arr%5Bi%5D:%0A break%0A yield arr%5Bi%5D if f is None else f(arr%5Bi%5D)%0A i += 1
| |
d8cd42940df8c1d2fc9ae28e9c5caa21995ca68c | Add word-counter.py | python3/word-counter.py | python3/word-counter.py | Python | 0.002063 | @@ -0,0 +1,1122 @@
+#!/usr/bin/env python3%0A%0Afrom collections import Counter%0Aimport argparse%0Aimport re%0Afrom itertools import islice%0Aimport operator%0A%0Aparser = argparse.ArgumentParser()%0Aparser.add_argument('--numWords',type=int,default=10)%0Aparser.add_argument('--maxTuples',type=int,default=4)%0Aparser.... | |
377a8be7c0b1e77f0e9c2dfd55f603e199727907 | make pairs | files/v8/make_pairs.py | files/v8/make_pairs.py | Python | 0.999365 | @@ -0,0 +1,172 @@
+import fileinput%0A%0Apops=%5B%5D%0Afor line in fileinput.input():%0A%09pops.append(line%5B:-1%5D)%0A%0Afor i in range(len(pops)-1):%0A%09for j in range(i+1, len(pops)):%0A%09%09print pops%5Bi%5D+%22,%22+pops%5Bj%5D%0A
| |
9c0ddb1c4fff5fb3f44ad77192a7f435bc7a22fe | Create AdafruitMotorHat4Pi.py | service/AdafruitMotorHat4Pi.py | service/AdafruitMotorHat4Pi.py | Python | 0 | @@ -0,0 +1,602 @@
+# Start the services needed%0Araspi = Runtime.start(%22raspi%22,%22RasPi%22)%0Ahat = Runtime.start(%22hat%22,%22AdafruitMotorHat4Pi%22)%0Am1 = Runtime.start(%22m1%22,%22MotorHat4Pi%22)%0A# Attach the HAT to i2c bus 1 and address 0x60%0Ahat.attach(%22raspi%22,%221%22,%220x60%22)%0A# Use the M1 motor p... | |
2b2d711a5ba8be5cebe5913870c4dea1b9498af1 | Remove misleading fileno method from NpipeSocket class | docker/transport/npipesocket.py | docker/transport/npipesocket.py | import functools
import io
import six
import win32file
import win32pipe
cERROR_PIPE_BUSY = 0xe7
cSECURITY_SQOS_PRESENT = 0x100000
cSECURITY_ANONYMOUS = 0
RETRY_WAIT_TIMEOUT = 10000
def check_closed(f):
@functools.wraps(f)
def wrapped(self, *args, **kwargs):
if self._closed:
raise Runtim... | Python | 0 | @@ -2423,82 +2423,8 @@
e)%0A%0A
- @check_closed%0A def fileno(self):%0A return int(self._handle)%0A%0A
|
b376b0dca7ec73451ff36ebae1718fa11ec159f0 | Add utils.py for general purpose functions | manyfaced/common/utils.py | manyfaced/common/utils.py | Python | 0.000003 | @@ -0,0 +1,1353 @@
+import time%0Aimport pickle%0Afrom socket import error as socket_error%0A%0Afrom common.status import CLIENT_TIMEOUT%0A%0A%0Adef dump_file(data):%0A try:%0A with file('temp.db') as f:%0A string_file = f.read()%0A db = pickle.loads(string_file)%0A except:%0A db =... | |
b9759f60c9f107c3d2c319f53ed2985ee58dc319 | Write test for mock_pose generator. | src/tests/test_mock_pose.py | src/tests/test_mock_pose.py | Python | 0 | @@ -0,0 +1,1175 @@
+try:%0A from unittest.mock import patch, MagicMock%0Aexcept ImportError:%0A from mock import patch, MagicMock%0A%0Aimport pytest%0A%0Aimport rospy%0A%0AMockTf2 = MagicMock()%0Amodules = %7B%22tf2_ros%22: MockTf2%7D%0Apatcher = patch.dict(%22sys.modules%22, modules)%0Apatcher.start()%0A%0A%0Atr... | |
aed3fc48ba392f56441e35c2860be7319ee96822 | Add default party accounts in customer/supplier | erpnext/patches/v4_2/party_model.py | erpnext/patches/v4_2/party_model.py | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
def execute():
try:
frappe.reload_doc("accounts", "doctype", "account")
receivable_payable_accounts = create_receivable_payable_a... | Python | 0 | @@ -198,15 +198,8 @@
():%0A
-%09try:%0A%09
%09fra
@@ -247,17 +247,16 @@
count%22)%0A
-%09
%09receiva
@@ -314,16 +314,49 @@
count()%0A
+%09if receivable_payable_accounts:%0A
%09%09set_pa
@@ -445,35 +445,8 @@
unt(
-receivable_payable_accounts
)%0A%09%09
@@ -492,53 +492,67 @@
()%0A%09
-except:%0A%09%09print frapp... |
1ce12ab6eb2a3b5578eba253929275bb3b394b76 | Create line_follow.py | line_follow.py | line_follow.py | Python | 0.000005 | @@ -0,0 +1,951 @@
+from Myro import *%0Ainit(%22/dev/tty.scribbler%22)%0A%0A# To stop the Scribbler, wave your hand/something in front of the fluke%0Awhile getObstacle('center') %3C 6300:%0A # Get the reading from the line sensors on the bottom of Scribbler%0A left, right = getLine()%0A %0A # If both left a... | |
5fa39bb65f88fa3596cc3831890cd258cc5768e1 | Add the module file | lantz/drivers/ni/__init__.py | lantz/drivers/ni/__init__.py | Python | 0.000002 | @@ -0,0 +1,345 @@
+%EF%BB%BF# -*- coding: utf-8 -*-%0A%22%22%22%0A lantz.drivers.ni%0A ~~~~~~~~~~~~~~~~%0A%0A :company: National Instruments%0A :description: %0A :website: http://www.ni.com/%0A%0A ----%0A%0A :copyright: 2012 by Lantz Authors, see AUTHORS for more details.%0A :license: BSD, see L... | |
b3dcbe95d766d902d22a0c4c171cbbe5ce207571 | Add test for longitivity-testing: both LED-s ON at the same time for extended periods of time | python/tests/stress_test.py | python/tests/stress_test.py | Python | 0.000001 | @@ -0,0 +1,790 @@
+#!/usr/bin/env python%0Aimport time%0Aimport sys%0Aimport os%0Afrom random import randint%0A%0A# Hack to import from a parent dir%0A# http://stackoverflow.com/a/11158224/401554%0Aparentdir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))%0Asys.path.insert(0, parentdir)%0A%0Afrom octo imp... | |
3063099427f29915fae70b453d5ff5f0200a8869 | Correct import in loading module | oscar/core/loading.py | oscar/core/loading.py | import sys
import traceback
from django.conf import settings
from django.db.models import get_model as django_get_model
from core.exceptions import (ModuleNotFoundError, ClassNotFoundError,
AppNotFoundError)
def get_class(module_label, classname):
"""
Dynamically import a single ... | Python | 0.000001 | @@ -114,21 +114,28 @@
t_model%0A
+%0A
from
+oscar.
core.exc
@@ -191,16 +191,22 @@
dError,%0A
+
|
9bc154d662464a0073b8b7cd3bcf39312a4ac1d7 | add ifttt notification | ifttt_notification.py | ifttt_notification.py | Python | 0 | @@ -0,0 +1,312 @@
+import requests%0A%0A%0Adef Air_alert():%0A report = %7B%7D%0A report%5B%22value1%22%5D = %22test%22%0A report%5B%22value2%22%5D = %22second%22%0A report%5B%22value3%22%5D = %22third%22%0A requests.post(%0A %22https://maker.ifttt.com/trigger/Air_Test/with/key/%7Buser_key%7D%22.f... | |
407c08899eccea60a2ae534ab0c1b000c58708ab | Implement some tests for AgentAPI | tests/test_agent_api.py | tests/test_agent_api.py | Python | 0.000002 | @@ -0,0 +1,3543 @@
+# No shebang line, this module is meant to be imported%0A#%0A# Copyright 2013 Oliver Palmer%0A# Copyright 2013 Ambient Entertainment GmbH & Co. KG%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 ... | |
2c2e73cb6e0f9baee0bbc0ad5338d09b5665d573 | Remove useless import. | pymatgen/entries/compatibility.py | pymatgen/entries/compatibility.py | #!/usr/bin/env python
"""
This module implements Compatibility corrections for mixing runs of different
functionals.
"""
from __future__ import division
__author__ = "Shyue Ping Ong, Anubhav Jain"
__copyright__ = "Copyright 2012, The Materials Project"
__version__ = "1.0"
__maintainer__ = "Shyue Ping Ong"
__email__ ... | Python | 0 | @@ -596,58 +596,8 @@
Set%0A
-from pymatgen.util.decorators import cached_class%0A
%0A%0Acl
|
369676cfacd35c7b3321edaef97bf64f063e7d50 | Add nephrectomy model | radar/radar/models/nephrectomy.py | radar/radar/models/nephrectomy.py | Python | 0.000007 | @@ -0,0 +1,1221 @@
+from sqlalchemy import Column, Integer, ForeignKey, Date, Index%0Afrom sqlalchemy.orm import relationship%0A%0Afrom radar.database import db%0Afrom radar.models.common import MetaModelMixin, IntegerLookupTable%0A%0ANEPHRECTOMY_SIDES = OrderedDict(%5B%0A ('LEFT', 'Left'),%0A ('RIGHT', 'Right'),... | |
0378a225c5519ad39fee6a132c455e1848151a44 | Create run_test.py | recipes/django-braces/run_test.py | recipes/django-braces/run_test.py | Python | 0.000004 | @@ -0,0 +1,187 @@
+import django%0Afrom django.conf import settings%0Asettings.configure(INSTALLED_APPS=%5B'braces', 'django.contrib.contenttypes', 'django.contrib.auth'%5D) %0Adjango.setup() %0A %0Aimport braces%0A
| |
7e9c90c179df8666a75eef1610dbda764add1408 | Create elec_temp_join.py | elec_temp_join.py | elec_temp_join.py | Python | 0.000001 | @@ -0,0 +1,912 @@
+import numpy as np%0Aimport pandas as pd%0Aimport geopandas as gpd%0Afrom geopandas import tools%0A%0Autility = '/home/akagi/Desktop/electricity_data/Electric_Retail_Service_Ter.shp'%0Autil = gpd.read_file(utility) %0A%0Aurbarea = '/home/akagi/GIS/census/cb_2013_us_ua10_500k/cb_2013_us_ua10_500k.shp'... | |
e9135583af7a862bd426b4a068743765c4604da3 | add test for dials.convert_to_cbf (only works on dls computers) | test/command_line/test_convert_to_cbf.py | test/command_line/test_convert_to_cbf.py | Python | 0 | @@ -0,0 +1,763 @@
+from __future__ import absolute_import, division, print_function%0A%0Aimport glob%0Aimport os%0Aimport pytest%0A%0Aimport procrunner%0A%0Apytestmark = pytest.mark.skipif(%0A not os.access(%22/dls/i04/data/2019/cm23004-1/20190109/Eiger%22, os.R_OK),%0A reason=%22Test images not available%22,%0A)... | |
12731a74be889eff48e0e505de666ef3180794fe | add missing file | rmake/plugins/plugin.py | rmake/plugins/plugin.py | Python | 0.000003 | @@ -0,0 +1,2653 @@
+#%0A# Copyright (c) 2006 rPath, Inc.%0A#%0A# This program is distributed under the terms of the Common Public License,%0A# version 1.0. A copy of this license should have been distributed with this%0A# source file in a file called LICENSE. If it is not present, the license%0A# is always available at... | |
3e0e898d0d3ab494edc5dbc65ccde4020f427be8 | Create quiz-eliecer.py | laboratorios/quiz-eliecer.py | laboratorios/quiz-eliecer.py | Python | 0.000001 | @@ -0,0 +1,408 @@
+ %0Abase=5%0Aaltura=7%0A%0Aperimetro=2*5+2*7%0Aprint (%22mi perimetro es%22 + str(perimetro))%0A%0Aarea=5*7%0Aprint (%22mi area es%22 + str (area))%0A%0Ametrop=perimetro/100%0Aprint (%22mi perimetro en metro es%22 + str(metrop))%0A%0Apulgadap=perimetro/2.54%0Aprint (%22mi perimetro en pulgada es%22 +... | |
ee554d89d1c822537345ce4d03d2bff8783d7f1b | Disable nacl_integration due to #261724. | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | chrome/test/nacl_test_injection/buildbot_nacl_integration.py | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
import subprocess
import sys
def Main(args):
pwd = os.environ.get('PWD', '')
is_integration_bot = 'nacl-chrome' in ... | Python | 0.000002 | @@ -239,16 +239,134 @@
(args):%0A
+ if sys.platform == 'darwin':%0A print %3E%3E sys.stderr, %22SKIPPING NACL INTEGRATION DUE TO BUG #261724.%22%0A return 0%0A%0A
pwd =
|
33448340d278da7e0653701d78cbab317893279d | Add a simple analysis tool to get some structural properties about an AG's specfile. | AG/datasets/analyze.py | AG/datasets/analyze.py | Python | 0 | @@ -0,0 +1,1776 @@
+#!/usr/bin/python%0A%0Aimport os%0Aimport sys%0Aimport lxml %0Afrom lxml import etree%0Aimport math %0A%0Aclass StatsCounter(object):%0A%0A prefixes = %7B%7D%0A cur_tag = None%0A%0A def start( self, tag, attrib ):%0A self.cur_tag = tag%0A%0A def end( self, tag ):%0A pass%0A... | |
28b9fa5b1be386b0ee0641086c11897141177a36 | Update analysis_fun.py | examples/funloc/analysis_fun.py | examples/funloc/analysis_fun.py | # -*- coding: utf-8 -*-
# Copyright (c) 2014, LABS^N
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""
----------------------------------
Example experiment analysis script
----------------------------------
This sample script shows how to preprocess a simple MEG experiment
from start to fi... | Python | 0.000001 | @@ -1959,17 +1959,17 @@
he/data0
-1
+2
/eric_no
|
16165a9387807d54b91873e95a677bfe5d251aba | Add healthcheck module to contrib | kitnirc/contrib/healthcheck.py | kitnirc/contrib/healthcheck.py | Python | 0 | @@ -0,0 +1,2458 @@
+import logging%0Aimport sys%0Aimport threading%0Aimport time%0A%0Afrom kitnirc.modular import Module%0A%0A%0A_log = logging.getLogger(__name__)%0A%0A%0Aclass HealthcheckModule(Module):%0A %22%22%22A KitnIRC module which checks connection health.%0A%0A By default, this module will request a PON... | |
2762c66cb7336e255b37f913326eb46ff218ca05 | make sure we dont create bogus package. | dodo.py | dodo.py | """dodo file. test + management stuff"""
import glob
import os
import pytest
from doit.tools import create_folder
DOIT_CONFIG = {'default_tasks': ['checker', 'ut']}
CODE_FILES = glob.glob("doit/*.py")
TEST_FILES = glob.glob("tests/test_*.py")
TESTING_FILES = glob.glob("tests/*.py")
PY_FILES = CODE_FILES + TESTING_... | Python | 0 | @@ -3858,24 +3858,218 @@
stutils %22%22%22%0A
+%0A def check_version():%0A # using a MANIFEST file directly is broken on python2.7%0A # http://bugs.python.org/issue11104%0A import sys%0A assert sys.version_info %3C (2,7)%0A%0A
cmd = %22h
@@ -4147,16 +4147,31 @@
ions': %5B
+check_ve... |
cad7db237c68139d3f4f7dd691205b207edb0b79 | Refactor plugin api code into its own module | confluent/pluginapi.py | confluent/pluginapi.py | Python | 0 | @@ -0,0 +1,3338 @@
+# concept here that mapping from the resource tree and arguments go to%0A# specific python class signatures. The intent is to require%0A# plugin authors to come here if they *really* think they need new 'commands'%0A# and hopefully curtail deviation by each plugin author%0A%0A# have to specify a st... | |
bdcd69ed9cc0f87202f8d79e26fb58f42a4b95bb | Fix iteration, thanks @chrisseto | scrapi/base/__init__.py | scrapi/base/__init__.py | # Classes for scrAPI Harvesters
from __future__ import unicode_literals
import abc
import logging
from datetime import date, timedelta
from lxml import etree
from scrapi import util
from scrapi import requests
from scrapi.linter import lint
from scrapi.base.schemas import OAISCHEMA
from scrapi.base.helpers import up... | Python | 0 | @@ -3181,19 +3181,19 @@
ret if
-ret
+val
%5D%0A
|
a9ca7f2f22551256213ecd32047022048c72db5c | Add Python 3 Script for Converting Image Types | scripts/convert_svgs.py | scripts/convert_svgs.py | Python | 0 | @@ -0,0 +1,538 @@
+import cairosvg%0Aimport os%0A%0A# MUST RUN IN PYTHON 3 and pip install cairosvg%0A%0Afile_dir = '../data/hough_test/Test_Set_1/'%0A%0Asvgs = os.listdir(os.path.join(file_dir, 'SVGs'))%0A%0Afor svg in svgs:%0A name = svg.split('.svg')%5B0%5D%0A cairosvg.svg2png(url=os.path.join(file_dir, 'SVGs'... | |
c3e5c8f9691b55785a25d86fd647d6aeabbaaf8b | Fix pep8 | test/configuration/__init__.py | test/configuration/__init__.py | import unittest
from os.path import dirname, join
from mycroft.configuration import ConfigurationLoader, ConfigurationManager, \
DEFAULT_CONFIG, SYSTEM_CONFIG, USER_CONFIG, RemoteConfiguration
__author__ = 'jdorleans'
class AbstractConfigurationTest(unittest.TestCase):
def setUp(self):
self.config_... | Python | 0.000001 | @@ -3374,16 +3374,17 @@
g, %7B%7D)%0A%0A
+%0A
@unittes
|
392be3310efc812686c0d43f7ca884d9c730a879 | Add stop-by-time script to end simulation after a specified amount of simulated time | scripts/stop-by-time.py | scripts/stop-by-time.py | Python | 0 | @@ -0,0 +1,655 @@
+# End ROI after x nanoseconds%0A# Usage: -s stop-by-time:1000000 # End after 1 ms of simulated time%0A%0Aimport sim%0A%0Aclass StopByTime:%0A%0A def setup(self, args):%0A args = dict(enumerate((args or '').split(':')))%0A self.time = long(args.get(0, 1e6))%0A self.done = Fals... | |
d195d67fe3e9c3e12bb978bfaa98276e8f9f7140 | allow loading ctx from expression | script_runner/ctx_server.py | script_runner/ctx_server.py | #########
# Copyright (c) 2014 GigaSpaces Technologies Ltd. All rights reserved
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless... | Python | 0 | @@ -686,16 +686,25 @@
portlib%0A
+import re
%0A%0Afrom c
@@ -1383,20 +1383,102 @@
nt('
+-e', '--expression', default=None)%0A parser.add_argument('-p', '--
module
-_
+-
path'
+, default=None
)%0A
@@ -1516,32 +1516,49 @@
)%0A%0A%0Adef load_ctx
+_from_module_path
(module_path, **
@@ -1553,26 +1553,16 @@
ule... |
30a0b17d028f279a9877150ac4eb60b1ce135fa2 | Add check script for MultiplyHueAndSaturation | checks/check_multiply_hue_and_saturation.py | checks/check_multiply_hue_and_saturation.py | Python | 0 | @@ -0,0 +1,1078 @@
+from __future__ import print_function, division%0A%0Aimport numpy as np%0A%0Aimport imgaug as ia%0Afrom imgaug import augmenters as iaa%0A%0A%0Adef main():%0A image = ia.quokka_square((128, 128))%0A images_aug = %5B%5D%0A%0A for mul in np.linspace(0.0, 2.0, 10):%0A aug = iaa.Multiply... | |
769036ffd7a21477a9133c58b352711d85c7a7a0 | add regression test for monkey patching of Queue | test/test_queue_monkeypatch.py | test/test_queue_monkeypatch.py | Python | 0 | @@ -0,0 +1,611 @@
+from __future__ import absolute_import%0A%0Aimport unittest%0A%0Aimport urllib3%0Afrom urllib3.exceptions import EmptyPoolError%0Aimport Queue%0A%0Aclass BadError(Exception):%0A %22%22%22%0A This should not be raised.%0A %22%22%22%0A pass%0A%0AQueue.Empty = BadError%0A%0A%0Aclass TestConn... | |
338559737e34ca395cec895ac8e822fc3147c7aa | Add basic code | tule.py | tule.py | Python | 0 | @@ -0,0 +1,2148 @@
+def calcLength(x,y,z=0):%0A return (x**2 + y**2 + z**2)**0.5%0A%0A#lengths are in feet%0AL = 92; W=68; H=22; MidXY=(W/2,L/2)%0A%0Adef feetToYards(inFeet):%0A return inFeet/3.0%0A%0Adef yardsToFeet(inYards):%0A return inYards * 3.0%0A%0A#widthOfStrand is how wide the tule piece (in feet)%0Ad... | |
242479ace03928b20dc86806f7592ec1148b615b | Add integration test for DraftService. | service/test/integration/test_draft_service.py | service/test/integration/test_draft_service.py | Python | 0 | @@ -0,0 +1,1203 @@
+#%0A# Copyright (c) 2014 ThoughtWorks, Inc.%0A#%0A# Pixelated is free software: you can redistribute it and/or modify%0A# it under the terms of the GNU Affero General Public License as published by%0A# the Free Software Foundation, either version 3 of the License, or%0A# (at your option) any later v... | |
c58be8c77fdad5ec8b6c9da9ba6cfc45ae0f6d07 | fix typo in fuzz_addresses.py | fuzz-addresses.py | fuzz-addresses.py | Python | 0.998582 | @@ -0,0 +1,1105 @@
+import sys%0Aimport csv%0Afrom dateutil.parser import parse%0Afrom datetime import datetime%0A%0A#Take a csv with datetime stamps and addresses split across remaing cells and output%0A#a fuzzed csv that contains two columns. A datetime stamp of the first day of the year%0A#in which the location occu... | |
0ff705b6bbe2d2844d6b947ca2aa8fc9cc9ead66 | Create PedidoDeletar.py | backend/Models/Grau/PedidoDeletar.py | backend/Models/Grau/PedidoDeletar.py | Python | 0 | @@ -0,0 +1,328 @@
+from Framework.Pedido import Pedido%0Afrom Framework.ErroNoHTTP import ErroNoHTTP%0A%0Aclass PedidoDeletar(Pedido):%0A%0A%09def __init__(self,variaveis_do_ambiente):%0A%09%09super(PedidoDeletar, self).__init__(variaveis_do_ambiente)%0A%09%09try:%0A%09%09%09self.id = self.corpo%5B'id'%5D%09%09%09%0A%0... | |
d85442d5961602ae91c385a65e9503c409316b3f | Scrub stale data from redis | bin/scrub_stale_lists.py | bin/scrub_stale_lists.py | Python | 0.000001 | @@ -0,0 +1,2278 @@
+#!/usr/bin/env python%0A%0Aimport sys%0Aimport os%0Aimport time%0Aimport redis%0Aimport requests%0Aimport logging%0Afrom urlparse import urlparse%0Afrom datetime import timedelta%0A%0A%0Adef main(rds):%0A pf = %22coalesce.v1.%22%0A%0A tasks_removed = 0%0A lists_removed = 0%0A%0A list_key... | |
9870fdd4b0996254216ff85a4dc0f9706843ca50 | Add test for nested while with exc and break. | tests/basics/while_nest_exc.py | tests/basics/while_nest_exc.py | Python | 0 | @@ -0,0 +1,198 @@
+# test nested whiles within a try-except%0A%0Awhile 1:%0A print(1)%0A try:%0A print(2)%0A while 1:%0A print(3)%0A break%0A except:%0A print(4)%0A print(5)%0A break%0A
| |
6a541b8d5b7c2c742420bbbe758866daef804e90 | Add a unit test to verify controller objects do not persist across classes. (#483) | tests/mobly/test_suite_test.py | tests/mobly/test_suite_test.py | Python | 0 | @@ -0,0 +1,3174 @@
+# Copyright 2018 Google Inc.%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%0A#%0A# Unless required by ... | |
bf28aa8fbe9aa735d017f935aefb89c5ed48f836 | Add bubble sort implementation | aids/sorting_and_searching/bubble_sort.py | aids/sorting_and_searching/bubble_sort.py | Python | 0 | @@ -0,0 +1,375 @@
+'''%0AIn this module, we implement bubble sort%0A%0ATime complexity: O(n %5E 2)%0A%0A'''%0A%0A%0Adef bubble_sort(arr):%0A '''%0A Sort array using bubble sort%0A%0A '''%0A for index_x in xrange(len(arr)):%0A for index_y in xrange(len(arr) - 1, index_x, -1):%0A if arr%5Bin... | |
73cab4c1e0a591504176011b53b9774c8782238e | test kalman | tests/tsdb/test_tsdb_kalman.py | tests/tsdb/test_tsdb_kalman.py | Python | 0.000006 | @@ -0,0 +1,1960 @@
+from tsdb import TSDBClient, TSDB_REST_Client%0Aimport timeseries as ts%0Aimport numpy as np%0Aimport subprocess%0Aimport unittest%0Aimport asyncio%0Aimport asynctest%0Aimport time%0A%0A %0Aclass Test_TSDB_Kalman(asynctest.TestCase):%0A%0A def setUp(self):%0A #############%0A ###... | |
faef1804e1781365fc027ecf08d61fbab56a4679 | Add migratioss I forgot to commit out of saltyness | magic/migrations/0003_auto_20170929_0229.py | magic/migrations/0003_auto_20170929_0229.py | Python | 0 | @@ -0,0 +1,696 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.5 on 2017-09-29 05:29%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('magic', '0002_auto_20170929_0159'),%0A %5D%0A%0A... | |
e61dcb055fb4767e6e662648c89cbdfda4422c97 | Update expected error message in this test | docs/source/examples/test_no_depends_fails.py | docs/source/examples/test_no_depends_fails.py | from pych.extern import Chapel
@Chapel(sfile="users.onlyonce.chpl")
def useTwoModules(x=int, y=int):
return int
if __name__ == "__main__":
print(useTwoModules(2, 4))
import testcase
# contains the general testing method, which allows us to gather output
import os.path
def test_using_multiple_modules():
... | Python | 0 | @@ -522,16 +522,24 @@
module
+or enum
%5C'M1%5C'%22
|
2e7048d8feae5ed2c244e617077235b5b771f326 | Add deleted selenium runner | test/selenium/src/run_selenium.py | test/selenium/src/run_selenium.py | Python | 0 | @@ -0,0 +1,1822 @@
+#!/usr/bin/env python2.7%0A# Copyright (C) 2015 Google Inc., authors, and contributors %3Csee AUTHORS file%3E%0A# Licensed under http://www.apache.org/licenses/LICENSE-2.0 %3Csee LICENSE file%3E%0A# Created By: miha@reciprocitylabs.com%0A# Maintained By: miha@reciprocitylabs.com%0A%0A%22%22%22 Basic... | |
3bb65466d40c1b59faebe0db40eced260ff60010 | Create SampleFunction.py | src/Python/ImplicitFunctions/SampleFunction.py | src/Python/ImplicitFunctions/SampleFunction.py | Python | 0.000001 | @@ -0,0 +1,1853 @@
+#!/usr/bin/env python%0A%0Aimport vtk%0A%0Adef main():%0A%09value = 2.0%0A%09colors = vtk.vtkNamedColors()%0A%09%0A%09implicitFunction = vtk.vtkSuperquadric()%0A%09implicitFunction.SetPhiRoundness(2.5)%0A%09implicitFunction.SetThetaRoundness(.5)%0A%09%0A%09# Sample the function.%0A%09sample = vtk.vt... | |
524f47a4d4e0db5b76dfb7ebf9447b6199e48b6d | Add data utils tests. | tests/test_data_utils_filetree.py | tests/test_data_utils_filetree.py | Python | 0 | @@ -0,0 +1,473 @@
+from uuid import uuid1%0Aimport json%0A%0Aimport pytest%0A%0Afrom flask_jsondash.data_utils import filetree%0A%0A%0Adef test_path_hierarchy(tmpdir):%0A uid = uuid1()%0A tmpfile = tmpdir.mkdir('%7B%7D'.format(uid))%0A data = filetree.path_hierarchy(tmpfile.strpath)%0A assert json.dumps(dat... | |
37d0843c76b558d6d7a1892963a30e9a56d73f24 | Document typical Stylesheet attributes | praw/models/stylesheet.py | praw/models/stylesheet.py | """Provide the Stylesheet class."""
from .base import PRAWBase
class Stylesheet(PRAWBase):
"""Represent a stylesheet."""
| Python | 0 | @@ -117,12 +117,783 @@
lesheet.
+%0A%0A **Typical Attributes**%0A%0A This table describes attributes that typically belong to objects of this%0A class. Since attributes are dynamically provided (see%0A :ref:%60determine-available-attributes-of-an-object%60), there is not a%0A guarantee that these attrib... |
4cde1f2fcc21ff83daabdb5221c462f44991c73f | Create remove-boxes.py | Python/remove-boxes.py | Python/remove-boxes.py | Python | 0.000002 | @@ -0,0 +1,1542 @@
+# Time: O(n%5E3) ~ O(n%5E4)%0A# Space: O(n%5E3)%0A%0A# Given several boxes with different colors represented by different positive numbers. %0A# You may experience several rounds to remove boxes until there is no box left.%0A# Each time you can choose some continuous boxes with the same color (comp... | |
06fb2c0371b9cfb5980351d45665d41fdcfae3b5 | Add MemoryMetric to Memory measurement | tools/perf/measurements/memory.py | tools/perf/measurements/memory.py | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from metrics import histogram
from telemetry.page import page_measurement
MEMORY_HISTOGRAMS = [
{'name': 'V8.MemoryExternalFragmentationTotal', 'uni... | Python | 0.000001 | @@ -189,16 +189,43 @@
stogram%0A
+from metrics import memory%0A
from tel
@@ -1013,16 +1013,174 @@
RAMS%5D)%0A%0A
+ self._memory_metric = None%0A%0A def DidStartBrowser(self, browser):%0A self._memory_metric = memory.MemoryMetric(browser)%0A self._memory_metric.Start()%0A%0A
def Di
@@ -2866,8 +2866,128 @... |
5d3cc76309d8cc3151410b1dfecdf4407f98a5f8 | Add missing docstrings | nikola/plugins/compile/markdown/__init__.py | nikola/plugins/compile/markdown/__init__.py | # -*- coding: utf-8 -*-
# Copyright © 2012-2017 Roberto Alsina and others.
# Permission is hereby granted, free of charge, to any
# person obtaining a copy of this software and associated
# documentation files (the "Software"), to deal in the
# Software without restriction, including without limitation
# the rights t... | Python | 0.021382 | @@ -1604,20 +1604,17 @@
ert
-to m
+M
arkdown
usin
@@ -1609,16 +1609,24 @@
arkdown
+to HTML
using pe
@@ -1651,16 +1651,46 @@
objects.
+%0A%0A See discussion in #2661.
%22%22%22%0A%0A
@@ -1722,16 +1722,58 @@
sions):%0A
+ %22%22%22Create a Markdown instance.%22%22%22%0A
|
9a5bfb7f5bf114bb4bcf2dd4c88ddd8924a97ed9 | add menu function to menu.py | menu.py | menu.py | Python | 0.000003 | @@ -0,0 +1,408 @@
+#!/usr/bin/end python %0A%0A# Text-based menu for use in pyWype.py %0A%0Adef menu(): %0A %22%22%22 Menu prompt for user to select program option %22%22%22%0A while True: %0A print 'I'%0A print 'II'%0A print 'III' %0A print 'IV'%0A print 'V'%0A%0A choice... | |
fb61398b6a0cdd4f40d16729ab2ff0ca47730526 | Add the main file | relay_api/__main__.py | relay_api/__main__.py | Python | 0.000004 | @@ -0,0 +1,359 @@
+from relay_api.api.server import server%0Afrom relay_api.conf.config import relays%0Aimport relay_api.api.server as api%0A%0A%0A@server.route(%22/relay-api/relays%22, methods=%5B%22GET%22%5D)%0Adef get_relays():%0A return api.get_relays(relays)%0A%0A%0A@server.route(%22/relay-api/relays/%3Cint:rel... | |
72a0d635e497f0f4c6c58d84f7001ec04063ea90 | Add mfnd.py that prints todays date | mfnd.py | mfnd.py | Python | 0 | @@ -0,0 +1,163 @@
+#!/usr/bin/env python3%0A%22%22%22%0AMFND - A simple to-do list application%0A%22%22%22%0A%0Aimport datetime%0A%0Atoday = datetime.date.today()%0A%0Aprint( today.strftime('MFND - %25B %25d, %25Y') )%0A
| |
d3469fd3ab39eeee381457588931636bf0987ea9 | Create impossible_bet.py | impossible_bet.py | impossible_bet.py | Python | 0.000821 | @@ -0,0 +1,1270 @@
+import random%0A%0A%0Adef play_bet(participants=100, times=1000, checks=50):%0A %22%22%22Simulate the bet x times with x participants.%22%22%22%0A wins = 0%0A losses = 0%0A for time in range(times):%0A boxes = list(range(1, participants + 1))%0A random.shuffle(boxes)%0A ... | |
aeabe6bb89a359e644c5adcb4c6456fd3428f6de | Stop using intersphinx | doc/source/conf.py | doc/source/conf.py | # -*- coding: utf-8 -*-
#
# -- General configuration ----------------------------------------------------
# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.inte... | Python | 0.000001 | @@ -287,48 +287,8 @@
c',%0A
- 'sphinx.ext.intersphinx',%0A
@@ -1964,140 +1964,4 @@
,%0A%5D%0A
-%0A# Example configuration for intersphinx: refer to the Python standard library.%0Aintersphinx_mapping = %7B'http://docs.python.org/': None%7D%0A
|
e8c2406cbcff96196d2404e9df167cc96f468779 | add sources api | mcp/interface/sources.py | mcp/interface/sources.py | Python | 0 | @@ -0,0 +1,779 @@
+import json%0A%0Afrom mcp import sources%0Afrom mcp.interface import common%0A%0Aclass SourcesHandler(common.AuthorizedHandler):%0A%09def forbidden(self):%0A%09%09return True%0A%0A%09def do_get(self):%0A%09%09return 200, json.dumps(list(iter(sources.source_db)))%0A%0Aclass SourceHandler(common.Author... | |
b75356d5325ce5b915f7bdb72c46fda53f190865 | Validate test mode schema as well | homeassistant/components/locative/__init__.py | homeassistant/components/locative/__init__.py | """
Support for Locative.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/locative/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.components.device_tracker import \
DOMAIN as DEV... | Python | 0 | @@ -187,16 +187,40 @@
s as vol
+%0Afrom typing import Dict
%0A%0Aimport
@@ -874,24 +874,385 @@
r'%0A%0A
-WEBHOOK_SCHEMA =
+%0Adef _id(value: str) -%3E str:%0A %22%22%22Coerce id by removing '-'.%22%22%22%0A return value.replace('-', '')%0A%0A%0Adef _validate_test_mode(obj: Dict) -%3E Dict:%0A %22%22%22Valid... |
6d0f65f70757ceca0da220e6c54b7ae164752547 | Use raise_from for less crummy python 3 tracebacks | invoke/context.py | invoke/context.py | import getpass
import re
from .config import Config, DataProxy
from .exceptions import Failure, AuthFailure, ResponseFailure
from .runners import Local
from .watchers import FailingResponder
class Context(DataProxy):
"""
Context-aware API wrapper & state-passing object.
`.Context` objects are created du... | Python | 0 | @@ -19,16 +19,58 @@
ort re%0A%0A
+from invoke.vendor.six import raise_from%0A%0A
from .co
@@ -6296,21 +6296,171 @@
-raise
+# NOTE: using raise_from(..., None) to suppress Python 3's%0A # %22helpful%22 multi-exception output. It's confusing here.%0A error =
AuthFai
@@ -6502,16... |
5dabba3941f870f3f365e186fdf852e834649595 | Move config to docs | homeassistant/components/sensor/eliqonline.py | homeassistant/components/sensor/eliqonline.py | """
homeassistant.components.sensor.eliqonline
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
monitors home energy use for the eliq online service
api documentation:
https://my.eliq.se/knowledge/sv-SE/49-eliq-online/299-eliq-online-api
access to api access token:
https://my.eliq.se/user/settings/api
current energy u... | Python | 0.000001 | @@ -83,17 +83,17 @@
~~~~~~~%0A
-m
+M
onitors
@@ -139,348 +139,146 @@
vice
+.
%0A%0A
-api documentation:%0A https://my.eliq.se/knowledge/sv-SE/49-eliq-online/299-eliq-online-api%0A%0Aaccess to api access token:%0A https://my.eliq.se/user/settings/api%0A%0Acurrent energy use:%0A https://my.eliq.se/api/datanow?acc... |
b2aa91648fe3ae915381e68cac95e5c3f6e5a182 | add zhihu_login.py | spider/login/zhihu_login.py | spider/login/zhihu_login.py | Python | 0 | @@ -0,0 +1,23 @@
+# coding:utf-8%0A# %E6%A8%A1%E6%8B%9F%E8%B4%A6%E6%88%B7%E7%99%BB%E5%BD%95
| |
b46a6189d9617396573903310a8b0a3d09b22fb0 | Proper abstract method def | python/thunder/imgprocessing/register.py | python/thunder/imgprocessing/register.py | from numpy import arange, ndarray, argmax, unravel_index
from thunder.rdds.images import Images
from thunder.utils.common import checkparams
class Register(object):
def __new__(cls, method="crosscorr"):
checkparams(method, ["crosscorr"])
if method == "crosscorr":
return super(Registe... | Python | 0.999986 | @@ -341,34 +341,16 @@
sCorr)%0A%0A
- @staticmethod%0A
def
@@ -355,32 +355,38 @@
f get_transform(
+self,
im, ref):%0A
@@ -387,39 +387,42 @@
-pass%0A%0A @staticmethod
+raise NotImplementedError%0A
%0A def
@@ -430,32 +430,38 @@
apply_transform(
+self,
im, transform):%0A
@@ -472,12 +4... |
c505927ae756fe1740e8603aadf23dae0ad12ff5 | Create 01.CenturiesToMinutes.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | TechnologiesFundamentals/ProgrammingFundamentals/DataTypesAndVariables-Lab/01.CenturiesToMinutes.py | Python | 0 | @@ -0,0 +1,232 @@
+centuries = int(input())%0Ayears = centuries * 100%0Adays = int(years * 365.2422)%0Ahours = days * 24%0Aminutes = hours * 60%0A%0Aprint(%22%25d centuries = %25d years = %25d days = %25d hours %25d = minutes%22 %25%0A (centuries, years, days, hours, minutes))%0A
| |
ab9800183b3ab229782016aa3f88e6825467d01b | Add forgot username tests | api/radar_api/tests/test_forgot_username.py | api/radar_api/tests/test_forgot_username.py | Python | 0 | @@ -0,0 +1,558 @@
+def test_forgot_username(app):%0A client = app.test_client()%0A%0A response = client.post('/forgot-username', data=%7B%0A 'email': 'foo@example.org'%0A %7D)%0A%0A assert response.status_code == 200%0A%0A%0Adef test_email_missing(app):%0A client = app.test_client()%0A%0A respo... | |
9b9fb4df30a8183c4de9f157200c5ff225d11d67 | Add the plot script | src/scripts/prepare_gnuplot.py | src/scripts/prepare_gnuplot.py | Python | 0.999689 | @@ -0,0 +1,1760 @@
+#!/usr/bin/python%0A%0Aimport sys%0Aimport argparse%0Aimport csv%0Afrom string import Template%0A%0Aparser = argparse.ArgumentParser(description='Prepare gnuplot script from the supplied data files.')%0Aparser.add_argument('files', nargs='+', help='The data files.')%0A%0AMIN_Y_RANGE = 0.000001%0A%0A... | |
d08f9cd114329a3ea66f84421b5abbfcf73c1f69 | Add timeout test | odo/backends/tests/test_url.py | odo/backends/tests/test_url.py | from __future__ import print_function
import pytest
from functools import partial
import codecs
import os
from odo import odo, resource, URL, discover, CSV, TextFile, convert
from odo.backends.url import sample
from odo.temp import _Temp, Temp
from odo.utils import tmpfile, raises
import datashape
try:
from ur... | Python | 0.000004 | @@ -2239,32 +2239,43 @@
odo(ftp_url, fn
+, timeout=5
)%0A path =
|
27a3ca8d746890c7404845d18b8031763ec6b6a7 | add netcat-nonblock.py | python/netcat-nonblock.py | python/netcat-nonblock.py | Python | 0.000001 | @@ -0,0 +1,3267 @@
+#!/usr/bin/python%0A%0Aimport errno%0Aimport fcntl%0Aimport os%0Aimport select%0Aimport socket%0Aimport sys%0A%0Adef setNonBlocking(fd):%0A flags = fcntl.fcntl(fd, fcntl.F_GETFL)%0A fcntl.fcntl(fd, fcntl.F_SETFL, flags %7C os.O_NONBLOCK)%0A%0A%0Adef nonBlockingWrite(fd, data):%0A try:%0A ... | |
34fd215d73d87c017cdae299aebd6484e6541991 | Revert 176254 > Android: upgrade sandbox_linux_unitests to a stable test > > > BUG=166704 > NOTRY=true > > Review URL: https://chromiumcodereview.appspot.com/11783106 | build/android/pylib/gtest/gtest_config.py | build/android/pylib/gtest/gtest_config.py | # Copyright (c) 2013 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.
"""Configuration file for android gtest suites."""
# Add new suites here before upgrading them to the stable list below.
EXPERIMENTAL_TEST_SUITES = [
]
... | Python | 0 | @@ -311,16 +311,47 @@
TES = %5B%0A
+ 'sandbox_linux_unittests',%0A
%5D%0A%0A# Do
@@ -714,39 +714,8 @@
s',%0A
- 'sandbox_linux_unittests',%0A
|
732fd24d06f49570c24016b7adfb3ad511e2e6af | Add test for ValidationResultIdentifier.to_tuple() | tests/data_context/test_data_context_resource_identifiers.py | tests/data_context/test_data_context_resource_identifiers.py | Python | 0.000004 | @@ -0,0 +1,2190 @@
+from great_expectations.data_context.types.resource_identifiers import (%0A ValidationResultIdentifier%0A)%0A%0A%0Adef test_ValidationResultIdentifier_to_tuple(expectation_suite_identifier):%0A validation_result_identifier = ValidationResultIdentifier(%0A expectation_suite_identifier,%0... | |
b3ef51e93b090451718ed4c1240b63b8e99cd085 | rename example | miepython/02_glass.py | miepython/02_glass.py | Python | 0.000515 | @@ -0,0 +1,787 @@
+#!/usr/bin/env python3%0A%0A%22%22%22%0APlot the scattering efficiency as a function of wavelength for 4micron glass spheres%0A%22%22%22%0A%0Aimport numpy as np%0Aimport matplotlib.pyplot as plt%0Aimport miepython%0A%0Anum = 100%0Aradius = 2 # in microns%0Alam = np.linspace(0.2,1... | |
d1fe5a06f5e082fd8196f510e2eba7daa3468ef8 | Add duplicate_nodes.py file | duplicate_nodes.py | duplicate_nodes.py | Python | 0.000003 | @@ -0,0 +1,656 @@
+from shutil import copytree, ignore_patterns%0Aimport glob%0Aimport os%0Aimport sys%0A%0A%0Aif __name__ == '__main__':%0A data_dir = './parsedData/'%0A use_symlink = True%0A%0A orig_nodes = os.listdir(data_dir)%0A orig_nodes = %5Bos.path.basename(i) for i in glob.glob(os.path.join(data_di... | |
77f812f76966b90c27131fd65968f548afcdcace | Add loader for basic csv layers without geoms | svir/dialogs/load_basic_csv_as_layer_dialog.py | svir/dialogs/load_basic_csv_as_layer_dialog.py | Python | 0 | @@ -0,0 +1,2826 @@
+# -*- coding: utf-8 -*-%0A# /***************************************************************************%0A# Irmt%0A# A QGIS plugin%0A# OpenQuake Integrated Risk Modelling Toolkit%0A# -------------------%0A# begin : 2... | |
f2a359664bf69a6c8e883d460a49c986b511b80e | add file | eptools/gspread.py | eptools/gspread.py | Python | 0 | @@ -0,0 +1,1445 @@
+%22%22%22%0AFunctions to access the data in google drive spreadsheets%0A%22%22%22%0A%0Aimport pandas as pd%0A%0Afrom docstamp.gdrive import (get_spreadsheet,%0A worksheet_to_dict)%0A%0A%0Adef get_ws_data(api_key_file, doc_key, ws_tab_idx, header=None, start_row=1):%0A... | |
04876b4bea96f983c722cb9bf7845c7cc3b0ecef | add oauth2 example | examples/oauth2.py | examples/oauth2.py | Python | 0 | @@ -0,0 +1,233 @@
+from imap_tools import MailBox%0A%0A# Authenticate to account using OAuth 2.0 mechanism%0Awith MailBox('imap.my.ru').xoauth2('user', 'token123', 'INBOX') as mailbox:%0A for msg in mailbox.fetch():%0A print(msg.date_str, msg.subject)%0A
| |
c9a0fb540a9ee8005c1ee2d70613c39455891bee | Add analyze_bound_horizontal tests module | tests/plantcv/test_analyze_bound_horizontal.py | tests/plantcv/test_analyze_bound_horizontal.py | Python | 0.000001 | @@ -0,0 +1,1599 @@
+import pytest%0Aimport cv2%0Afrom plantcv.plantcv import analyze_bound_horizontal, outputs%0A%0A%0A@pytest.mark.parametrize('pos,exp', %5B%5B200, 58%5D, %5B-1, 0%5D, %5B100, 0%5D, %5B150, 11%5D%5D)%0Adef test_analyze_bound_horizontal(pos, exp, test_data):%0A # Clear previous outputs%0A outputs... | |
198cf78895db88a8986926038e817ebb2bf75eb2 | add migration for notification tables | portal/migrations/versions/458dd2fc1172_.py | portal/migrations/versions/458dd2fc1172_.py | Python | 0 | @@ -0,0 +1,1399 @@
+from alembic import op%0Aimport sqlalchemy as sa%0A%0A%0A%22%22%22empty message%0A%0ARevision ID: 458dd2fc1172%0ARevises: 8ecdd6381235%0ACreate Date: 2017-12-21 16:38:49.659073%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '458dd2fc1172'%0Adown_revision = '8ecdd6381235'%0... | |
8c7fa4e16805dc9e8adbd5615c610be8ba92c444 | Add argparse tests for gatherkeys | ceph_deploy/tests/parser/test_gatherkeys.py | ceph_deploy/tests/parser/test_gatherkeys.py | Python | 0 | @@ -0,0 +1,1058 @@
+import pytest%0A%0Afrom ceph_deploy.cli import get_parser%0A%0A%0Aclass TestParserGatherKeys(object):%0A%0A def setup(self):%0A self.parser = get_parser()%0A%0A def test_gather_help(self, capsys):%0A with pytest.raises(SystemExit):%0A self.parser.parse_args('gatherkeys... | |
2803b237af18c6d5cd0613eaf4eccf2b61e65100 | Create afImgPanel.py | scripts/afImgPanel.py | scripts/afImgPanel.py | Python | 0.000001 | @@ -0,0 +1,885 @@
+import pymel.core as pm%0Aimport pymel.all as pa%0A%0AimgOp = 0.3%0AimgDep = 10%0A%0A#get current camera%0AcurCam = pm.modelPanel(pm.getPanel(wf=True),q=True,cam=True)%0A#select image and creat imagePlane and setup%0AfileNm = pm.fileDialog2(ds=0,fm=1,cap='open',okc='Select Image')%0AImgPln = pm.image... | |
f24fe32329625ec037a9afc8d3bdeed5f41e69a0 | Add a script for easy diffing of two Incars. | scripts/diff_incar.py | scripts/diff_incar.py | Python | 0.999906 | @@ -0,0 +1,1158 @@
+#!/usr/bin/env python%0A%0A'''%0ACreated on Nov 12, 2011%0A'''%0A%0A__author__=%22Shyue Ping Ong%22%0A__copyright__ = %22Copyright 2011, The Materials Project%22%0A__version__ = %220.1%22%0A__maintainer__ = %22Shyue Ping Ong%22%0A__email__ = %22shyue@mit.edu%22%0A__date__ = %22Nov 12, 2011%22%0A%0Ai... | |
918ab0bdd0a828c87233129069302199a886f805 | Fix not looping issue in uix/video.py | kivy/uix/video.py | kivy/uix/video.py | '''
Video
=====
The :class:`Video` widget is used to display video files and streams.
Depending on your Video core provider, platform, and plugins, you will
be able to play different formats. For example, the pygame video
provider only supports MPEG1 on Linux and OSX. GStreamer is more
versatile, and can read many vid... | Python | 0.000001 | @@ -4089,16 +4089,92 @@
_load)%0A%0A
+ if %22eos%22 in kwargs:%0A self.options%5B%22eos%22%5D = kwargs%5B%22eos%22%5D%0A
|
c36ae47bee44ff8aa8eaf17f8ded88192d7a6573 | implement query term search | queryAnswer.py | queryAnswer.py | Python | 0.999171 | @@ -0,0 +1,521 @@
+import pickle%0A# Loads the posting Index%0Aindex = open(%22posIndex.dat%22, %22rb%22);%0AposIndex = pickle.load(index);%0Aprint posIndex%5B'made'%5D;%0A%0Aquery = %22Juan made of youtube%22%0A# query = raw_input('Please enter your query: ');%0A%0AqueryTerms = ' '.join(query.split());%0AqueryTerms =... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.