code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
import os.path as osp
from evaluations.common import tiou
from evaluations.util import load_file
import generate_track_link
def eval_ground_scores(gt_relations, pred_relations, tiou_threshold):
"""
:param gt_relations:
:param pred_relations:
:param tiou_threshold:
:return:
"""
# pred_relat... | normal | {
"blob_id": "f26e6164fc4c07fd3339171e316b3a1f7a4be669",
"index": 2447,
"step-1": "<mask token>\n\n\ndef eval_ground_scores(gt_relations, pred_relations, tiou_threshold):\n \"\"\"\n\n :param gt_relations:\n :param pred_relations:\n :param tiou_threshold:\n :return:\n \"\"\"\n relation_num = l... | [
2,
3,
4,
5,
6
] |
# -*- coding: utf-8 -*-
import numpy as np
from . import BOID_NOSE_LEN
from .utils import normalize_angle, unit_vector
class Individual:
def __init__(self, color, pos, ror, roo, roa, angle=0, speed=1.0, turning_rate=0.2):
"""Constructor of Individual.
Args:
color (Color): color for ... | normal | {
"blob_id": "386e491f6b10ca27f513d678c632571c29093ad2",
"index": 5825,
"step-1": "<mask token>\n\n\nclass Individual:\n <mask token>\n\n @property\n def dir(self):\n \"\"\"Get the unitary vector of direction.\n\n Returns:\n numpy.ndarray: The unitary vector of direction.\n\n ... | [
5,
6,
7,
8,
9
] |
vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0,
5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,
0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0,
0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0,
0.0, 0.0, 0, 0.... | normal | {
"blob_id": "dc6cbf43424a31f1aefde8bd71b6f1b7ecf8166b",
"index": 5998,
"step-1": "<mask token>\n",
"step-2": "vect = [0, 0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0, \n 5.723585101952381, 0.0, 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.0, 0.0,\n 0, 0, 0.0, 0.0, 0.0, 0.0, 0, 0.0, 0, 0.0, 0.0... | [
0,
1
] |
<|reserved_special_token_0|>
class PXEBaseMixin(object):
def get_properties(self):
"""Return the properties of the interface.
:returns: dictionary of <property name>:<property description> entries.
"""
return COMMON_PROPERTIES
@METRICS.timer('PXEBaseMixin.clean_up_ramdisk')
... | flexible | {
"blob_id": "d56fa4ea999d8af887e5f68296bfb20ad535e6ad",
"index": 6748,
"step-1": "<mask token>\n\n\nclass PXEBaseMixin(object):\n\n def get_properties(self):\n \"\"\"Return the properties of the interface.\n\n :returns: dictionary of <property name>:<property description> entries.\n \"\"\... | [
4,
5,
6,
7,
8
] |
import logging
from sleekxmpp import ClientXMPP
from sleekxmpp.exceptions import IqError, IqTimeout
class EchoBot(ClientXMPP):
def __init__(self, jid, password):
ClientXMPP.__init__(self, jid, password)
self.add_event_handler("session_start", self.session_start)
self.register_plugin('xep_0... | normal | {
"blob_id": "3b531c5935f0be89536c95ff471f96b4249d951c",
"index": 2521,
"step-1": "<mask token>\n\n\nclass EchoBot(ClientXMPP):\n\n def __init__(self, jid, password):\n ClientXMPP.__init__(self, jid, password)\n self.add_event_handler('session_start', self.session_start)\n self.register_pl... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def parse_arguments() ->Namespace:
"""
Parse arguments
:return: Arguments
"""
parser = ArgumentParser(description=
'DLP project: Stock Prediction using Transformer')
parser.add_argument('-e', '--e... | flexible | {
"blob_id": "81573b4a57f540733ff2faaf82bab78381b9dd46",
"index": 1194,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_arguments() ->Namespace:\n \"\"\"\n Parse arguments\n :return: Arguments\n \"\"\"\n parser = ArgumentParser(description=\n 'DLP project: Stock Predicti... | [
0,
1,
2
] |
A,B=map(str,input().split())
if(A>B):
print(A)
elif(B>A):
print(B)
else:
print(AorB)
| normal | {
"blob_id": "8cbe78863de535a5b83eacebe67402569b4015fa",
"index": 9189,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n print(AorB)\n",
"step-3": "A, B = map(str, input().split())\nif A > B:\n print(A)\nelif B > A:\n print(B)\nelse:\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while on_row <= height:
if on_row == 0 or on_row == height:
print('*' * width)
else:
stars = '*' + ' ' * (width - 2) + '*'
print(stars)
on_row += 1
<|reserved_special_token_1|>
width, height ... | flexible | {
"blob_id": "63e96b41906f49f557529a0815da7314d74f6c33",
"index": 6216,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile on_row <= height:\n if on_row == 0 or on_row == height:\n print('*' * width)\n else:\n stars = '*' + ' ' * (width - 2) + '*'\n print(stars)\n on_row +=... | [
0,
1,
2,
3
] |
#for declaring the variables used in program
img_rows=200
img_cols=200
img_channels=1
nb_classes=3
nb_test_images=1
| normal | {
"blob_id": "c41388043295280f9354e661a8d38ae46cae2d65",
"index": 9590,
"step-1": "<mask token>\n",
"step-2": "img_rows = 200\nimg_cols = 200\nimg_channels = 1\nnb_classes = 3\nnb_test_images = 1\n",
"step-3": "#for declaring the variables used in program\nimg_rows=200\nimg_cols=200\nimg_channels=1\nnb_classe... | [
0,
1,
2
] |
import dash_html_components as html
import dash_core_components as dcc
import dash_daq as daq
import dash_bootstrap_components as dbc
import src.common.common_layout as layout_common
def build_navbar():
return html.Div(
id="banner",
children=[
html.Div(
id="banner-text... | normal | {
"blob_id": "f9dd20a3b72c0c8e72029459244486f31eaff536",
"index": 9411,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef generate_modal():\n return html.Div(id='markdown', className='modal', children=html.Div(id=\n 'markdown-container', className='markdown-container', children=[\n h... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def fact(num):
factorial = 1
if int(num) >= 1:
for i in range(1, int(n) + 1):
factorial = factorial * i
return factorial
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_s... | flexible | {
"blob_id": "93b00b5c1bec38d2a4ac109f1533d3c0d9e99044",
"index": 5763,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fact(num):\n factorial = 1\n if int(num) >= 1:\n for i in range(1, int(n) + 1):\n factorial = factorial * i\n return factorial\n\n\n<mask token>\n",
"... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests
from bs4 import BeautifulSoup
url = "http://javmobile.net/?s=julia"
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
imgs = soup.find_all("img" , {"class": "entry-thumb"})
images = []
titles = []
srcs = []
for img... | normal | {
"blob_id": "a9df8e45c8b5068aeec2b79e21de6217a3103bb4",
"index": 2492,
"step-1": "# -*- coding: utf-8 -*-\nfrom __future__ import unicode_literals\nimport requests\nfrom bs4 import BeautifulSoup\n\n\nurl = \"http://javmobile.net/?s=julia\"\nr = requests.get(url)\n\nsoup = BeautifulSoup(r.content, \"html.parser\"... | [
0
] |
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.screenmanager import ScreenManager, Screen
class Gerenciador(ScreenManager):
pass
class Menu(Screen):
pass
class Tarefas(Screen):
def __init__(self, tarefas=[], **kwargs):
super().__init__(**kwargs)
for ta... | normal | {
"blob_id": "66b42791325a53172d4514cdd16ccd58d4edb186",
"index": 2409,
"step-1": "<mask token>\n\n\nclass Tarefas(Screen):\n <mask token>\n <mask token>\n\n\nclass Tarefa(BoxLayout):\n\n def __init__(self, text='', **kwargs):\n super().__init__(**kwargs)\n self.ids.label.text = text\n\n\nc... | [
5,
8,
9,
11
] |
# coding=utf-8
"""Advent of Code 2018, Day 7"""
import networkx
import re
G = networkx.DiGraph()
with open("puzzle_input") as f:
for line in f.read().split("\n"):
match = re.search("Step (?P<pre>[A-Z]).*step (?P<post>[A-Z])", line)
G.add_edge(match.group("pre"), match.group("post"))
def part_one... | normal | {
"blob_id": "1c5884c10ac0b6a3335f8e677007fc52311245e2",
"index": 7603,
"step-1": "<mask token>\n\n\ndef part_one():\n \"\"\"Solution to Part 1\"\"\"\n return ''.join(networkx.lexicographical_topological_sort(G))\n\n\ndef part_two():\n \"\"\"Solution to Part 2\"\"\"\n tasks = {}\n current_time = 0\... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for files in multiSizerFiles:
data.append(MultiSizerReader(path=os.path.join(folder, files)))
<|reserved_special_token_0|>
for d in data:
OD = d.name.split('_')[4] + '.' + d.name.split('_')[5]
if d.name.split('_')[2] =... | flexible | {
"blob_id": "2f0aa1f294f34a4f3ffb47c15ab74fc792765f10",
"index": 9195,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor files in multiSizerFiles:\n data.append(MultiSizerReader(path=os.path.join(folder, files)))\n<mask token>\nfor d in data:\n OD = d.name.split('_')[4] + '.' + d.name.split('_')[5... | [
0,
1,
2,
3,
4
] |
# coding=utf8
# encoding: utf-8
import os
import platform
import re
import signal
import sys
import traceback
from subprocess import Popen, PIPE
from threading import Thread, current_thread
from Queue import Queue
from util.log import get_logger, log
from video.models import Video, KeywordVideoId
from django.db.mode... | normal | {
"blob_id": "fbd5400823a8148adf358a2acc58fde146a25313",
"index": 2275,
"step-1": "<mask token>\n\n\ndef register_int_signal_handler():\n\n def stop_thread_handler(signum, frame):\n log.info('Received signal {0}. Will stop all task threads'.format(\n signum))\n for _ in range(len(THREA... | [
13,
16,
19,
20,
24
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
"""
The :mod:`sklearn.experimental` module provides importable modules that enable
the use of experimental features or estimators.
The features and estimators that are experimental aren't subject to
deprecation cycles. Use them at your own risks!
"""
| flexible | {
"blob_id": "d3952306679d5a4dc6765a7afa19ce671ff4c0b4",
"index": 8501,
"step-1": "<mask token>\n",
"step-2": "\"\"\"\nThe :mod:`sklearn.experimental` module provides importable modules that enable\nthe use of experimental features or estimators.\n\nThe features and estimators that are experimental aren't subje... | [
0,
1
] |
<|reserved_special_token_0|>
class PresOrder(Resource):
<|reserved_special_token_0|>
parser.add_argument('username', type=str, required=True, help=
'This field cannot be left blank.')
parser.add_argument('pres', type=str, required=True, help=
'This field cannot be left blank.')
def po... | flexible | {
"blob_id": "84d154afe206fd2c7381a2203affc162c28e21c1",
"index": 5863,
"step-1": "<mask token>\n\n\nclass PresOrder(Resource):\n <mask token>\n parser.add_argument('username', type=str, required=True, help=\n 'This field cannot be left blank.')\n parser.add_argument('pres', type=str, required=Tru... | [
5,
8,
9,
10,
12
] |
class FixtureBittrex:
PING = {"serverTime": 1582535502000}
MARKETS = [
{
"symbol": "ETH-BTC", "baseCurrencySymbol": "ETH", "quoteCurrencySymbol": "BTC",
"minTradeSize": "0.01314872", "precision": 8,
"status": "ONLINE", "createdAt": "2015-08-14T09:02:24.817Z"},
... | normal | {
"blob_id": "eba8e2bda786760898c10d3e75620144973d6236",
"index": 9555,
"step-1": "<mask token>\n",
"step-2": "class FixtureBittrex:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for n, k in enumerate(neighbors):
knn = KNeighborsClassifier(n_neighbors=k, metric='minkowski')
knn.fit(veriler.X_train, veriler.y_train.ravel())
train_accuracy[n] = knn.score(veriler.X_train, veriler.y_train)
test... | flexible | {
"blob_id": "133bd0b2affc3d29390edeab51299d294dafb709",
"index": 4188,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor n, k in enumerate(neighbors):\n knn = KNeighborsClassifier(n_neighbors=k, metric='minkowski')\n knn.fit(veriler.X_train, veriler.y_train.ravel())\n train_accuracy[n] = knn.sc... | [
0,
1,
2,
3,
4
] |
import pathlib, random, cv2
import tensorflow as tf
import numpy as np
import tensorflow.keras.backend as K
import albumentations as A
from matplotlib import pyplot as plt
from functools import partial
from sklearn.model_selection import train_test_split
# GPU setup
gpus = tf.config.experimental.list_physical_devices(... | normal | {
"blob_id": "943e8be7a9ee4e494c0a42e1368555f3df3de897",
"index": 1518,
"step-1": "<mask token>\n\n\ndef aug_fn(image):\n data = {'image': image}\n aug_data = transforms(**data)\n aug_img = aug_data['image']\n aug_img = tf.cast(aug_img, tf.float32) / 255.0\n aug_img = tf.image.per_image_standardiza... | [
7,
10,
11,
12,
16
] |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('grid2', '0003_auto_20161231_2329'),
]
operations = [
migrations.RemoveField(
model_name='grid',
name... | normal | {
"blob_id": "3e305cee2f814698729c008320e326c4bd42640d",
"index": 6629,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('grid2', '00... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for item in data['comments']:
sum = sum + int(item['count'])
print(sum)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
url = 'http://py4e-data.dr-chuck.net/comments_147422.json'
handle = urllib.request.urlopen(ur... | flexible | {
"blob_id": "01b9706966007c44aa19d8249fbcaee5b511786a",
"index": 1111,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor item in data['comments']:\n sum = sum + int(item['count'])\nprint(sum)\n",
"step-3": "<mask token>\nurl = 'http://py4e-data.dr-chuck.net/comments_147422.json'\nhandle = urllib.re... | [
0,
1,
2,
3,
4
] |
"""
Django settings for gamelibrary project.
Generated by 'django-admin startproject' using Django 1.9.5.
For more information on this file, see
https://docs.djangoproject.com/en/1.9/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.9/ref/settings/
"""
import o... | normal | {
"blob_id": "b42414b7d8ed80d8794ab7c49dfde1e5df0721f1",
"index": 1318,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nBASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))\nALLOWED_HOSTS = []\nINSTALLED_APPS = ['django.contrib.admin', 'django.contrib.auth',\n 'django.contrib.contentty... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class DemoTopology(Topo):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class DemoTopology(Topo):
def __init__(self):
Topo.__init__(self)
h1 = self.h1 = self.addHost('h1')
h2 = se... | flexible | {
"blob_id": "8c69813bc576a56c25c828fe24e2707e65ac0d0d",
"index": 5628,
"step-1": "<mask token>\n\n\nclass DemoTopology(Topo):\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass DemoTopology(Topo):\n\n def __init__(self):\n Topo.__init__(self)\n h1 = self.h1 = self.addHo... | [
1,
2,
3,
4,
5
] |
import argparse
import os
import shutil
import time, math
from collections import OrderedDict
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim
import torch.utils.data
import torchvision.transforms as transforms
import torchvision.datasets as datasets
im... | normal | {
"blob_id": "c9de51ee5a9955f36ecd9f5d92813821fb68fb3d",
"index": 4308,
"step-1": "<mask token>\n\n\nclass SpatialAttention(nn.Module):\n\n def __init__(self, kernel_size=7):\n super(SpatialAttention, self).__init__()\n self.conv1 = nn.Conv2d(2, 1, kernel_size, padding=kernel_size // 2,\n ... | [
8,
10,
11,
13,
14
] |
# Developed by : Jays Patel (cyberthreatinfo.ca)
# This script is use to find the python Composer packages vulnerabilities from linux machine and python source project.
import time
import glob2
import random
import os.path
from os import path
import ast
import sys
import commands
import re
import requests
from pkg_res... | normal | {
"blob_id": "c4c24c36fe0afba61f8046055690f0c36df7098c",
"index": 9799,
"step-1": "# Developed by : Jays Patel (cyberthreatinfo.ca)\n# This script is use to find the python Composer packages vulnerabilities from linux machine and python source project.\n\nimport time\nimport glob2\nimport random\nimport os.path\n... | [
0
] |
import numpy as np
import matplotlib.pyplot as plt
# image data
a = np.array([0.1,0.2,0.3,
0.4,0.5,0.6,
0.7,0.8,0.9]).reshape(3,3)
plt.imshow(a,interpolation='nearest',cmap='bone',origin='upper')
plt.colorbar()
plt.xticks(())
plt.yticks(())
plt.show()
| normal | {
"blob_id": "f01f97f8998134f5e4b11232d1c5d341349c3c79",
"index": 4074,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nplt.imshow(a, interpolation='nearest', cmap='bone', origin='upper')\nplt.colorbar()\nplt.xticks(())\nplt.yticks(())\nplt.show()\n",
"step-3": "<mask token>\na = np.array([0.1, 0.2, 0.3,... | [
0,
1,
2,
3,
4
] |
#Creating function
def name_of_function():
'''
Docstring explains function.
'''
return "Hello" #use return instead of print since return can be stored as a variable.
#Simple example
def dog_check(mystring):
if 'dog' in mystring.lower():
return True
else:
return False
#This is a beginner mo... | normal | {
"blob_id": "1deb070dd91c01190b70fa678add31ecb82f34fa",
"index": 3404,
"step-1": "def name_of_function():\n \"\"\"\n Docstring explains function.\n \"\"\"\n return 'Hello'\n\n\ndef dog_check(mystring):\n if 'dog' in mystring.lower():\n return True\n else:\n return False\n\n\n<mask tok... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
__author__ = 'mvoronin'
| flexible | {
"blob_id": "e5a7b0cbc82b57578f6dcbf676e8f589c6e9ac1b",
"index": 5663,
"step-1": "<mask token>\n",
"step-2": "__author__ = 'mvoronin'\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
def read(inp):
res = []
n, v = map(int, inp.readline().split())
for i in range(n):
x, y = map(int, inp.readline().split())
res.append((x, y))
return v, res
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def rea... | flexible | {
"blob_id": "8b0e7e8f2031df217894e980758e15d7401c0981",
"index": 2750,
"step-1": "<mask token>\n\n\ndef read(inp):\n res = []\n n, v = map(int, inp.readline().split())\n for i in range(n):\n x, y = map(int, inp.readline().split())\n res.append((x, y))\n return v, res\n\n\n<mask token>\n... | [
1,
2,
3,
4,
5
] |
from pathlib import Path
from typing import Union
from archinst.cmd import run
def clone(url: str, dest: Union[Path, str]):
Path(dest).mkdir(parents=True, exist_ok=True)
run(
["git", "clone", url, str(dest)],
{
"GIT_SSH_COMMAND": "ssh -o UserKnownHostsFile=/dev/null -o StrictHostK... | normal | {
"blob_id": "d85261268d9311862e40a4fb4139158544c654b3",
"index": 2394,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef clone(url: str, dest: Union[Path, str]):\n Path(dest).mkdir(parents=True, exist_ok=True)\n run(['git', 'clone', url, str(dest)], {'GIT_SSH_COMMAND':\n 'ssh -o UserKno... | [
0,
1,
2,
3
] |
# Generated by Django 2.2.6 on 2019-12-08 22:18
import django.contrib.gis.db.models.fields
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='company'... | normal | {
"blob_id": "9af71eaf8f6f4daacdc1def7b8c5b29e6bac6b46",
"index": 4897,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n dependencies = [('backend', '... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def test_signing_key() ->None:
test_signing_key = SyftSigningKey.from_string(test_signing_key_string)
assert isinstance(test_signing_key, SyftSigningKey)
assert str(test_signing_key) == test_signing_key_string
test_signing_key_2 = SyftSigningKey.from_string(test_signing_ke... | flexible | {
"blob_id": "b76d3b6a4c15833ee2b25fede5923e1fe1dc4dd7",
"index": 5422,
"step-1": "<mask token>\n\n\ndef test_signing_key() ->None:\n test_signing_key = SyftSigningKey.from_string(test_signing_key_string)\n assert isinstance(test_signing_key, SyftSigningKey)\n assert str(test_signing_key) == test_signing... | [
3,
7,
10,
11,
12
] |
<|reserved_special_token_0|>
def gauss_jacobi(entrada, *valores_iniciais):
tamanho = len(entrada[0])
variaveis = [*valores_iniciais[:tamanho]]
variaveism1 = [None] * (tamanho - 1)
for _ in range(0, MAX_ITER):
print(variaveis)
for linha in range(tamanho - 1):
soma = 0
... | flexible | {
"blob_id": "842f8b4de0378a2c83d22f3fd54ba4857d249597",
"index": 9323,
"step-1": "<mask token>\n\n\ndef gauss_jacobi(entrada, *valores_iniciais):\n tamanho = len(entrada[0])\n variaveis = [*valores_iniciais[:tamanho]]\n variaveism1 = [None] * (tamanho - 1)\n for _ in range(0, MAX_ITER):\n prin... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class CodeBlock:
<|reserved_special_token_0|>
def __init__(self, raw_diff):
self.body = os.linesep.join(raw_diff.splitlines()[1:])
self.header = raw_diff.splitlines()[0]
tmp = re.search('^@@ -\\d+', self.header)
self.old_line = tmp.string[tmp.start... | flexible | {
"blob_id": "ffb6379f2f2611fd8aa73f3a3c15fed4550d348f",
"index": 5920,
"step-1": "<mask token>\n\n\nclass CodeBlock:\n <mask token>\n\n def __init__(self, raw_diff):\n self.body = os.linesep.join(raw_diff.splitlines()[1:])\n self.header = raw_diff.splitlines()[0]\n tmp = re.search('^@@... | [
13,
19,
22,
24,
26
] |
import unittest
from game_of_life.board import Board
from game_of_life.cell import Cell, ALIVE, DEAD
def create_test_board(size):
board = Board(size)
board[0, 0].state = ALIVE
board[0, 1].state = ALIVE
board[2, 1].state = ALIVE
return board
class BoardTests(unittest.TestCase):
def test_get_n... | normal | {
"blob_id": "f644ff322d1268092dbdcbfc1a3c76006424184b",
"index": 1482,
"step-1": "<mask token>\n\n\nclass BoardTests(unittest.TestCase):\n\n def test_get_neighbours(self):\n board = create_test_board(3)\n self.assertListEqual(board.get_neighbour_states(1, 0), [None, None,\n ALIVE, ALI... | [
10,
11,
14,
15,
16
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(r)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
a = 'Python|Java|C#|C++|Kotlin|JavaScript'
r = re.findall('Java', a)
print(r)
<|reserved_special_token_1|>
import re
a = 'Python|Java|C#|C++|Kotlin|JavaScrip... | flexible | {
"blob_id": "e05f545ca969e0c2330779ed54a33a594d6ebb25",
"index": 2501,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(r)\n",
"step-3": "<mask token>\na = 'Python|Java|C#|C++|Kotlin|JavaScript'\nr = re.findall('Java', a)\nprint(r)\n",
"step-4": "import re\na = 'Python|Java|C#|C++|Kotlin|JavaScri... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
mibBuilder.exportSymbols('ADTRAN-ATLAS-HSSI-V35-MIB', adtran=adtran, adMgmt
=adMgmt, adATLASHSSIV35IfceReact=adATLASHSSIV35IfceReact, adGenATLASmg=
adGenATLASmg, adATLASmg=adATLASmg, adATLASHSSIV35IfceDeact=
adATLASHSS... | flexible | {
"blob_id": "309807e04bfbf6c32b7105fe87d6ad1247ae411a",
"index": 3192,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmibBuilder.exportSymbols('ADTRAN-ATLAS-HSSI-V35-MIB', adtran=adtran, adMgmt\n =adMgmt, adATLASHSSIV35IfceReact=adATLASHSSIV35IfceReact, adGenATLASmg=\n adGenATLASmg, adATLASmg=adATL... | [
0,
1,
2,
3
] |
from collections import defaultdict, deque
import numpy as np
import gym
from chula_rl.policy.base_policy import BasePolicy
from chula_rl.exception import *
from .base_explorer import BaseExplorer
class OneStepExplorerWithTrace(BaseExplorer):
"""one-step explorer but with n-step trace"""
def __init__(self... | normal | {
"blob_id": "958d7ec966179d63c6ba0a651e99fff70f0db31a",
"index": 5410,
"step-1": "<mask token>\n\n\nclass OneStepExplorerWithTrace(BaseExplorer):\n <mask token>\n <mask token>\n\n def step(self, policy: BasePolicy):\n if self.n_interaction > self.n_max_interaction:\n raise InteractionE... | [
2,
3,
4,
5,
6
] |
# Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
import pylab as pb
from .. import kern
from ..core import model
from ..util.linalg import pdinv,mdot
from ..util.plot import gpplot,x_frame1D,x_frame2D, Tango
from ..likelihoods import E... | normal | {
"blob_id": "2ae953d1d53c47da10ea4c8aace186eba0708ad0",
"index": 3874,
"step-1": "# Copyright (c) 2012, GPy authors (see AUTHORS.txt).\n# Licensed under the BSD 3-clause license (see LICENSE.txt)\n\n\nimport numpy as np\nimport pylab as pb\nfrom .. import kern\nfrom ..core import model\nfrom ..util.linalg import... | [
0
] |
<|reserved_special_token_0|>
class TestGroupInfoService:
<|reserved_special_token_0|>
def test_upsert_group_info_adds_a_new_if_none_exists(self, db_session,
svc, params):
course = factories.Course(authority_provided_id=self.AUTHORITY)
svc.upsert_group_info(course, params=params)
... | flexible | {
"blob_id": "07452795a677836b89eef85b6fb25b33eb464d91",
"index": 1919,
"step-1": "<mask token>\n\n\nclass TestGroupInfoService:\n <mask token>\n\n def test_upsert_group_info_adds_a_new_if_none_exists(self, db_session,\n svc, params):\n course = factories.Course(authority_provided_id=self.AUTH... | [
7,
11,
13,
14,
15
] |
from utilities import SumOneToN, RSS, MSE, R2Score
import numpy as np
import scipy.stats as st
class RidgeLinearModel:
covariance_matrix = None # covariance matrix of the model coefficients
covariance_matrix_updated = False
beta = None # coefficients of the modelfunction
var_vector = None
var_vecto... | normal | {
"blob_id": "a5dcc66ece4e58995fe86c3a399c45975a596b1a",
"index": 5836,
"step-1": "<mask token>\n\n\nclass RidgeLinearModel:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mas... | [
6,
10,
11,
12,
13
] |
<|reserved_special_token_0|>
def fill_grid_with_char_list(charList):
global emojiToShowCount
global fullRowsCount
global lastRowEmojiCount
emojiToShowCount = min(len(charList), emojiGridColumnCount *
emojiGridRowCount)
fullRowsCount = emojiToShowCount // emojiGridColumnCount
lastRowEmo... | flexible | {
"blob_id": "c860c1fa6e7610c60077f0eab1572895a23393fd",
"index": 3725,
"step-1": "<mask token>\n\n\ndef fill_grid_with_char_list(charList):\n global emojiToShowCount\n global fullRowsCount\n global lastRowEmojiCount\n emojiToShowCount = min(len(charList), emojiGridColumnCount *\n emojiGridRowC... | [
17,
19,
21,
24,
29
] |
#デフォルト引数の破壊
#以下、破壊的な操作
def sample(x, arg=[]):
arg.append(x)
return arg
print(sample(1))
print(sample(2))
print(sample(3))
#対策・・・デフォルト引数にはイミュータブルなものを使用する
def sample(x, arg=None):
if arg is None:
arg = []
arg.append(x)
return arg
print(sample(1))
print(sample(2))
pr... | normal | {
"blob_id": "1b645ab0a48b226e26009f76ea49fd3f10f5cc7b",
"index": 3880,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef sample(x, arg=None):\n if arg is None:\n arg = []\n arg.append(x)\n return arg\n\n\n<mask token>\n",
"step-3": "def sample(x, arg=[]):\n arg.append(x)\n re... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Copyright 2015 Donne Martin. 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. A copy of
# the License is located at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# or in the "lice... | normal | {
"blob_id": "a649139a600cb506056a20e00089a07ec9244394",
"index": 858,
"step-1": "<mask token>\n\n\nclass Config(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask t... | [
13,
15,
16,
18,
22
] |
import numpy as np
import skimage
def preprocess_img(img, size):
img = np.rollaxis(img, 0, 3) # It becomes (640, 480, 3)
img = skimage.transform.resize(img, size)
img = skimage.color.rgb2gray(img)
return img
# data = minerl.data.make("MineRLNavigateDense-v0", data_dir="../dataset/navigate")
#
# # I... | normal | {
"blob_id": "9706b9ba81f41b131c364a16bb17a0c1e31e3a04",
"index": 6608,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef preprocess_img(img, size):\n img = np.rollaxis(img, 0, 3)\n img = skimage.transform.resize(img, size)\n img = skimage.color.rgb2gray(img)\n return img\n",
"step-3": ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def loadFile():
global data
x = 0
data = []
subs = ['image', 'text file']
exts = ['.jpg', '.txt']
while x < 2:
check = pathlib.Path(input(f'Enter {subs[x]} name: ')).with_suffix(exts
[x])
if check.is_file():
data.insert(x, ch... | flexible | {
"blob_id": "aae09dafeb10a1f9ed260439e63e4aaadadc3768",
"index": 2051,
"step-1": "<mask token>\n\n\ndef loadFile():\n global data\n x = 0\n data = []\n subs = ['image', 'text file']\n exts = ['.jpg', '.txt']\n while x < 2:\n check = pathlib.Path(input(f'Enter {subs[x]} name: ')).with_suf... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open(filename) as file_object:
lines = file_object.readlines()
<|reserved_special_token_0|>
for line in lines:
c_string += line.rstrip()
print(f"{c_string.replace('Python', 'Scala')}")
<|reserved_special_token_1|>
... | flexible | {
"blob_id": "2f0dc8697e979f307c86a08832b0eae86357d416",
"index": 2497,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open(filename) as file_object:\n lines = file_object.readlines()\n<mask token>\nfor line in lines:\n c_string += line.rstrip()\nprint(f\"{c_string.replace('Python', 'Scala')}\"... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def fetch_data(faultNumber, position):
df1 = pd.read_csv('./data/TEP_CaseStudy_Fault_' + str(faultNumber) +
'_Pos_' + str(position) + '%.csv')
df1.set_index(df1.columns[0])
df1 = df1.drop(columns=[df1.columns... | flexible | {
"blob_id": "d71ec86f68cc81c93a39f15c785c75c2a1023f14",
"index": 2129,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef fetch_data(faultNumber, position):\n df1 = pd.read_csv('./data/TEP_CaseStudy_Fault_' + str(faultNumber) +\n '_Pos_' + str(position) + '%.csv')\n df1.set_index(df1.col... | [
0,
1,
2,
3,
4
] |
import argparse
import logging
import enum
from abc import ABCMeta, abstractmethod
from nmigen import *
from ....gateware.pads import *
from ....gateware.i2c import I2CTarget
from ... import *
class Event(enum.IntEnum):
START = 0x10
STOP = 0x20
RESTART = 0x30
WRITE = 0x40
READ = 0x50
... | normal | {
"blob_id": "0f2882971f08450e970e188ed2a06ae1683c682c",
"index": 7552,
"step-1": "<mask token>\n\n\nclass I2CTargetApplet(GlasgowApplet, name='i2c-target'):\n logger = logging.getLogger(__name__)\n help = 'accept I²C transactions'\n description = \"\"\"\n Process transactions on the I²C bus as a soft... | [
7,
12,
13,
16,
18
] |
from appConfig.App import app, db
import os
dbDir = os.path.dirname(__file__)
# staticFolder = '%sstatic' % os.sep
dbDir = '%s%sappConfig%smine.db' % (dbDir, os.sep, os.sep)
if not os.path.exists(dbDir):
# 创建数据库并创建表
db.create_all()
# app._static_folder = staticFolder
@app.route('/')
def hello_world():
... | normal | {
"blob_id": "71cee06ce697030fd0cea363ddecaa411b39544d",
"index": 4330,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef hello_world():\n return 'Hello Waeweorld!'\n\n\n<mask token>\n",
"step-2": "<mask token>\nif not os.path.exists(dbDir):\n db.create_all()\n\n\n@app.route('/')\ndef hello_world():\n ... | [
1,
2,
3,
4,
5
] |
# ToDo:
"""
965. Univalued Binary Tree
Easy
A binary tree is univalued if every node in the tree has the same value.
Return true if and only if the given tree is univalued.
Note:
The number of nodes in the given tree will be in the range [1, 100].
Each node's value will be an integer in the range [0, 99].
... | normal | {
"blob_id": "7e9efb267a5464a6e53f81f63d82c28acba8bc8c",
"index": 5543,
"step-1": "# ToDo:\n\n\"\"\"\n965. Univalued Binary Tree\nEasy\n\nA binary tree is univalued if every node in the tree has the same value.\n\nReturn true if and only if the given tree is univalued.\n\nNote:\n\n The number of nodes in the g... | [
0
] |
class Anagram(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def match(self, words):
return filter(self._is_anagram, words)
<|reserved_special_token_1|>
class Anagram(object):
def __init__(self, word):
self.word = word
sel... | flexible | {
"blob_id": "44224985dbfa6234eff406149ce25e1d00b512e9",
"index": 620,
"step-1": "class Anagram(object):\n <mask token>\n <mask token>\n <mask token>\n\n def match(self, words):\n return filter(self._is_anagram, words)\n",
"step-2": "class Anagram(object):\n\n def __init__(self, word):\n ... | [
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
"""
Created on Sun Sep 10 12:18:06 2017
@author: wqmike123
"""
#%% build a simple CNN with gloVec as initial
from keras.preprocessing import sequence
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation
from keras.layers import Embedding
from keras.layers impo... | normal | {
"blob_id": "e235be879cf8a00eb9f39f90859689a29b26f1c6",
"index": 3161,
"step-1": "<mask token>\n\n\nclass cnn:\n\n def __init__(self, maxlen, max_voc, embedweight=None, embedding_dims=\n 300, batch_size=30, filters=1024, conv_kernel=3, hidden_dim=2048,\n epochs=20, output_dim=2, dropout=0.1, tra... | [
4,
5,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def GetDensity(T, P, config):
return P / (T * config['Flow']['mixture']['gasConstant'])
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def GetDensity(T, P, config):
return P / (T * config['Flow']['mixture']['gasConstant'])
def GetVis... | flexible | {
"blob_id": "0e47a7d9cd6809886674291d6a535dd18205a012",
"index": 5455,
"step-1": "<mask token>\n",
"step-2": "def GetDensity(T, P, config):\n return P / (T * config['Flow']['mixture']['gasConstant'])\n\n\n<mask token>\n",
"step-3": "def GetDensity(T, P, config):\n return P / (T * config['Flow']['mixtur... | [
0,
1,
2,
3
] |
from connect.client import ClientError, ConnectClient, R
def test_import_client():
from cnct import ConnectClient as MovedConnectClient
assert MovedConnectClient == ConnectClient
def test_import_error():
from cnct import ClientError as MovedClientError
assert MovedClientError == ClientError
def te... | normal | {
"blob_id": "e5a71250ca9f17798011d8fbfaee6a3d55446598",
"index": 6145,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_import_error():\n from cnct import ClientError as MovedClientError\n assert MovedClientError == ClientError\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\ndef tes... | [
0,
1,
2,
3,
4
] |
from configparser import ConfigParser
from ef.config.components import *
from ef.config.efconf import EfConf
from ef.config.section import ConfigSection
comp_list = [BoundaryConditions, InnerRegion, OutputFile, ParticleInteractionModel,
ParticleSource, SpatialMesh, TimeGrid, ExternalFieldUniform]
def t... | normal | {
"blob_id": "edcccc673994a8de281a683b747de52d2115f89e",
"index": 347,
"step-1": "<mask token>\n\n\ndef test_components_to_conf_and_back():\n for Component in comp_list:\n x = Component()\n y = x.to_conf().make()\n assert x == y\n\n\n<mask token>\n\n\nclass TestEfConf:\n\n def test_conf... | [
4,
5,
6,
8,
9
] |
class SmartChineseAnalyzer:
def __init__(self):
pass
def create_components(self, filename):
#tokenizer = SentenceTokenize(filename)
#result = WordTokenFilter(tokenizer)
#result = PorterStemFilter(result)
if self.stopwords:
result = StopFilter(result,... | normal | {
"blob_id": "e486e0ab91a8f5671435f5bbcf5340a62a970d3a",
"index": 8670,
"step-1": "<mask token>\n",
"step-2": "class SmartChineseAnalyzer:\n <mask token>\n <mask token>\n",
"step-3": "class SmartChineseAnalyzer:\n <mask token>\n\n def create_components(self, filename):\n if self.stopwords:\... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Constants:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserve... | flexible | {
"blob_id": "b2bb7393bf7955f5de30c59364b495b8f888e178",
"index": 4073,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Constants:\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@app.route('/')
def home():
if 'username' in session:
id_num = db.search_user_list(session['username'], is_usrname=True)[0][2
]
finavail = db.search_finance_list(id_num)
goalavail = db.search_goal_list(id_num)
if finavail:
sessio... | flexible | {
"blob_id": "5c20eefe8111d44a36e69b873a71377ee7bfa23d",
"index": 6768,
"step-1": "<mask token>\n\n\n@app.route('/')\ndef home():\n if 'username' in session:\n id_num = db.search_user_list(session['username'], is_usrname=True)[0][2\n ]\n finavail = db.search_finance_list(id_num)\n ... | [
14,
15,
16,
18,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(string1 == string2)
print(string1 != string2)
if string1.lower() == string2.lower():
print('The strings are equal')
else:
print('The strings are not equal')
<|reserved_special_token_0|>
if number1 <= number2:
pri... | flexible | {
"blob_id": "fecaf41152e8c98784585abfdb3777fc0a4824f3",
"index": 1052,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(string1 == string2)\nprint(string1 != string2)\nif string1.lower() == string2.lower():\n print('The strings are equal')\nelse:\n print('The strings are not equal')\n<mask toke... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
ret, frame = cam.read()
cv2.imshow('frame', frame)
cv2.waitKey(1)
<|reserved_special_token_1|>
<|reserved_special_token_0|>
cam = cv2.VideoCapture('./bebop.sdp')
while True:
ret, frame = cam.read()
... | flexible | {
"blob_id": "d13b402b90bb948e5722f45096a8c0a33e4cac67",
"index": 6968,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n ret, frame = cam.read()\n cv2.imshow('frame', frame)\n cv2.waitKey(1)\n",
"step-3": "<mask token>\ncam = cv2.VideoCapture('./bebop.sdp')\nwhile True:\n ret, fr... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
setup(name='gym_asset_allocation', version='0.0.1', install_requires=['gym',
'numpy', 'pandas', 'quandl'])
<|reserved_special_token_1|>
from setuptools import setup
setup(name='gym_asset_allocation', version='0.0.1', instal... | flexible | {
"blob_id": "952f8341f0fcbe6f3f3d1075ce345e61967a4336",
"index": 4381,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='gym_asset_allocation', version='0.0.1', install_requires=['gym',\n 'numpy', 'pandas', 'quandl'])\n",
"step-3": "from setuptools import setup\nsetup(name='gym_asset_alloca... | [
0,
1,
2,
3
] |
#-*-coding:utf-8-*-
from Classify import get_train_data
import sys
'''
获取训练集数据
'''
get_train_data(sys.argv[1], sys.argv[2]) | normal | {
"blob_id": "513aff6cf29bbce55e2382943767a9a21df2e98e",
"index": 5080,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nget_train_data(sys.argv[1], sys.argv[2])\n",
"step-3": "from Classify import get_train_data\nimport sys\n<mask token>\nget_train_data(sys.argv[1], sys.argv[2])\n",
"step-4": "#-*-codi... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(N):
ans += B_list[A_list[i] - 1]
if i < N - 1:
if A_list[i] + 1 == A_list[i + 1]:
ans += C_list[A_list[i] - 1]
print(ans)
<|reserved_special_token_1|>
N = int(input())
A_list = list(ma... | flexible | {
"blob_id": "cc160b1b0478446ba0daec4a0fe9e63453df3d96",
"index": 5029,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(N):\n ans += B_list[A_list[i] - 1]\n if i < N - 1:\n if A_list[i] + 1 == A_list[i + 1]:\n ans += C_list[A_list[i] - 1]\nprint(ans)\n",
"step-3": "... | [
0,
1,
2
] |
from ..IReg import IReg
class RC165(IReg):
def __init__(self):
self._header = ['REG',
'COD_PART',
'VEIC_ID',
'COD_AUT',
'NR_PASSE',
'HORA',
'TEMPER',
... | normal | {
"blob_id": "bf73e2109f11b2214fae060bc343b01091765c2a",
"index": 2325,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass RC165(IReg):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass RC165(IReg):\n\n def __init__(self):\n self._header = ['REG', 'COD_PART', 'VEIC_ID', 'COD_AUT',... | [
0,
1,
2,
3,
4
] |
#Simple Pig Latin
def pig_it(text):
return " ".join( letter if letter == "!" or letter == "?" else (letter[1:] + letter[0] + "ay") for letter in text.split(" "))
| normal | {
"blob_id": "25641b3a9919db1f172fca22acf413062505de1b",
"index": 6894,
"step-1": "<mask token>\n",
"step-2": "def pig_it(text):\n return ' '.join(letter if letter == '!' or letter == '?' else letter[1:\n ] + letter[0] + 'ay' for letter in text.split(' '))\n",
"step-3": "#Simple Pig Latin\ndef pig_i... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
argparser.add_argument('-utilsPath', '--utilsPath', help=
'path to the package smodels_utils', type=str)
argparser.add_argument('-smodelsPath', '--smodelsPath', help=
'path to the package smodels_utils', type=str)
<|reserv... | flexible | {
"blob_id": "c80b31bc154d5c1c8f9fc0ac226295160f2f9473",
"index": 4249,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nargparser.add_argument('-utilsPath', '--utilsPath', help=\n 'path to the package smodels_utils', type=str)\nargparser.add_argument('-smodelsPath', '--smodelsPath', help=\n 'path to ... | [
0,
1,
2,
3,
4
] |
from requests import post
import json
import argparse
import base64
from ReadFromWindow import new_image_string
from ParsOnText import ParsOnText
# Функция возвращает IAM-токен для аккаунта на Яндексе.
def get_iam_token(iam_url, oauth_token):
response = post(iam_url, json={"yandexPassportOauthToken": oauth_token})... | normal | {
"blob_id": "360063940bb82defefc4195a5e17c9778b47e9e5",
"index": 792,
"step-1": "<mask token>\n\n\ndef get_iam_token(iam_url, oauth_token):\n response = post(iam_url, json={'yandexPassportOauthToken': oauth_token})\n json_data = json.loads(response.text)\n if json_data is not None and 'iamToken' in json... | [
1,
2,
3,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def PrimeTime(num):
prime1 = (num - 1) % 6
prime2 = (num + 1) % 6
if prime1 * prime2 == 0:
return 'True'
else:
return 'False'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def PrimeTime(num):
prime1 = (num ... | flexible | {
"blob_id": "5068a78a1aa31a277b3b5854ddd1d8990d07b104",
"index": 3627,
"step-1": "<mask token>\n",
"step-2": "def PrimeTime(num):\n prime1 = (num - 1) % 6\n prime2 = (num + 1) % 6\n if prime1 * prime2 == 0:\n return 'True'\n else:\n return 'False'\n\n\n<mask token>\n",
"step-3": "de... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def mergeSort(alist):
print('Splitting ', alist)
if len(alist) > 1:
mid = len(alist) // 2
lefthalf = alist[:mid]
righthalf = alist[mid:]
mergeSort(lefthalf)
mergeSort(righthalf)
a = 0
b = 0
k = 0
while a < len... | flexible | {
"blob_id": "9e98c6b59433369bca3d4f7ae261f7e7ab3aae6b",
"index": 4161,
"step-1": "<mask token>\n\n\ndef mergeSort(alist):\n print('Splitting ', alist)\n if len(alist) > 1:\n mid = len(alist) // 2\n lefthalf = alist[:mid]\n righthalf = alist[mid:]\n mergeSort(lefthalf)\n m... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def test_dilami_date():
gdate = datetime(2018, 2, 1)
ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone)
assert ddate.year == 1591
assert ddate.month == 6
assert ddate.day == 28
ddate = DilamiDatetime(15... | flexible | {
"blob_id": "7997efb00f24ecc5c4fbf3ca049eca6b5b178d53",
"index": 4088,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_dilami_date():\n gdate = datetime(2018, 2, 1)\n ddate = DilamiDatetime(gdate, tzinfo=TehranTimezone)\n assert ddate.year == 1591\n assert ddate.month == 6\n as... | [
0,
1,
2,
3,
4
] |
from django.db import models
# Create your models here.
class Author(models.Model):
AuthorID = models.IntegerField(primary_key=True)
Name = models.CharField(max_length=200)
Age = models.IntegerField(max_length=50)
Country = models.CharField(max_length=100)
class Book(models.Model):
ISBN = models.C... | normal | {
"blob_id": "817d7259b3607f3a94d2f363c9684f733ee87d37",
"index": 2124,
"step-1": "<mask token>\n\n\nclass Book(models.Model):\n ISBN = models.CharField(primary_key=True, max_length=100)\n Title = models.CharField(max_length=200)\n AuthorID = models.IntegerField(max_length=100)\n Publisher = models.Ch... | [
2,
3,
4,
5,
6
] |
# encoding: utf-8
from GlyphsApp.plugins import *
from outlineTestPenGlyphs import OutlineTestPenGlyphs
from string import strip
plugin_id = "de.kutilek.RedArrow"
class RedArrow(ReporterPlugin):
def settings(self):
self.menuName = "Red Arrows"
self.keyboardShortcut = 'a'
self.keyboardShortcutModifier = N... | normal | {
"blob_id": "229d7378695f7e00176eb7c3962519af3db1b7e1",
"index": 4461,
"step-1": "<mask token>\n\n\nclass RedArrow(ReporterPlugin):\n <mask token>\n\n def start(self):\n self.addMenuItem()\n self.options = {'extremum_calculate_badness': False,\n 'extremum_ignore_badness_below': 0,\... | [
7,
10,
12,
13,
14
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
s = s.replace('<p>', '').replace('</p>', '')
<|reserved_special_token_1|>
# Python : Correct way to strip <p> and </p> from string?
s = s.replace('<p>', '').replace('</p>', '')
| flexible | {
"blob_id": "7b6e73744d711188ab1a622c309b8ee55f3eb471",
"index": 7427,
"step-1": "<mask token>\n",
"step-2": "s = s.replace('<p>', '').replace('</p>', '')\n",
"step-3": "# Python : Correct way to strip <p> and </p> from string?\ns = s.replace('<p>', '').replace('</p>', '')\n",
"step... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class model_construction:
<|reserved_special_token_0|>
def implement_model(self, filename):
"""
Method inside the model_construction class, used for implementing the model
and return feature importance and dataframe with actual values and predicted values ... | flexible | {
"blob_id": "f07b95a3b18aecf6cadaa8398c9158a7cd10aeeb",
"index": 7101,
"step-1": "<mask token>\n\n\nclass model_construction:\n <mask token>\n\n def implement_model(self, filename):\n \"\"\"\n Method inside the model_construction class, used for implementing the model\n and return feat... | [
2,
3,
4,
5,
7
] |
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwnerOrStaffOrReadOnly(BasePermission):
def has_object_permission(self, request, view, obj):
"""
Переопределяем права доступа.
Даем все права на запись, только владельцу или
администратору, на чтение даем... | normal | {
"blob_id": "4488612164435ab062ca66000f0d7dc3ccd89da2",
"index": 8150,
"step-1": "<mask token>\n\n\nclass IsOwnerOrStaffOrReadOnly(BasePermission):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass IsOwnerOrStaffOrReadOnly(BasePermission):\n\n def has_object_permission(self, request... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class MyMan(Manager):
def run(self, commands=None, default_command=None):
"""
Prepares manager to receive command line input. Usually run
inside "if __name__ == "__main__" block in a Python script.
:param commands: optional dict of commands. Appended ... | flexible | {
"blob_id": "c331802cf5a09bc8db8ddbfa37636a01cf73684e",
"index": 2626,
"step-1": "<mask token>\n\n\nclass MyMan(Manager):\n\n def run(self, commands=None, default_command=None):\n \"\"\"\n Prepares manager to receive command line input. Usually run\n inside \"if __name__ == \"__main__\" b... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def is_symmetric(root):
def helper(left, right):
if left is None and right is None:
return True
elif left and right:
return helper(left.left, right.right
) and left.va... | flexible | {
"blob_id": "9cfbb06df4bc286ff56983d6e843b33e4da6ccf8",
"index": 7803,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef is_symmetric(root):\n\n def helper(left, right):\n if left is None and right is None:\n return True\n elif left and right:\n return helper(l... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def getColorString(color_reading):
if color_reading == 1:
return 'black'
elif color_reading == 2:
return 'white'
elif color_reading == 3:
return 'green'
elif color_reading == 4:
return 'white'
elif color_reading == 5:
return 'red... | flexible | {
"blob_id": "84a13e3dea885d6c4a5f195dfac51c7110102fc2",
"index": 6729,
"step-1": "<mask token>\n\n\ndef getColorString(color_reading):\n if color_reading == 1:\n return 'black'\n elif color_reading == 2:\n return 'white'\n elif color_reading == 3:\n return 'green'\n elif color_re... | [
1,
2,
3,
4,
5
] |
from flask import Blueprint, request, render_template, session, redirect
log = Blueprint('login', __name__, )
@log.route('/login', methods=['GET', 'POST'])
def login():
print(request.path, )
if request.method == 'GET':
return render_template('exec/login.html')
else:
username = request.for... | normal | {
"blob_id": "763e2db4eb9ad5953273fb310c8e9714964a39e6",
"index": 9576,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@log.route('/login', methods=['GET', 'POST'])\ndef login():\n print(request.path)\n if request.method == 'GET':\n return render_template('exec/login.html')\n else:\n ... | [
0,
1,
2,
3,
4
] |
#Credits To @maxprogrammer007 (for editing)
# Ported for Ultroid < https://github.com/TeamUltroid/Ultroid >
import os
import sys
import logging
from telethon import events
import asyncio
from userbot.utils import admin_cmd
from userbot import ALIVE_NAME
import random, re
from userbot import CMD_HELP
from collectio... | normal | {
"blob_id": "51cff2f7dd1fd10c6f447d62db3e98075caebe51",
"index": 1708,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\n@borg.on(admin_cmd(pattern='stupid$'))\nasync def _(event):\n if event.fwd_from:\n return\n animation_interval = 1\n animation_ttl = range(0, 14)\n await event.edit... | [
0,
1,
2,
3,
4
] |
# -*- coding: utf-8 -*-
# Copyright 2014 Foxdog Studios
#
# 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 l... | normal | {
"blob_id": "e103e7a215614e1a7923838b775f49bba2792036",
"index": 8508,
"step-1": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass MethodMessageParserTestCase(unittest.TestCase):\n <mask token>\n\n def test_... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Demo2:
def __init__(self, number1, number2):
sumOfNumbers = number1 + number2
print(sumOfNumbers)
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Demo:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class Demo2:
def _... | flexible | {
"blob_id": "b005f4657a1036044c2e6051207641fe621eb17e",
"index": 8861,
"step-1": "<mask token>\n\n\nclass Demo2:\n\n def __init__(self, number1, number2):\n sumOfNumbers = number1 + number2\n print(sumOfNumbers)\n\n\n<mask token>\n",
"step-2": "class Demo:\n <mask token>\n\n\n<mask token>\n... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def write_head(file):
with open('head.tex', 'r') as head:
for line in head:
f.write(line)
def write_foot(file):
with open('foot.tex', 'r') as head:
for line in head:
f.write(line)
<|reserved_special_token_0|>
<|reserved_special_token_1... | flexible | {
"blob_id": "5c0ee6e8a0d80dbb77a7a376c411b85bf1405272",
"index": 1880,
"step-1": "<mask token>\n\n\ndef write_head(file):\n with open('head.tex', 'r') as head:\n for line in head:\n f.write(line)\n\n\ndef write_foot(file):\n with open('foot.tex', 'r') as head:\n for line in head:\n... | [
2,
3,
4,
5,
6
] |
# https://www.acmicpc.net/problem/20540
# 각 지표의 반대되는 지표를 저장한 dictionary
MBTI_reverse_index = {
'E': 'I',
'I': 'E',
'S': 'N',
'N': 'S',
'T': 'F',
'F': 'T',
'J': 'P',
'P': 'J'
}
# 연길이의 MBTI 4글자를 대문자로 입력
yeongil_MBTI = input()
# 연길이 MBTI의 각 지표에 반대되는 지표를 출력
for i in yeongil_MBTI:
prin... | normal | {
"blob_id": "c247b218267fc7c2bee93053dd90b2806572eaf2",
"index": 4234,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in yeongil_MBTI:\n print(MBTI_reverse_index[i], end='')\n",
"step-3": "MBTI_reverse_index = {'E': 'I', 'I': 'E', 'S': 'N', 'N': 'S', 'T': 'F', 'F':\n 'T', 'J': 'P', 'P': 'J'... | [
0,
1,
2,
3
] |
from django.contrib import admin
from .models import Account
# Register your models here.
class AuthenticationCustom(admin.ModelAdmin):
list_display = ("email", "id")
search_fields = ["email", "mobile"]
admin.site.register(Account, AuthenticationCustom) | normal | {
"blob_id": "4957e62deec6192aabdf7144f02b28c7ce60ed4b",
"index": 4250,
"step-1": "<mask token>\n\n\nclass AuthenticationCustom(admin.ModelAdmin):\n <mask token>\n <mask token>\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\nclass AuthenticationCustom(admin.ModelAdmin):\n list_display = 'email', 'id... | [
1,
2,
3,
4,
5
] |
threehome = 25 * 3
twotonnel = 40 * 2
alldude = threehome + twotonnel
print('%s Заварушку устроили' % alldude)
| normal | {
"blob_id": "e492680efe57bd36b58c00977ecd79196501997a",
"index": 7952,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('%s Заварушку устроили' % alldude)\n",
"step-3": "threehome = 25 * 3\ntwotonnel = 40 * 2\nalldude = threehome + twotonnel\nprint('%s Заварушку устроили' % alldude)\n",
"step-4":... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class SaleOrderLine(osv.osv):
<|reserved_special_token_0|>
_inherit = 'sale.order.line'
_columns = {'promotion_line': fields.boolean('Promotion Line', help=
'Indicates if the line was created by promotions')}
<|reserved_special_token_0|>
<|reserved_special_token_1|... | flexible | {
"blob_id": "d9538c030c0225c4255100da70d6bf23f550a64f",
"index": 734,
"step-1": "<mask token>\n\n\nclass SaleOrderLine(osv.osv):\n <mask token>\n _inherit = 'sale.order.line'\n _columns = {'promotion_line': fields.boolean('Promotion Line', help=\n 'Indicates if the line was created by promotions'... | [
2,
4,
6,
9,
10
] |
# Code
import json
import os
import pandas
from pathlib import Path
from asyncio import sleep
# Import default websocket conection instance
from channels.generic.websocket import AsyncJsonWebsocketConsumer
# Global variable ----------
timeout = 0.5
# Get curent working directory
cwd = os.getcwd() # Get... | normal | {
"blob_id": "466ffbd1f25423e4209fa7331d8b824b2dd3cd70",
"index": 4031,
"step-1": "<mask token>\n\n\nclass recomend(AsyncJsonWebsocketConsumer):\n\n async def connect(self):\n await self.accept()\n while True:\n df = pandas.read_csv(dataDir + 'Readings.csv', sep='\\\\t')\n r... | [
6,
7,
8,
10,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
my_logger.setLevel(logging.DEBUG)
<|reserved_special_token_0|>
handler.setFormatter(formatter)
my_logger.addHandler(handler)
<|reserved_special_token_0|>
while 1:
c.execute(
'SELECT * FROM TEMP_HIST WHERE ID=(SELECT MA... | flexible | {
"blob_id": "fcc75550e1317a15c36bc8100c28af59b68e1381",
"index": 1571,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nmy_logger.setLevel(logging.DEBUG)\n<mask token>\nhandler.setFormatter(formatter)\nmy_logger.addHandler(handler)\n<mask token>\nwhile 1:\n c.execute(\n 'SELECT * FROM TEMP_HIST W... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class IsSubtreeTest(TestCase):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class IsSubtreeTest(TestCase):
<|reserved_special_token_0|>
def test_should_not_be_subtree(self):
container = to... | flexible | {
"blob_id": "51f7faaad29379daa58875c7b35d9ccf569c8766",
"index": 6801,
"step-1": "<mask token>\n\n\nclass IsSubtreeTest(TestCase):\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass IsSubtreeTest(TestCase):\n <mask token>\n\n def test_should_not_be_subtree(self):\n containe... | [
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@route('/candidate/hired', method=['POST'])
def update_delete_handler():
response.content_type = 'application/json'
return json.dumps({'hired': True})
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
@route('/candidate/hired', method=['... | flexible | {
"blob_id": "50e759ff24cdb8fbb5a98d9381afb13ebc1a74f1",
"index": 7317,
"step-1": "<mask token>\n\n\n@route('/candidate/hired', method=['POST'])\ndef update_delete_handler():\n response.content_type = 'application/json'\n return json.dumps({'hired': True})\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n... | [
1,
2,
3,
4,
5
] |
# -*- coding:utf-8 -*-
import time
class Base:
def getTime(self):
'''
获取时间戳
:return:
'''
return str(time.time()).split('.')[0] | normal | {
"blob_id": "28a920072bad1b411d71f7f70cd991cb7dfbeb8c",
"index": 8754,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Base:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Base:\n\n def getTime(self):\n \"\"\"\n 获取时间戳\n :return: \n \"\"\"\n retur... | [
0,
1,
2,
3,
4
] |
'''
www.autonomous.ai
Phan Le Son
plson03@gmail.com
'''
import speech_recognition as sr
import pyaudio
from os import listdir
from os import path
import time
import wave
import threading
import numpy as np
import BF.BeamForming as BF
import BF.Parameter as PAR
import BF.asr_wer as wer
import BF.mic_array_read as READ
i... | normal | {
"blob_id": "8c458d66ab2f9a1bf1923eecb29c3c89f2808d0b",
"index": 3889,
"step-1": "<mask token>\n\n\nclass PlayOut(threading.Thread):\n\n def __init__(self):\n threading.Thread.__init__(self)\n self.wavefiles = [f for f in listdir('./en') if path.isfile(path.\n join('./en', f))]\n\n ... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
def get_ticker(order_currency, payment_currency):
"""
获取指定交易对的ticker信息:https://apidocs.bithumb.com/docs/ticker
https://api.bithumb.com/public/ticker/BTC_KRW
:return:
{
"status":"0000",
"data":{"opening_price":"63241000","closing_price":"63651000","min_price":"6... | flexible | {
"blob_id": "f268dc4c2ae2c17e7d0d3921d29e6b952fc63c7d",
"index": 9802,
"step-1": "<mask token>\n\n\ndef get_ticker(order_currency, payment_currency):\n \"\"\"\n 获取指定交易对的ticker信息:https://apidocs.bithumb.com/docs/ticker\n https://api.bithumb.com/public/ticker/BTC_KRW\n :return:\n {\n \"status\":\... | [
3,
6,
7,
8,
9
] |
print("RUNNING ON CPU")
from library import config, utils, broker_funcs, portfolio
import numpy as np
import pandas as pd
# import matplotlib.pyplot as plt
from fbm.fbmlib import fbm
import time
import pickle
assert config.changePrice == True
print(config.config)
t0 = time.localtime()
t0str = time.strftime("%H:%M:%S... | normal | {
"blob_id": "21aee78e8cbb1ca150bca880e79dc0d84326e2d4",
"index": 4162,
"step-1": "<mask token>\n",
"step-2": "print('RUNNING ON CPU')\n<mask token>\nassert config.changePrice == True\nprint(config.config)\n<mask token>\nfor t in range(993, 4592):\n broker, totalOrders = broker_funcs.thresholdBrokerage(trade... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def perform_math():
"""(numbers) -> numbers
accepts numbers from the user and performs continuous
mathematical equations on them.
precondition input must be numbers and mathematical signs
"""
global run
global previous
equation = ''
if previous =... | flexible | {
"blob_id": "4122da21abab462a28c925c1afa5792ec729a75a",
"index": 5087,
"step-1": "<mask token>\n\n\ndef perform_math():\n \"\"\"(numbers) -> numbers\n\n accepts numbers from the user and performs continuous\n mathematical equations on them.\n\n precondition input must be numbers and mathematical sign... | [
1,
2,
3,
4,
5
] |
"""
Вам дана последовательность строк.
В каждой строке замените все вхождения нескольких одинаковых букв на одну букву.
Буквой считается символ из группы \w.
Sample Input:
attraction
buzzzz
Sample Output:
atraction
buz
"""
from sys import stdin
import re
for word in stdin:
lst_in = word
match = re.finditer(r... | normal | {
"blob_id": "5b7c04f23fb674191639e95dff8c530933379d67",
"index": 3686,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor word in stdin:\n lst_in = word\n match = re.finditer('(\\\\w)\\\\1+', lst_in)\n for item in match:\n lst_in = lst_in.replace(item[0], item[0][0])\n print(lst_in, en... | [
0,
1,
2,
3
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.