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 |
|---|---|---|---|---|---|---|---|
a0bd114b8caf75d28bc52a3aba10494660e6735a | Add lc0138_copy_list_with_random_pointer.py | lc0138_copy_list_with_random_pointer.py | lc0138_copy_list_with_random_pointer.py | Python | 0.000001 | @@ -0,0 +1,1060 @@
+%22%22%22Leetcode 138. Copy List with Random Pointer%0AMedium%0A%0AURL: https://leetcode.com/problems/copy-list-with-random-pointer/%0A%0AA linked list is given such that each node contains an additional %0Arandom pointer which could point to any node in the list or null.%0A%0AReturn a deep copy of ... | |
f8bde0dd523a46d81a64f9b3bd8633be0bf6676d | Create an exception to throw when a user tries to tag a bad commit | webserver/codemanagement/exceptions.py | webserver/codemanagement/exceptions.py | Python | 0.000001 | @@ -0,0 +1,51 @@
+class CodeManagementException(Exception):%0A pass%0A
| |
1120f16569e1bc9c9675a9cefd782b09266cd82c | Add initial k-means algo | avocado/stats/kmeans.py | avocado/stats/kmeans.py | Python | 0.999978 | @@ -0,0 +1,1384 @@
+import math%0Afrom random import random%0Afrom collections import namedtuple%0A%0APoint = namedtuple('Point', ('coords', 'n', 'ct'))%0ACluster = namedtuple('Cluster', ('points', 'center', 'n'))%0A%0A%0Adef euclidean(p1, p2):%0A return math.sqrt(sum(%5B%0A (p1.coords%5Bi%5D - p2.coords%5Bi%... | |
abf2fa18769470d93adf9c0c4113b0d13c55836d | Fixed a typo. | tensorflow/python/profiler/profiler_client.py | tensorflow/python/profiler/profiler_client.py | # Copyright 2020 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.999721 | @@ -2283,18 +2283,19 @@
ing in m
-l
i
+ll
iseconds
|
f1cfe335dce4c57778d28f0cbf0be48447b60805 | normalize pressure and radius, according to python-for-android / API doc | kivy/input/providers/androidjoystick.py | kivy/input/providers/androidjoystick.py | # pylint: disable=W0611
__all__ = ('AndroidMotionEventProvider', )
import os
try:
import android
except ImportError:
if 'KIVY_DOC' not in os.environ:
raise Exception('android lib not found.')
from kivy.logger import Logger
from kivy.input.provider import MotionEventProvider
from kivy.input.factory im... | Python | 0 | @@ -2167,45 +2167,125 @@
s(2)
-%0A radius = joy.get_axis(3)
+ / 1000. # python for android do * 1000.%0A radius = joy.get_axis(3) / 1000. # python for android do * 1000.
%0A%0A
|
1de5cfe8714c140a79358e4287645f21095abad7 | Create sarafu.py | sarafu.py | sarafu.py | Python | 0.000002 | @@ -0,0 +1,34 @@
+def (sarafu)%0A print (%22sarafu%22)%0A
| |
d8878fdfae5e4ca61de8b980bbc753f9e86ac655 | Add botaddnitf plugin | hangupsbot/plugins/botaddnotif.py | hangupsbot/plugins/botaddnotif.py | Python | 0.000001 | @@ -0,0 +1,1046 @@
+%22%22%22%0APlugin for monitoring if bot is added to a HO and report it to the bot admins.%0AAdd a %22botaddnotif_enable%22: true parameter in the config.json file.%0A%0AAuthor: @cd334%0A%22%22%22%0A%0Aimport asyncio %0Aimport logging%0Aimport hangups%0Aimport plugins%0A%0Alogger = logging.getLogge... | |
c2207ed347ab4d804cb7ea966eace6ea93a41326 | Create sensor.py | sensor.py | sensor.py | Python | 0.000002 | @@ -0,0 +1,790 @@
+import RPi.GPIO as gpio%0Aimport time%0A%0Adef distance(measure='cm'):%0A try:%0A gpio.setmode(gpio.BOARD)%0A gpio.setup(12, gpio.OUT)%0A gpio.setup(16, gpio.IN)%0A %0A gpio.output(12, False)%0A while gpio.input(16) == 0:%0A nosig = time.time()%... | |
5ac2e849fbf4857f7b449cdd39608ba053bddf6e | add main func | ExtractLevelDomain.py | ExtractLevelDomain.py | Python | 0.001334 | @@ -0,0 +1,3002 @@
+#coding=utf-8%0Aimport re%0Afrom urlparse import urlparse%0A%0Aclass ExtractLevelDomain():%0A%0A def __init__(self):%0A self.topHostPostfix = (%0A '.com','.la','.io',%0A '.co', '.cn','.info',%0A '.net', '.org','.me',%0A '.mobi', '.us', '.biz',%0A... | |
2350045ae48f0f5b7fcf5162c1dc82c198fc4db2 | add note about default Options in tracker | ForgeTracker/forgetracker/widgets/admin_custom_fields.py | ForgeTracker/forgetracker/widgets/admin_custom_fields.py | import ew as ew_core
import ew.jinja2_ew as ew
from allura.lib.widgets import form_fields as ffw
from allura.lib.widgets import forms as f
from pylons import c
from forgetracker import model
from formencode import validators as fev
class MilestonesAdmin(ffw.SortableTable):
defaults=dict(
ffw.SortableTabl... | Python | 0 | @@ -2671,16 +2671,138 @@
options'
+,%0A label='Options (separate with spaces; prefix with * to set a default)',%0A
)) %5D,%0A
|
fd0e09e11d41d1d7b64f7bf592b788fda8b86e3e | Create archive_identifier.py | identifiers/archive_identifier.py | identifiers/archive_identifier.py | Python | 0.000001 | @@ -0,0 +1,206 @@
+from identifier import Result%0A%09%0ACAB_PATTERNS = %5B%0A%09'4D 53 43 46'%0A%5D%0A%09%0Aclass CabResolver:%0A%09def identify(self, stream):%0A%09%09return Result('CAB')%0A%09%0Adef load(hound):%0A%09hound.add_matches(CAB_PATTERNS, CabResolver())%0A
| |
bb619aa09132dbd970d2b78e23fecbd78ee774de | Create new package. (#6191) | var/spack/repos/builtin/packages/r-aneufinder/package.py | var/spack/repos/builtin/packages/r-aneufinder/package.py | Python | 0 | @@ -0,0 +1,2813 @@
+##############################################################################%0A# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.%0A# Produced at the Lawrence Livermore National Laboratory.%0A#%0A# This file is part of Spack.%0A# Created by Todd Gamblin, tgamblin@llnl.gov, All r... | |
d604429f1d27f8753b8d9665a55111a3b90f0699 | Add homebrew version of fluentd logger | scrapi/util/logging.py | scrapi/util/logging.py | Python | 0 | @@ -0,0 +1,1152 @@
+import logging%0Afrom datetime import datetime%0A%0Afrom fluent import sender%0A%0A%0Aclass FluentHandler(logging.Handler):%0A '''%0A Logging Handler for fluent.%0A '''%0A def __init__(self,%0A tag,%0A host='localhost',%0A port=24224,%0A ... | |
cfeb4fbfa44b597772f1eb63d828e605f9e39396 | Add server | server.py | server.py | Python | 0.000001 | @@ -0,0 +1,1836 @@
+import argparse%0Aimport os%0Aimport signal%0Aimport subprocess%0A%0Adef parse_args():%0A parser = argparse.ArgumentParser()%0A parser.add_argument('operation',%0A choices=%5B'start', 'stop', 'restart'%5D,%0A help='start/stop/restart the server')%0... | |
8fda2e1330277e98b62d3286e5c208d320fc07db | Add simple api to redis with flask | server.py | server.py | Python | 0 | @@ -0,0 +1,788 @@
+from flask import Flask%0Afrom flask import json%0Afrom flask import Response%0Aimport redis%0A%0Aapp = Flask(__name__)%0Ar = redis.StrictRedis(host='localhost', port=6379, db=0)%0A%0A@app.route(%22/%22)%0Adef hello():%0A return %22Hello ld!%22%0A%0A@app.route('/properties/')%0Adef show_properties... | |
ef108d756ae91925ca0afec280151974eae4a696 | add import script to load existing data in influxdb, optional | scripts/influxdb_import.py | scripts/influxdb_import.py | Python | 0 | @@ -0,0 +1,2289 @@
+'''%0AImport biomaj banks statistics in Influxdb if never done before.....%0A'''%0Afrom influxdb import InfluxDBClient%0Afrom biomaj.bank import Bank%0Afrom biomaj_core.config import BiomajConfig%0Aimport sys%0A%0Aif len(sys.argv) != 1:%0A print('Usage: influxdb_import.py path_to_global.propertie... | |
aeea3331adc97209d3e3099baa9847b6f7646316 | Fix python-2.6 support | powerline/lint/markedjson/markedvalue.py | powerline/lint/markedjson/markedvalue.py | __all__ = ['gen_marked_value', 'MarkedValue']
try:
from __builtin__ import unicode
except ImportError:
unicode = str
def gen_new(cls):
def __new__(arg_cls, value, mark):
r = super(arg_cls, arg_cls).__new__(arg_cls, value)
r.mark = mark
r.value = value
return r
return __new__
def gen_init(cls):
def __... | Python | 0 | @@ -1381,27 +1381,28 @@
t(dict):%0A%09__
-new
+init
__ = gen_new
@@ -1398,19 +1398,20 @@
_ = gen_
-new
+init
(dict)%0A%09
@@ -1452,35 +1452,37 @@
ct)%0A%0A%09def __
-init__(self
+new__(arg_cls
, value, mar
@@ -1491,41 +1491,97 @@
:%0A%09%09
-dict.__init__(self, value)%0A%09%09self
+r = super(arg_cls, arg_cls).__... |
540f913d6b9402512bc2b507504f77f709c17eca | add exec example | examples/exec.py | examples/exec.py | Python | 0 | @@ -0,0 +1,2112 @@
+%22%22%22%0AExample uses of exec.%0A%0Aexec is a special form which takes 1, 2, or 3 arguments.%0Aexec(expr, globals, locals)%0Alocals and globals are optional.%0Aexpr is a string to be executed as code.%0Aglobals is a dictionary from symbol names to values.%0Alocals is a dictionary from symbol name... | |
c48b6ea55969adff7e0662c551a529161a4d0b94 | add kattis/stockprices | Kattis/stockprices.py | Kattis/stockprices.py | Python | 0.000001 | @@ -0,0 +1,2154 @@
+%22%22%22%0D%0AProblem: stockprices%0D%0ALink: https://open.kattis.com/problems/stockprices%0D%0ASource: NWERC 2010%0D%0A%22%22%22%0D%0Aimport queue%0D%0Aimport sys%0D%0A%0D%0Adef runTest():%0D%0A N = int(input())%0D%0A buyHeap = queue.PriorityQueue() # MinHeap%0D%0A sellHeap = queue.Prio... | |
a3780ebd969d95873a589968fb778a3553c24128 | Fix LXDContainer.container_running | pylxd/container.py | pylxd/container.py | # Copyright (c) 2015 Canonical 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 applicable law or ... | Python | 0.002618 | @@ -1208,17 +1208,20 @@
FREEZING
-,
+', '
FROZEN',
|
b01445701c2974c0f69c9a43208111f0b80a167f | Create helloWorld.py | helloWorld.py | helloWorld.py | Python | 0.999992 | @@ -0,0 +1,21 @@
+print %22Hello World!%22%0A
| |
9ad2a898298667aa6adfbf0c4e786e431c9a96b1 | test test test | python-ver/test.py | python-ver/test.py | Python | 0.000008 | @@ -0,0 +1,23 @@
+print 'blah blah blah'%0A
| |
27575c3fd6bdc55748b808a98c0b19e3edfb17af | Create ShakeBoussole.py | sense-hat/ShakeBoussole.py | sense-hat/ShakeBoussole.py | Python | 0 | @@ -0,0 +1,1064 @@
+from sense_hat import SenseHat%0Aimport time%0Aimport sys%0A%0Asense = SenseHat()%0A%0Aled_loop = %5B4, 5, 6, 7, 15, 23, 31, 39, 47, 55, 63, 62, 61, 60, 59, 58, 57, 56, 48, 40, 32, 24, 16, 8, 0, 1, 2, 3%5D%0A%0Asense = SenseHat()%0Asense.set_rotation(0)%0Asense.clear()%0A%0Aprev_x = 0%0Aprev_y = 0%0... | |
fb96906301515b268d56bb7a494360f794883223 | include migration for uniq | metaci/release/migrations/0002_auto_20180815_2248.py | metaci/release/migrations/0002_auto_20180815_2248.py | Python | 0 | @@ -0,0 +1,476 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.10 on 2018-08-15 22:48%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('repository', '0005_repository_release_tag_regex'),%0A ... | |
c503471f3d7318a2519b486b8be74ec1d1f2e235 | Add an admin interface for xmlrpc tokens | linaro_django_xmlrpc/admin.py | linaro_django_xmlrpc/admin.py | Python | 0.000002 | @@ -0,0 +1,247 @@
+from django.contrib import admin%0A%0Afrom linaro_django_xmlrpc.models import AuthToken%0A%0A%0Aclass AuthTokenAdmin(admin.ModelAdmin):%0A list_display = ('user', 'description', 'created_on', 'last_used_on')%0A%0Aadmin.site.register(AuthToken, AuthTokenAdmin)%0A
| |
a0702b8ac74c4976cf747880bdfeb86088a16715 | CREATE new Syft Message structure | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | packages/syft/src/syft/core/node/common/node_service/generic_payload/syft_message.py | Python | 0 | @@ -0,0 +1,975 @@
+# stdlib%0Afrom typing import Any%0Afrom typing import Dict%0Afrom typing import Optional%0A%0A# third party%0Afrom nacl.signing import VerifyKey%0A%0A# relative%0Afrom .....common.message import ImmediateSyftMessage, SignedMessage%0Afrom .....common.uid import UID%0Afrom .....io.address import Addre... | |
b6b65e1a26a45d45d98e5f270f6704d286335605 | Split run method into __init__ and treat method | scripts/unusedfiles.py | scripts/unusedfiles.py | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""
This bot appends some text to all unused images and notifies uploaders.
Parameters:
-always Don't be asked every time.
"""
#
# (C) Leonardo Gregianin, 2007
# (C) Filnik, 2008
# (c) xqt, 2011-2014
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT ... | Python | 0.000715 | @@ -934,56 +934,8 @@
te%0A%0A
- def run(self):%0A %22%22%22Start the bot.%22%22%22%0A
@@ -973,32 +973,32 @@
late(self.site,%0A
+
@@ -1400,32 +1400,122 @@
%25 self.site)%0A
+%0A self.template_image = template_image%0A self.template_user = template_user%0A%0A
... |
af61a720abe964c2295d8f0aa555fed9bb67372a | add 4 | 004.py | 004.py | Python | 0.999998 | @@ -0,0 +1,204 @@
+def pal(value):%0A return str(value) == str(value)%5B::-1%5D%0A%0A%0Ap = 1%0A%0Afor i in xrange(999, 99, -1):%0A for j in xrange(999, 99, -1):%0A n = i * j%0A if n %3E p and pal(n):%0A p = n%0A%0Aprint p
| |
ee1e049a4cbe47ce106824612a69d738562eceb3 | add simple test for testing that view change messages are checked on the receiver side | plenum/test/view_change/test_instance_change_msg_checking.py | plenum/test/view_change/test_instance_change_msg_checking.py | Python | 0 | @@ -0,0 +1,348 @@
+import pytest%0Aimport types%0Afrom plenum.common.types import InstanceChange%0A%0Adef test_instance_change_msg_type_checking(nodeSet, looper, up):%0A nodeA = nodeSet.Alpha%0A nodeB = nodeSet.Beta%0A %0A ridBetta = nodeA.nodestack.getRemote(nodeB.name).uid%0A badViewNo = %22BAD%22%0A ... | |
e1b47df9fadb888dafc32abc8018b15477d74feb | Add python test unit. | fpsgame/tests.py | fpsgame/tests.py | Python | 0 | @@ -0,0 +1,247 @@
+from ctypes import *%0Aimport sys%0Aimport os%0Aimport xml.etree.ElementTree as ET%0A%0Abinaries = '../../../binaries'%0A%0A# Work out the platform-dependent library filename%0Adll_filename = %7B%0A%09'posix': './libCollada_dbg.so',%0A%09'nt': 'Collada_dbg.dll',%0A%7D%5Bos.name%5D
| |
412d27b31dc5644c84ac90179fe74669ce8a406c | change description & goal from varchar(100) to text | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | talkoohakemisto/migrations/versions/221e6ee3f6c9_adjust_goal_and_description_size.py | Python | 0 | @@ -0,0 +1,862 @@
+%22%22%22adjust goal and description size%0A%0ARevision ID: 221e6ee3f6c9%0ARevises: 27f12bb68b12%0ACreate Date: 2014-04-12 17:04:16.750942%0A%0A%22%22%22%0A%0A# revision identifiers, used by Alembic.%0Arevision = '221e6ee3f6c9'%0Adown_revision = '27f12bb68b12'%0A%0Afrom alembic import op%0Aimport sql... | |
8c1f1c0728b261526b19c46dbd459bbc0f4e97a8 | add leetcode Maximum Depth of Binary Tree | leetcode/MaximumDepthOfBinaryTree/solution.py | leetcode/MaximumDepthOfBinaryTree/solution.py | Python | 0.00001 | @@ -0,0 +1,428 @@
+# -*- coding:utf-8 -*-%0A# Definition for a binary tree node%0A# class TreeNode:%0A# def __init__(self, x):%0A# self.val = x%0A# self.left = None%0A# self.right = None%0A%0Aclass Solution:%0A # @param root, a tree node%0A # @return an integer%0A def maxDepth(self... | |
558c68060903608abe0bbe15303f192eacf529eb | Add way to call converters/harvesters in 0.2.0 | proto_main.py | proto_main.py | Python | 0 | @@ -0,0 +1,1152 @@
+from importlib import import_module%0A%0A%0Adef call_harvester(source_name, **kwargs):%0A harvester = import_module(%22mdf_indexers.harvesters.%22 + source_name + %22_harvester%22)%0A harvester.harvest(**kwargs)%0A%0A%0Adef call_converter(sources, input_path=None, metadata=None, verbose=False):%... | |
ebe0b558d80ca7b7e5e7be50cc7c053020dca9fe | create list app skeleton | app.py | app.py | Python | 0.000002 | @@ -0,0 +1,701 @@
+#!/usr/bin/env python%0Afrom flask import Flask%0A%0Aapp = Flask(__name__)%0A%0A# define a list item class%0Aclass ListItem(Model):%0A %0A@app.route('/add', methods=%5B'POST'%5D)%0Adef add_item():%0A ''' add items to the list '''%0A return %22stub%22%0A%0A@app.route('/view')%0Adef view_items()... | |
a23eb3f9a921676a3b91ff48b073f9cf4d15cfaa | Create bot.py | bot.py | bot.py | Python | 0.000001 | @@ -0,0 +1,1125 @@
+from twython import Twython, TwythonError%0Afrom PIL import Image%0Aimport os, random, statistics, time%0A%0AAPP_KEY = ''%0AAPP_SECRET = ''%0AOAUTH_TOKEN = ''%0AOAUTH_TOKEN_SECRET = ''%0A%0Abrightness_threshold = 35%0Aseconds_between_tweets = 600%0A%0Adef tweet():%0A%09twitter = Twython(APP_KEY, APP... | |
3bb4f078f2a03b334c2b44378be2b01e54fb7b37 | Add command load beginner categories | datasets/management/commands/load_beginner_categories.py | datasets/management/commands/load_beginner_categories.py | Python | 0.000001 | @@ -0,0 +1,983 @@
+from django.core.management.base import BaseCommand%0Aimport json%0Afrom datasets.models import Dataset, TaxonomyNode%0A%0A%0Aclass Command(BaseCommand):%0A help = 'Load field easy categories from json taxonomy file. ' %5C%0A 'Use it as python manage.py load_beginner_categories.py ' %5C%... | |
a06995a686c0509f50a481e7d7d41bb35ffe8f19 | add simple improved Sieve Of Eratosthenes Algorithm (#1412) | maths/prime_sieve_eratosthenes.py | maths/prime_sieve_eratosthenes.py | Python | 0 | @@ -0,0 +1,801 @@
+'''%0ASieve of Eratosthenes%0A%0AInput : n =10%0AOutput : 2 3 5 7 %0A%0AInput : n = 20 %0AOutput: 2 3 5 7 11 13 17 19%0A%0Ayou can read in detail about this at %0Ahttps://en.wikipedia.org/wiki/Sieve_of_Eratosthenes%0A'''%0A%0Adef prime_sieve_eratosthenes(num):%0A %22%22%22%0A print the prime nu... | |
e7ab5b39042f3a224a150257dd1aa845e7bb1adc | Add back a missing import | common/djangoapps/xblock_django/models.py | common/djangoapps/xblock_django/models.py | """
Models.
"""
from django.db import models
from django.utils.translation import ugettext_lazy as _
from config_models.models import ConfigurationModel
class XBlockDisableConfig(ConfigurationModel):
"""
Configuration for disabling and deprecating XBlocks.
"""
class Meta(ConfigurationModel.Meta):
... | Python | 0.000081 | @@ -39,16 +39,55 @@
models%0A
+from django.db.models import TextField%0A
from dja
|
b92625f1fa381f079d81e67b34d9f03e9c8a2282 | Update help for nbgrader autograde | nbgrader/apps/autogradeapp.py | nbgrader/apps/autogradeapp.py | from textwrap import dedent
from IPython.config.loader import Config
from IPython.utils.traitlets import Unicode, Bool, Dict
from IPython.nbconvert.preprocessors import ClearOutputPreprocessor
from nbgrader.apps.baseapp import (
BaseNbConvertApp, nbconvert_aliases, nbconvert_flags)
from nbgrader.preprocessors imp... | Python | 0 | @@ -453,46 +453,8 @@
e(%7B%0A
- 'regexp': 'FindStudentID.regexp',%0A
@@ -1227,16 +1227,95 @@
t.ipynb%22
+ (note that you need to specify the assignment%0A name and the student id)
:%0A
@@ -1359,24 +1359,72 @@
lem 1.ipynb%22
+ --assignment=%22Problem Set 1%22 --student=student1
%0A%0A I... |
e6e92fb3afff0403091c221328f9023e0e391b0b | Add eventlisten script to watch events on the master and minion | tests/eventlisten.py | tests/eventlisten.py | Python | 0 | @@ -0,0 +1,1651 @@
+'''%0AUse this script to dump the event data out to the terminal. It needs to know%0Awhat the sock_dir is.%0A%0AThis script is a generic tool to test event output%0A'''%0A%0A# Import Python libs%0Aimport optparse%0Aimport pprint%0Aimport os%0Aimport time%0Aimport tempfile%0A%0A# Import Salt libs%0Ai... | |
703d97150de1c74b7c1a62b59c1ff7081dec8256 | Add an example of resolving a known service by service name | examples/resolver.py | examples/resolver.py | Python | 0.998661 | @@ -0,0 +1,537 @@
+#!/usr/bin/env python3%0A%0A%22%22%22 Example of resolving a service with a known name %22%22%22%0A%0Aimport logging%0Aimport sys%0A%0Afrom zeroconf import Zeroconf%0A%0ATYPE = '_test._tcp.local.'%0ANAME = 'My Service Name'%0A%0Aif __name__ == '__main__':%0A logging.basicConfig(level=logging.DEBUG... | |
b95ad416428333b949a2e89eec9f18f45fb82e19 | Add OmegaTFT to strategies list | axelrod/strategies/_strategies.py | axelrod/strategies/_strategies.py | from __future__ import absolute_import
from .alternator import Alternator
from .apavlov import APavlov2006, APavlov2011
from .appeaser import Appeaser
from .averagecopier import AverageCopier, NiceAverageCopier
from .axelrod_first import (Davis, RevisedDowning, Feld, Grofman, Nydegger,
Joss... | Python | 0 | @@ -3363,24 +3363,38 @@
Nydegger,%0A
+ OmegaTFT,%0A
OnceBitt
|
039a07bde5975cb6ce40edc43bbd3d931ac5cc92 | Test borda ranking and spearman. | exp/influence2/test/RankAggregatorTest.py | exp/influence2/test/RankAggregatorTest.py | Python | 0 | @@ -0,0 +1,1261 @@
+import numpy %0Aimport unittest%0Aimport logging%0Afrom exp.influence2.RankAggregator import RankAggregator %0Aimport scipy.stats.mstats %0Aimport numpy.testing as nptst %0A%0A%0Aclass RankAggregatorTest(unittest.TestCase):%0A def setUp(self): %0A numpy.random.seed(22) %0A %0A %0A ... | |
afec3bf59fd454d61d5bc0024516610acfcb5704 | Add 1D data viewer. | examples/viewer1D.py | examples/viewer1D.py | Python | 0 | @@ -0,0 +1,1522 @@
+from __future__ import print_function%0A%0Aimport numpy as np%0Afrom viewer import Viewer%0A%0Afrom enthought.traits.api import Array%0Afrom enthought.chaco.api import Plot, ArrayPlotData, HPlotContainer, gray%0A%0Aimport lulu%0A%0Aclass Viewer1D(Viewer):%0A image = Array%0A result = Array%0A%... | |
d9ff51c74c4b41128bc8e2fe61811dba53e7da17 | Create test_client.py | tests/test_client.py | tests/test_client.py | Python | 0.000003 | @@ -0,0 +1,668 @@
+import unittest%0Afrom app import create_app, db%0Afrom app.models import User, Role%0A%0Aclass FlaskClientTestCase(unittest.TestCase):%0A def setUp(self):%0A self.app = create_app('testing')%0A self.app_context = self.app.app_context()%0A self.app_context.push()%0A db.... | |
d37d831e54fbaebab427c9a5b88cb7eb358b31af | transform data to website via Post & Get | WebScraping/4.py | WebScraping/4.py | Python | 0 | @@ -0,0 +1,304 @@
+#!/usr/bin/python%0A# encoding:utf-8%0A%0Aimport sys%0Aimport urllib, urllib2%0Aimport re%0A%0Adic = %7B'hostname': 'n2', 'ip': '2.2.2.2'%7D%0A%0A# url = 'http://127.0.0.1:8000/db/' + '?' + urllib.urlencode(dic)%0Aurl = 'http://127.0.0.1:8000/db/'%0A%0A%0Aresponse = urllib2.urlopen(url, urllib.urlenc... | |
35a9576dce86c9c3d32c6cc32effb7a8f6c2b706 | Test DjangoAMQPConnection if Django is installed. Closes #10. | tests/test_django.py | tests/test_django.py | Python | 0 | @@ -0,0 +1,1794 @@
+import os%0Aimport sys%0Aimport unittest%0Aimport pickle%0Aimport time%0Asys.path.insert(0, os.pardir)%0Asys.path.append(os.getcwd())%0A%0Afrom tests.utils import AMQP_HOST, AMQP_PORT, AMQP_VHOST, %5C%0A AMQP_USER, AMQP_PASSWORD%0Afrom carrot.connection import DjangoAMQPConnec... | |
0390209498c2a604efabe13595e3f69f7dcbd577 | Add script for path init. | tools/init.py | tools/init.py | Python | 0 | @@ -0,0 +1,715 @@
+#!/usr/bin/env python%0A%0A%22%22%22Setup paths for TPN%22%22%22%0A%0A%0Aimport os.path as osp%0Aimport sys%0A%0Adef add_path(path):%0A if path not in sys.path:%0A sys.path.insert(0, path)%0A%0Athis_dir = osp.dirname(__file__)%0Aext_dir = osp.join(this_dir, '..', 'external')%0A%0A# Add py-f... | |
bcfd9808377878f440cc030178b33e76eb4f031c | Add presubmit check to catch use of PRODUCT_NAME in resources. | chrome/app/PRESUBMIT.py | chrome/app/PRESUBMIT.py | Python | 0.00004 | @@ -0,0 +1,1770 @@
+# Copyright 2013 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0A%22%22%22Presubmit script for changes affecting chrome/app/%0A%0ASee http://dev.chromium.org/developers/how-tos/depottools/presub... | |
f2807e7505598abdc0f11c8d593655c3dc61c323 | add legislative.apps | opencivicdata/legislative/apps.py | opencivicdata/legislative/apps.py | Python | 0.000025 | @@ -0,0 +1,202 @@
+from django.apps import AppConfig%0Aimport os%0A%0A%0Aclass BaseConfig(AppConfig):%0A name = 'opencivicdata.legislative'%0A verbose_name = 'Open Civic Data - Legislative'%0A path = os.path.dirname(__file__)%0A
| |
cd7364467de45d63e89eab4e745e29dff9906f69 | Add crawler for 'dogsofckennel' | comics/comics/dogsofckennel.py | comics/comics/dogsofckennel.py | Python | 0.998466 | @@ -0,0 +1,541 @@
+from comics.aggregator.crawler import CreatorsCrawlerBase%0Afrom comics.core.comic_data import ComicDataBase%0A%0A%0Aclass ComicData(ComicDataBase):%0A name = 'Dogs of C-Kennel'%0A language = 'en'%0A url = 'https://www.creators.com/read/dogs-of-c-kennel'%0A rights = 'Mason Mastroianni, Mi... | |
0c1ae2fb40e5af5cf732e7ec8e10d2e145be2eb2 | add run.py | run.py | run.py | Python | 0.000003 | @@ -0,0 +1,108 @@
+%22%22%22Simple Migrator.%22%22%22%0A__author__ = 'bkzhn'%0A%0A%0Aif __name__ == '__main__':%0A print('== Simple Migrator ==')%0A
| |
0d6a31ade487bea9f0b75b1c3e295176fb3a7555 | Add savecpython script | tools/savecpython.py | tools/savecpython.py | Python | 0.000001 | @@ -0,0 +1,2206 @@
+# -*- coding: utf-8 -*-%0Aimport urllib, urllib2%0Afrom datetime import datetime%0A%0ASPEEDURL = 'http://127.0.0.1:8000/'#'http://speed.pypy.org/'%0AHOST = %22bigdog%22%0A%0Adef save(project, revision, results, options, branch, executable, int_options, testing=False):%0A testparams = %5B%5D%0A ... | |
91773cb6a09f710002e5be03ab9ec0c19b2d6ea3 | Add script to extract rows from terms. | src/Scripts/show-term-convert.py | src/Scripts/show-term-convert.py | Python | 0 | @@ -0,0 +1,547 @@
+# Convert from show term to list of rows associated with each term.%0A%0Aimport re%0Aterm_regex = re.compile(%22Term%5C(%5C%22(%5CS+)%5C%22%5C)%22)%0Arowid_regex = re.compile(%22%5Cs+RowId%5C((%5CS+),%5Cs+(%5CS+)%5C)%22)%0A%0Athis_term = %22%22%0Awith open(%22/tmp/show.results.txt%22) as f:%0A for... | |
9d6a838463c3b771bdd2cb304f378f85abc5dc95 | Remove forward slashes from episode titles | tvrenamr/cli/core.py | tvrenamr/cli/core.py | #!/usr/bin/env python
from __future__ import absolute_import
import functools
import logging
import sys
import click
from tvrenamr import errors
from tvrenamr.cli.helpers import (build_file_list, get_config, start_dry_run,
stop_dry_run)
from tvrenamr.logs import start_logging
from ... | Python | 0.000001 | @@ -4586,32 +4586,150 @@
)%0A%0A
+ # TODO: make this a sanitisation method on ep?%0A ep.title = ep.title.replace('/', '-')%0A%0A
show
|
710f6ed188b6139f6469d61775da4fb752bac754 | Create __init__.py | mopidy_ampache/__init__.py | mopidy_ampache/__init__.py | Python | 0.000429 | @@ -0,0 +1,883 @@
+from __future__ import unicode_literals%0A%0Aimport os%0A%0Afrom mopidy import ext, config%0A%0A__version__ = '1.0.0'%0A%0A%0Aclass AmpacheExtension(ext.Extension):%0A%0A dist_name = 'Mopidy-Ampache'%0A ext_name = 'ampache'%0A version = __version__%0A%0A def get_default_config(self):%0A ... | |
2cd081a6a7c13b40b5db8f667d03e93353630830 | Create leetcode-78.py | python_practice/leetCode/leetcode-78.py | python_practice/leetCode/leetcode-78.py | Python | 0.000003 | @@ -0,0 +1,321 @@
+class Solution:%0A def subsets(self, nums: List%5Bint%5D) -%3E List%5BList%5Bint%5D%5D:%0A if nums == %5B%5D:%0A return %5B%5B%5D%5D%0A %0A sub = self.subsets(nums%5B1:%5D)%0A newSub = %5B%5D%0A for i in sub:%0A newI = i + %5Bnums%5B0%5D%5D%... | |
56f8dd435981a28bcb026da0edb395aabd515c29 | Add a frist test for create_random_data | opal/tests/test_command_create_random_data.py | opal/tests/test_command_create_random_data.py | Python | 0.000006 | @@ -0,0 +1,520 @@
+%22%22%22%0AUnittests for opal.management.commands.create_random_data%0A%22%22%22%0Afrom mock import patch, MagicMock%0A%0Afrom opal.core.test import OpalTestCase%0A%0Afrom opal.management.commands import create_random_data as crd%0A%0Aclass StringGeneratorTestCase(OpalTestCase):%0A def test_strin... | |
826c3e3b2787e25d040b3ddf7c4bdabde3da4158 | Add tasks.py the new and improved celery_tasks.py | scrapi/tasks.py | scrapi/tasks.py | Python | 0.004637 | @@ -0,0 +1,1744 @@
+import os%0Aimport logging%0Aimport importlib%0Afrom datetime import datetime%0A%0Afrom celery import Celery%0A%0Aimport settings%0A%0A%0Aapp = Celery()%0Aapp.config_from_object(settings)%0A%0Alogger = logging.getLogger(__name__)%0A%0A%0Adef import_consumer(consumer_name):%0A return importlib.imp... | |
3f1663f7cf32b590affb7a306bcc2711b17af296 | Add a monitor example. | example/user_stream_monitor.py | example/user_stream_monitor.py | Python | 0.00024 | @@ -0,0 +1,1391 @@
+#!/usr/bin/env python%0A#%0A# Copyright (c) 2012 Ralph Meijer %3Cralphm@ik.nu%3E%0A# See LICENSE.txt for details%0A%0A%22%22%22%0APrint Tweets on a user's timeline in real time.%0A%0AThis connects to the Twitter User Stream API endpoint with the given OAuth%0Acredentials and prints out all Tweets o... | |
ac3cd54b93aa6d5cddaac89016d09b9e6747a301 | allow bazel 0.7.x (#1467) | check_bazel_version.bzl | check_bazel_version.bzl | def _parse_bazel_version(bazel_version):
# Remove commit from version.
version = bazel_version.split(" ", 1)[0]
# Split into (release, date) parts and only return the release
# as a tuple of integers.
parts = version.split("-", 1)
# Turn "release" into a tuple of strings
version_tuple = ()... | Python | 0 | @@ -531,11 +531,12 @@
%220.
-6.1
+7.99
%22)%0A%0A
|
b40d064ac5b4e01f11cdb1f6b7ce7f1a0a968be5 | Create set_memory_example.py | examples/set_memory_example.py | examples/set_memory_example.py | Python | 0.000189 | @@ -0,0 +1,615 @@
+from chatbot import Chat, register_call%0Aimport os%0Aimport warnings%0Awarnings.filterwarnings(%22ignore%22)%0A%0A%0A@register_call(%22increment_count%22)%0Adef memory_get_set_example(session, query):%0A name=query.strip().lower()%0A # Get memory%0A old_count = session.memory.get(name, '0')... | |
12b7d2b2296b934675f2cca0f35d059a67f58e7f | Create ComputeDailyWage.py | ComputeDailyWage.py | ComputeDailyWage.py | Python | 0.000011 | @@ -0,0 +1,2102 @@
+################################ Compute daily wage%0A%0Adef computepay ( w , m , e , g ):%0A total = float(wage) - (float(mileage)/float(gas)) - float(expenses)%0A return total%0A%0Atry:%0A input = raw_input('Enter Wages: ')%0A wage = float(input)%0A input = raw_input('Enter Miles: '... | |
2429c0bdf5c2db5c2b40dc43d0a4c277e20d72fa | add 0001 | Jaccorot/0001/0001.py | Jaccorot/0001/0001.py | Python | 0.999999 | @@ -0,0 +1,484 @@
+#!/usr/local/bin/python%0A#coding=utf-8%0A%0A#%E7%AC%AC 0001 %E9%A2%98%EF%BC%9A%E5%81%9A%E4%B8%BA Apple Store App %E7%8B%AC%E7%AB%8B%E5%BC%80%E5%8F%91%E8%80%85%EF%BC%8C%E4%BD%A0%E8%A6%81%E6%90%9E%E9%99%90%E6%97%B6%E4%BF%83%E9%94%80%EF%BC%8C%E4%B8%BA%E4%BD%A0%E7%9A%84%E5%BA%94%E7%94%A8%E7%94%9F%E6%88%... | |
6913674358d226953c1090ab7c8f5674dac1816c | add 0007 | Jaccorot/0007/0007.py | Jaccorot/0007/0007.py | Python | 0.99999 | @@ -0,0 +1,1175 @@
+#!/usr/bin/python%0A#coding:utf-8%0A%0A%22%22%22%0A%E7%AC%AC 0007 %E9%A2%98%EF%BC%9A%E6%9C%89%E4%B8%AA%E7%9B%AE%E5%BD%95%EF%BC%8C%E9%87%8C%E9%9D%A2%E6%98%AF%E4%BD%A0%E8%87%AA%E5%B7%B1%E5%86%99%E8%BF%87%E7%9A%84%E7%A8%8B%E5%BA%8F%EF%BC%8C%E7%BB%9F%E8%AE%A1%E4%B8%80%E4%B8%8B%E4%BD%A0%E5%86%99%E8%BF%87... | |
f8093f59b77e481231aeca49ef057a4602d21b2e | add tests for appconfig | src/archivematicaCommon/tests/test_appconfig.py | src/archivematicaCommon/tests/test_appconfig.py | Python | 0 | @@ -0,0 +1,2528 @@
+from __future__ import absolute_import%0Aimport os%0Aimport StringIO%0A%0Afrom django.core.exceptions import ImproperlyConfigured%0Aimport pytest%0A%0Afrom appconfig import Config%0A%0A%0ACONFIG_MAPPING = %7B%0A 'search_enabled': %5B%0A %7B'section': 'Dashboard', 'option': 'disable_search_... | |
06dd6ed476549d832159b1dbfe4d415579b4d067 | add wrapper | scripts/fontify.py | scripts/fontify.py | Python | 0.000002 | @@ -0,0 +1,1320 @@
+#!/usr/bin/env python2%0Aimport argparse%0Aimport tempfile%0Aimport shutil%0Aimport os%0Aimport crop_image%0A%0A%0Adef check_input(image):%0A if not os.path.isfile(image):%0A raise FileNotFoundError%0A _, ext = os.path.splitext(image)%0A if ext.lower() not in %5B%22.jpg%22, %22.png%2... | |
6ca1d9f4a3b8a518661409166a9918a20eb61655 | fix wansu cdn url | src/streamlink/plugins/app17.py | src/streamlink/plugins/app17.py | import re
from streamlink.plugin import Plugin
from streamlink.plugin.api import http, useragents
from streamlink.stream import HLSStream, RTMPStream, HTTPStream
API_URL = "https://api-dsa.17app.co/api/v1/liveStreams/getLiveStreamInfo"
_url_re = re.compile(r"https://17.live/live/(?P<channel>[^/&?]+)")
_status_re = r... | Python | 0.000002 | @@ -995,48 +995,8 @@
(1)%0A
- if 'pull-rtmp' in http_url:%0A
@@ -1407,24 +1407,8 @@
nsu-
-global-pull-rtmp
' in
|
7f51b7a1b6a319595df5c360bae0264386e590e9 | add support for tucao.cc | src/you_get/extractors/tucao.py | src/you_get/extractors/tucao.py | Python | 0 | @@ -0,0 +1,2116 @@
+#!/usr/bin/env python%0A%0A__all__ = %5B'tucao_download'%5D%0Afrom ..common import *%0A# import re%0Aimport random%0Aimport time%0Afrom xml.dom import minidom%0A%0A#1. %3Cli%3Etype=tudou&vid=199687639%3C/li%3E%0A#2. %3Cli%3Etype=tudou&vid=199506910%7C%3C/li%3E%0A#3. %3Cli%3Etype=video&file=http://xi... | |
617e6741a06fd63f22ec9b28090e39c120061a84 | Add the `vulnerability_tickets.py` sample security plugin to deny access to tickets with "security" or "vulnerability" in the `keywords` or `summary` fields. | sample-plugins/vulnerability_tickets.py | sample-plugins/vulnerability_tickets.py | Python | 0.000038 | @@ -0,0 +1,1232 @@
+from trac.core import *%0Afrom trac.config import ListOption%0Afrom trac.perm import IPermissionPolicy, IPermissionRequestor, PermissionSystem%0Afrom trac.ticket.model import Ticket%0A%0A%0Aclass SecurityTicketsPolicy(Component):%0A %22%22%22%0A Require the VULNERABILITY_VIEW permission to vie... | |
b8ab0280ffd76419b7418c39a9f0b9d8131a9d39 | Add merge migration | corehq/apps/users/migrations/0022_merge_20200814_2045.py | corehq/apps/users/migrations/0022_merge_20200814_2045.py | Python | 0.000001 | @@ -0,0 +1,281 @@
+# Generated by Django 2.2.13 on 2020-08-14 20:45%0A%0Afrom django.db import migrations%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('users', '0021_add_view_apps_permission'),%0A ('users', '0021_invitation_email_status'),%0A %5D%0A%0A operations = ... | |
cff300eecbbf6189fe7fc9fe4fafd718b414c80e | add command to create root | src/python/expedient/clearinghouse/commands/management/commands/create_default_root.py | src/python/expedient/clearinghouse/commands/management/commands/create_default_root.py | Python | 0.000001 | @@ -0,0 +1,1477 @@
+'''Command to create default administrators.%0ACreated on Aug 26, 2010%0A%0A@author: jnaous%0A'''%0A%0Afrom django.core.management.base import NoArgsCommand%0Afrom django.conf import settings%0Afrom django.contrib.auth.models import User%0A%0Aclass Command(NoArgsCommand):%0A help = %22Creates the... | |
7067413504454051ede2b9b2b0c223019282dc84 | Fix notification testcase | monasca/tests/microservice/test_notification_processor.py | monasca/tests/microservice/test_notification_processor.py | # Copyright 2015 Carnegie Mellon University
#
# Author: Han Chen <hanc@andrew.cmu.edu>
#
# 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
#
# ... | Python | 0.000011 | @@ -3474,26 +3474,20 @@
ect(
-ast, 'literal_eval
+json, 'loads
',%0A
|
787f956539eb5e41467e04b8239ae571fad60da7 | Implement code to return how many characters to delete to make 2 strings into an anagram | all-domains/tutorials/cracking-the-coding-interview/strings-making-anagrams/solution.py | all-domains/tutorials/cracking-the-coding-interview/strings-making-anagrams/solution.py | Python | 0.998758 | @@ -0,0 +1,823 @@
+# https://www.hackerrank.com/challenges/ctci-making-anagrams%0A# Python 3%0A%0Adef delete_char_at(s, i):%0A return s%5B:i%5D + s%5Bi+1:%5D%0A%0Adef number_needed(a, b):%0A counter = 0%0A loop_over, reference = (a, b) if len(a) %3E len(b) else (b, a)%0A%0A for character in loop_over:%0A ... | |
b906082034822a825ec2963864b32d6619cf938a | Add testing functions for join and relabel | skimage/segmentation/tests/test_join.py | skimage/segmentation/tests/test_join.py | Python | 0 | @@ -0,0 +1,1493 @@
+import numpy as np%0Afrom numpy.testing import assert_array_equal, assert_raises%0Afrom skimage.segmentation import join_segmentations, relabel_from_one%0A%0Adef test_join_segmentations():%0A s1 = np.array(%5B%5B0, 0, 1, 1%5D,%0A %5B0, 2, 1, 1%5D,%0A %5B2, 2, 2... | |
6b38f963cf555576157f063e9c026a94814f93a2 | Fix all target for managed install. | build/android/tests/multiple_proguards/multiple_proguards.gyp | build/android/tests/multiple_proguards/multiple_proguards.gyp | # 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.
{
'variables': {
'chromium_code': 1,
'package_name': 'multiple_proguard',
},
'targets': [
{
'target_name': 'multiple_proguards_tes... | Python | 0.000209 | @@ -705,24 +705,123 @@
Proguards',%0A
+ # This is a build-only test. There's nothing to install.%0A 'gyp_managed_install': 0,%0A
%7D,%0A
|
46be3829264ab1ac59f26d4dbd9b1427405f71dc | Write colors to console on Windows with correct background, not always black. | src/robot/output/highlighting.py | src/robot/output/highlighting.py | # Copyright 2008-2011 Nokia Siemens Networks Oyj
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law... | Python | 0 | @@ -1938,16 +1938,44 @@
Y = 0x8%0A
+ _BACKGROUND_MASK = 0xF0%0A
_STD
@@ -2147,16 +2147,85 @@
colors()
+%0A self._background = self._orig_colors & self._BACKGROUND_MASK
%0A%0A de
@@ -2249,32 +2249,43 @@
self._set_
+foreground_
colors(self._FOR
@@ -2329,32 +2329,43 @@
self._set_
+foreg... |
c8bcdf4d586277df940b8fd9f977cd72305b5e85 | add StatusReportView | skrill/views.py | skrill/views.py | Python | 0 | @@ -0,0 +1,1765 @@
+from django import http%0Afrom django.views.generic.base import View%0A%0Afrom skrill.models import PaymentRequest, StatusReport%0A%0A%0Aclass StatusReportView(View):%0A def post(self, request, *args, **kwargs):%0A payment_request = PaymentRequest.objects.get(pk=request.POST%5B'transaction... | |
12c3ded4ed05e34a0a44163abd5ae08ab0289c4c | Create Score-Calculator.py | Score-Calculator.py | Score-Calculator.py | Python | 0 | @@ -0,0 +1,308 @@
+midterm = float(input())%0Aif midterm %3E= 0:%0A if midterm %3C= 60:%0A final = float(input())%0A if final %3E= 0:%0A if final %3C= 60:%0A total = midterm + final%0A avg = total/2%0A print('Total: ' + str(total))%0A ... | |
3b0fdecb60b9c5e8a104564d5703c85c97c10f27 | Introduce an ExtruderStack class | cura/Settings/ExtruderStack.py | cura/Settings/ExtruderStack.py | Python | 0 | @@ -0,0 +1,723 @@
+# Copyright (c) 2017 Ultimaker B.V.%0A# Cura is released under the terms of the AGPLv3 or higher.%0A%0Afrom UM.MimeTypeDatabase import MimeType, MimeTypeDatabase%0Afrom UM.Settings.ContainerStack import ContainerStack%0Afrom UM.Settings.ContainerRegistry import ContainerRegistry%0A%0Aclass ExtruderSt... | |
1e996e3cf1c8e067bbbb8bf23f93b34202b4cd44 | add 401 | leetcode/1.Array_String/401.BinaryWatch.py | leetcode/1.Array_String/401.BinaryWatch.py | Python | 0.001659 | @@ -0,0 +1,2498 @@
+# 401. Binary Watch %0A%0A# A binary watch has 4 LEDs on the top which represent the hours (0-11), and the 6 LEDs on the bottom represent the minutes (0-59).%0A%0A# Each LED represents a zero or one, with the least significant bit on the right.%0A%0A# off off on on%0A# off ... | |
5712da6095594360be9010b0fe6b85606ec1e2d0 | Add regression test for #891 | spacy/tests/regression/test_issue891.py | spacy/tests/regression/test_issue891.py | Python | 0.000001 | @@ -0,0 +1,321 @@
+# coding: utf8%0Afrom __future__ import unicode_literals%0A%0Aimport pytest%0A%0A@pytest.mark.xfail%0A@pytest.mark.parametrize('text', %5B%22want/need%22%5D)%0Adef test_issue891(en_tokenizer, text):%0A %22%22%22Test that / infixes are split correctly.%22%22%22%0A tokens = en_tokenizer(text)%0A ... | |
d11ac35410252c108dcd7e8d2ae03df2abc4697b | add statsquid cli util | statsquid/statsquid.py | statsquid/statsquid.py | Python | 0 | @@ -0,0 +1,2743 @@
+#!/usr/bin/env python%0A%0Aimport os,sys,logging,signal%0Afrom argparse import ArgumentParser%0A#from . import __version__%0Afrom listener import StatListener%0Afrom collector import StatCollector%0A%0A__version__ = 'alpha'%0Alog = logging.getLogger('statsquid')%0A%0Aclass StatSquid(object):%0A %... | |
59160eeb24f6311dafce2db34a40f8ba879fd516 | Add test showing taint for attr store | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_attr.py | python/ql/test/experimental/dataflow/tainttracking/defaultAdditionalTaintStep/test_attr.py | Python | 0.000111 | @@ -0,0 +1,1240 @@
+# Add taintlib to PATH so it can be imported during runtime without any hassle%0Aimport sys; import os; sys.path.append(os.path.dirname(os.path.dirname((__file__))))%0Afrom taintlib import *%0A%0A# This has no runtime impact, but allows autocomplete to work%0Afrom typing import TYPE_CHECKING%0Aif TY... | |
1f92af62d1a58e496c2ce4251676fca3b571e8f1 | Add missing specification model tests | django_project/localities/tests/test_model_Specification.py | django_project/localities/tests/test_model_Specification.py | Python | 0.000001 | @@ -0,0 +1,804 @@
+# -*- coding: utf-8 -*-%0Afrom django.test import TestCase%0A%0Afrom django.db import IntegrityError%0A%0Afrom .model_factories import (%0A SpecificationF,%0A DomainF,%0A AttributeF%0A)%0A%0A%0Aclass TestModelSpecification(TestCase):%0A def test_model_repr(self):%0A dom = DomainF.c... | |
15298dd59aabd817b3b160910b423d3448c9e189 | Test for overriding __import__. | tests/import/import_override.py | tests/import/import_override.py | Python | 0.001211 | @@ -0,0 +1,1006 @@
+import import1b%0A%0Aassert import1b.var == 123%0A%0Aimport builtins%0A%0Aorg_import = builtins.__import__%0A%0A%0Adef my_import(*args):%0A # MicroPython currently doesn't pass globals/locals, so don't print them%0A # CPython3.5 and lower for %22from pkg.mod import foo%22 appear to call%0A ... | |
02bf100a05ed6267ab3fb618c52150fc2d4884f2 | Add some basic tests around contact parsing | tests/test_contact_parsing.py | tests/test_contact_parsing.py | Python | 0 | @@ -0,0 +1,1296 @@
+import aiosip%0A%0A%0Adef test_simple_header():%0A header = aiosip.Contact.from_header('%3Csip:pytest@127.0.0.1:7000%3E')%0A assert not header%5B'name'%5D%0A assert dict(header%5B'params'%5D) == %7B%7D%0A assert dict(header%5B'uri'%5D) == %7B'scheme': 'sip',%0A ... | |
f5720f2609bcb19ffca308a3589c8e6171d1f8b7 | Add test cases for removepunctuation | tests/test_removepunctuation.py | tests/test_removepunctuation.py | Python | 0.000018 | @@ -0,0 +1,931 @@
+#%0A%0Aimport pytest%0Afrom sdsc.textutil import removepunctuation%0A%0A%0A@pytest.mark.parametrize(%22end%22, %5BTrue, False%5D)%0A@pytest.mark.parametrize(%22start%22, %5BTrue, False%5D)%0A@pytest.mark.parametrize(%22data%22, %5B%0A # 0 - no quotes%0A 'word',%0A # 1 - single quote at the... | |
e8309903b54598358efc20092760fe933cbd8ce7 | check if a string is a permutation of anohter string | CrackingCodingInterview/1.3_string_permutation.py | CrackingCodingInterview/1.3_string_permutation.py | Python | 0.999858 | @@ -0,0 +1,121 @@
+%22%22%22%0Acheck if a string is a permutation of anohter string%0A%22%22%22%0A%0A#utalize sorted, perhaps check length first to make faster%0A
| |
6dde05fc401ff615b44dc101bfb7775c65535e79 | Create 2.6_circularlinkedlist.py | CrackingCodingInterview/2.6_circularlinkedlist.py | CrackingCodingInterview/2.6_circularlinkedlist.py | Python | 0.000019 | @@ -0,0 +1,61 @@
+%22%22%22%0Areturn node at begining of a cricularly linked list%0A%22%22%22%0A%0A
| |
cb2deafae258625f0c4ec8bb68713b391129a27c | add migration of help text changes | isi_mip/climatemodels/migrations/0085_auto_20180215_1105.py | isi_mip/climatemodels/migrations/0085_auto_20180215_1105.py | Python | 0.000001 | @@ -0,0 +1,1584 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.10.8 on 2018-02-15 10:05%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0Aimport django.db.models.deletion%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('climatemodels',... | |
5fa3fc6ba78c3e6cf12a25bddb835e9d885bcbd3 | Create 0035_auto_20190712_2015.py | src/submission/migrations/0035_auto_20190712_2015.py | src/submission/migrations/0035_auto_20190712_2015.py | Python | 0.000001 | @@ -0,0 +1,1437 @@
+# -*- coding: utf-8 -*-%0A# Generated by Django 1.11.21 on 2019-07-12 19:15%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import migrations, models%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A ('submission', '0034_auto_20190416_1009'),%0A %5... | |
e0229179b01805ca7f7e23d3094737a4f366e162 | Add missing files for d8af78447f286ad07ad0736d4202e0becd0dd319 | board/migrations/0001_initial.py | board/migrations/0001_initial.py | Python | 0.000006 | @@ -0,0 +1,735 @@
+# -*- coding: utf-8 -*-%0Afrom __future__ import unicode_literals%0A%0Afrom django.db import models, migrations%0Afrom django.conf import settings%0A%0A%0Aclass Migration(migrations.Migration):%0A%0A dependencies = %5B%0A migrations.swappable_dependency(settings.AUTH_USER_MODEL),%0A %5D%... | |
2a502236de5c28d4f4e6626317565c7bb60ebb13 | Create NumberofDigitOne_001.py | leetcode/233-Number-of-Digit-One/NumberofDigitOne_001.py | leetcode/233-Number-of-Digit-One/NumberofDigitOne_001.py | Python | 0.000057 | @@ -0,0 +1,389 @@
+class Solution:%0A # @param %7Binteger%7D n%0A # @return %7Binteger%7D%0A def countDigitOne(self, n):%0A res, d = 0, 10%0A while 10 * n %3E= d:%0A t = d / 10%0A r = n %25 d%0A res += n / d * t%0A if t - 1 %3C r %3C 2 * t - 1:%0A ... | |
052dbe05c0e1d3e2821857a035e469be2a1055ae | Add "what is my purpose in life" plugin | plugins/pass_the_butter.py | plugins/pass_the_butter.py | Python | 0.000021 | @@ -0,0 +1,250 @@
+from espresso.main import robot%0A%0A@robot.respond(r%22(?i)pass the butter%22)%0Adef pass_the_butter(res):%0A res.reply(res.msg.user, %22What is my purpose in life?%22)%0A%0A@robot.respond(r%22(?i)you pass butter%22)%0Adef you_pass_butter(res):%0A res.send(%22Oh my god.%22)%0A
| |
5b57686868b595fb4e7b431822fe4c7bf2de6cfb | Add unittests for title handling methods | test/test_uploadbot.py | test/test_uploadbot.py | Python | 0 | @@ -0,0 +1,1323 @@
+#!/usr/bin/env python%0A# -*- coding: latin-1 -*-%0A%0A%22%22%22Unit tests.%22%22%22%0A%0Aimport unittest%0Afrom uploadlibrary.UploadBot import _cut_title%0A%0A%0Aclass TestUploadBot(unittest.TestCase):%0A%0A %22%22%22Testing UploadBot methods.%22%22%22%0A%0A def test_cut_title_witout_cutting(... | |
b15c7c044b0c514285bcb8c29b7bcfc8cf777c8b | Add tests for the signals | ormcache/tests/test_signals.py | ormcache/tests/test_signals.py | Python | 0.000002 | @@ -0,0 +1,1327 @@
+from django.core.cache import cache%0Afrom django.test import SimpleTestCase%0A%0Afrom ormcache.signals import cache_hit, cache_missed, cache_invalidated%0Afrom ormcache.tests.testapp.models import CachedDummyModel%0A%0A%0Aclass SignalsTestCase(SimpleTestCase):%0A%0A def setUp(self):%0A se... | |
f07cdf5bd22dd352122d679a6e8c4cc213aad013 | Create multiarm_selector.py | multiarm_selector.py | multiarm_selector.py | Python | 0.000001 | @@ -0,0 +1,2066 @@
+from __future__ import division%0Aimport random%0A%0A%0Aclass MultiarmSelector(object):%0A def __init__(self):%0A self.versions_served = %5B%5D%0A self.clicks = 0%0A self.missed = 0%0A%0A self.success_count = %7B%0A %22A%22: 0,%0A %22B%22: 0%0A ... | |
bf2cc99162389c6b5c18051f01756e17d9d11ce6 | Add a test for rename. | tests/integration/test_rename.py | tests/integration/test_rename.py | Python | 0.000004 | @@ -0,0 +1,1154 @@
+%22%22%22%0ATest 'rename'.%0A%22%22%22%0A%0Aimport subprocess%0Aimport unittest%0A%0Afrom ._constants import _CLI%0A%0Afrom ._misc import Service%0A%0A%0A@unittest.skip(%22Wating for Rename%22)%0Aclass Rename1TestCase(unittest.TestCase):%0A %22%22%22%0A Test 'rename' when pool is non-existant.... | |
4d661b0fcb6f4b130370c010d16a2afec2449456 | Create mergesort.py | aids/sorting_and_searching/mergesort.py | aids/sorting_and_searching/mergesort.py | Python | 0.000001 | @@ -0,0 +1,194 @@
+'''%0AIn this module, we implement merge sort%0ATime complexity: O(n * log n)%0A'''%0A%0A%0Adef mergesort(arr):%0A '''%0A Sort array using mergesort%0A %0A '''%0A pass%0A %0A%0Adef _merge(arr):%0A pass%0A
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.