code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
from PySide.QtCore import (qAbs, QLineF, QPointF, qrand, QRectF, QSizeF, qsrand,
Qt, QTime,QSettings,QSize,QPoint)
from PySide.QtGui import (QBrush, QKeySequence, QColor, QLinearGradient, QPainter,
QPainterPath, QPen, QPolygonF, QRadialGradient, QApplication, QGraphicsItem, QGraphicsScene,
QGra... | normal | {
"blob_id": "88a3c3fad9717675ed13bcbc778d635f6552c4b1",
"index": 8215,
"step-1": "<mask token>\n\n\nclass RepresentationPane(BasePane):\n\n def __init__(self, setting_dict):\n BasePane.__init__(self)\n repLayout = QVBoxLayout()\n genLayout = QFormLayout()\n self.winLenEdit = QLineE... | [
20,
23,
28,
30,
31
] |
from Crypto.Hash import SHA512
from Crypto.PublicKey import RSA
from Crypto import Random
from collections import Counter
from Tkinter import Tk
from tkFileDialog import askopenfilename
import ast
import os
import tkMessageBox
from Tkinter import Tk
from tkFileDialog import askopenfilename
import Tkinter
import tkSimpl... | normal | {
"blob_id": "da696961fea72e1482beae73c19b042b94d93886",
"index": 1660,
"step-1": "<mask token>\n\n\ndef read_file_all(file_name):\n filename = os.path.join(fileDir, str(file_name))\n with open(filename, 'r') as f:\n read_data = f.readlines()\n return read_data\n\n\n<mask token>\n\n\ndef selec... | [
3,
9,
10,
11,
12
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
pl.clf()
pl.plot(x, d['reelection'], 'o-', label='reelection')
pl.plot(x, d['rerun'], 'o-', label='rerun')
pl.plot(x, d['ratio'], 'o-', label='incumbent ratio')
pl.fill_between(x, d['ratio'], np.zeros(len(d.index)), facecolor='red... | flexible | {
"blob_id": "156b3e09a65402d4f964c2886b8f5519168eb13a",
"index": 2894,
"step-1": "<mask token>\n",
"step-2": "<mask token>\npl.clf()\npl.plot(x, d['reelection'], 'o-', label='reelection')\npl.plot(x, d['rerun'], 'o-', label='rerun')\npl.plot(x, d['ratio'], 'o-', label='incumbent ratio')\npl.fill_between(x, d['... | [
0,
1,
2,
3,
4
] |
class MinHeap:
__heap = [-0]
def __init__(self):
pass
def insert(self, value):
self.__heap.append(value)
self.__sift_up()
def pop(self):
if len(self.__heap) == 1:
return None
minimum = self.__heap[1]
if len(self.__heap) == 2:
sel... | normal | {
"blob_id": "d412e5768b23b8bbb8f72e2ae204650bbc1f0550",
"index": 8979,
"step-1": "class MinHeap:\n <mask token>\n\n def __init__(self):\n pass\n\n def insert(self, value):\n self.__heap.append(value)\n self.__sift_up()\n\n def pop(self):\n if len(self.__heap) == 1:\n ... | [
4,
5,
6,
7
] |
import numpy as np
from board_specs import *
from board_components import *
import constants
import board_test
# List of resources available to be distributed on the board
RESOURCE_NAMES = constants.RESOURCE_NAMES
# Create a dictionary of each resource and a corresponding number id
res_dict = dict(zip(RESOURCE_NAMES,... | normal | {
"blob_id": "ee22d6226f734c67be91a3ccf1c8c0024bb7dc08",
"index": 5818,
"step-1": "<mask token>\n\n\nclass Board:\n\n def __init__(self):\n \"\"\"\n Do not forget to ensure 6 and 8 are not next to each other:\n no 6-6 no 6-8 no 8-8\n \"\"\"\n self.board_resources = np.array([... | [
7,
8,
10,
12,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
cv.line(img, (0, 0), (511, 511), (255, 255, 255), 10)
cv.rectangle(img, (384, 0), (510, 128), (255, 0, 0), 3)
cv.circle(img, (200, 60), 20, (0, 100, 255), 3)
cv.ellipse(img, (250, 250), (100, 50), 90, 0, 180, (255, 0, 255), 3)
<|r... | flexible | {
"blob_id": "08c5f5ac568b7575d8082976336a5893951b53c2",
"index": 9269,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ncv.line(img, (0, 0), (511, 511), (255, 255, 255), 10)\ncv.rectangle(img, (384, 0), (510, 128), (255, 0, 0), 3)\ncv.circle(img, (200, 60), 20, (0, 100, 255), 3)\ncv.ellipse(img, (250, 250)... | [
0,
1,
2,
3
] |
import os
import glob
import pandas as pd
classes = os.listdir(os.getcwd())
for classf in classes:
#if os.path.isfile(classf) or classf == 'LAST':
#continue
PWD = os.getcwd() + "/" + classf + "/"
currentdname = os.path.basename(os.getcwd())
csvfiles=glob.glob(PWD + "/*.csv")
df = pd.DataFrame(columns=['im... | normal | {
"blob_id": "3ebd455056f168f8f69b9005c643c519e5d0b436",
"index": 8286,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor classf in classes:\n PWD = os.getcwd() + '/' + classf + '/'\n currentdname = os.path.basename(os.getcwd())\n csvfiles = glob.glob(PWD + '/*.csv')\n df = pd.DataFrame(colum... | [
0,
1,
2,
3,
4
] |
"""
时间最优
思路:
将和为目标值的那 两个 整数定义为 num1 和 num2
创建一个新字典,内容存在数组中的数字及索引
将数组nums转换为字典,
遍历字典, num1为字典中的元素(其实与数组总的元素一样),
num2 为 target减去num1, 判定num2是否在字典中,如果存在,返回字典中num2的值(也就是在数组nums中的下标)和 i(也就是num1在数组中的下标)
如果不存在,设置字典num1的值为i
"""
def two_sum(nums, target):
dct = {}
for i, num1 in enumerate(nums):
... | normal | {
"blob_id": "dac8dbb0eba78d4f8dfbe3284325735324a87dc2",
"index": 8674,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef two_sum(nums, target):\n dct = {}\n for i, num1 in enumerate(nums):\n num2 = target - num1\n if num2 in dct:\n return [dct[num2], i]\n dct[nu... | [
0,
1,
2,
3
] |
from rest_framework.generics import GenericAPIView
from rest_framework.response import Response
from rest_framework.status import HTTP_400_BAD_REQUEST, HTTP_404_NOT_FOUND
from ...models.brand import Brand
from ...models.product import type_currency_choices, type_condition_choices, User, Product
from ...models.product_c... | normal | {
"blob_id": "47e9b73fc7f6b3c8295e78d0cdb5aa51ca4c5f8d",
"index": 8140,
"step-1": "<mask token>\n\n\nclass UpdateProduct(GenericAPIView):\n <mask token>\n <mask token>\n <mask token>\n\n def get(self, request, *args, **kwargs):\n data = self.get_queryset()\n extract_sp = self.extract_fil... | [
11,
13,
16,
17,
19
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def sdssDownload(band, location, size, path):
"""
.
sdssArchie populates a directory with links to raw images
from the SDSS mission. These images are all in FITS format
and suitable for reprojection, moaic... | flexible | {
"blob_id": "459bd36037158c9a6a38da6eadf45a3dc6f19e04",
"index": 4405,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef sdssDownload(band, location, size, path):\n \"\"\"\n .\n sdssArchie populates a directory with links to raw images \n from the SDSS mission. These images are all in F... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Visualiser:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __build_map(self):
"""
Creates the array of the battlefield. Should never be used for logical operations
:return:
"""
colum... | flexible | {
"blob_id": "e5e012e40a71dee9f4dbd9913590aef125b758df",
"index": 223,
"step-1": "<mask token>\n\n\nclass Visualiser:\n <mask token>\n <mask token>\n <mask token>\n\n def __build_map(self):\n \"\"\"\n Creates the array of the battlefield. Should never be used for logical operations\n ... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('bace/__init__.py') as fid:
for line in fid:
if line.startswith('__version__'):
VERSION = line.strip().split()[-1][1:-1]
break
with open('requirements.txt') as fid:
INSTALL_REQUIRE... | flexible | {
"blob_id": "d28571214805df766c2cc2f45a6b5bea88d7ac18",
"index": 9371,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('bace/__init__.py') as fid:\n for line in fid:\n if line.startswith('__version__'):\n VERSION = line.strip().split()[-1][1:-1]\n break\nwith open... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
dependencies = [m... | flexible | {
"blob_id": "5791c1efa82a1e02ca067e1db776e9d466a111e2",
"index": 1765,
"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 = [migrations.sw... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class WBHandler(SearchPageWbUrlHandler):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def handle_query(self, wbrequest, cdx_lines, output):
return self.index_reader.make_cdx_response(wbrequest, cdx_lines, output
... | flexible | {
"blob_id": "df1486afcc99e03510512ed6ed3e8b3471459d50",
"index": 5343,
"step-1": "<mask token>\n\n\nclass WBHandler(SearchPageWbUrlHandler):\n <mask token>\n <mask token>\n <mask token>\n\n def handle_query(self, wbrequest, cdx_lines, output):\n return self.index_reader.make_cdx_response(wbreq... | [
10,
19,
21,
22,
25
] |
<|reserved_special_token_0|>
class MemcachedSessionInterface(SessionInterface):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def generate_sid(self):
return str(uuid4())
def get_memcache_expiration_time(self, app, session):
if session.permanent:
return app.per... | flexible | {
"blob_id": "e4761c925643417f4fe906e8dd2c9356ae970d52",
"index": 3706,
"step-1": "<mask token>\n\n\nclass MemcachedSessionInterface(SessionInterface):\n <mask token>\n <mask token>\n\n def generate_sid(self):\n return str(uuid4())\n\n def get_memcache_expiration_time(self, app, session):\n ... | [
8,
10,
12,
14,
15
] |
<|reserved_special_token_0|>
class TestApplication:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
... | flexible | {
"blob_id": "f4df7688ed927e1788ada0ef11f528eab5a52282",
"index": 4899,
"step-1": "<mask token>\n\n\nclass TestApplication:\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\n @pytest.mark.parametrize('string,applic... | [
4,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_db_connection():
try:
return connector.connect(host='server_database_1', user='root',
password='password1234', database='SMARTHOUSE')
except connector.errors.DatabaseError:
connection ... | flexible | {
"blob_id": "6cb97e6f3c7ba312ec1458fd51635508a16f70dd",
"index": 2957,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_db_connection():\n try:\n return connector.connect(host='server_database_1', user='root',\n password='password1234', database='SMARTHOUSE')\n except co... | [
0,
1,
2,
3
] |
import tensorflow as tf
class PolicyFullyConnected:
def __init__(self, observation_space, action_space, batch_size, reuse):
height = observation_space[0]
width = observation_space[1]
self.observations = tf.placeholder(shape=(batch_size, height, width), dtype=tf.float32)
with tf.va... | normal | {
"blob_id": "ecf09f2c503452fefc427e8dbe151e7bc7ef677e",
"index": 6139,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass PolicyFullyConnected:\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass PolicyFullyConnected:\n\n def __init__(self, observation_space, action_space, batch_size, reu... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AdminrequestsConfig(AppConfig):
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class AdminrequestsConfig(AppConfig):
name = 'adminRequests'
<|reserved_special_token_1|... | flexible | {
"blob_id": "e08b7a96c957895068e584a0564f02c52acd48ec",
"index": 3753,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass AdminrequestsConfig(AppConfig):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass AdminrequestsConfig(AppConfig):\n name = 'adminRequests'\n",
"step-4": "from djan... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
import scrapy
class QuoteesxtractorSpider(scrapy.Spider):
name = 'quoteEsxtractor'
allowed_domains = ['quotes.toscrape.com']
start_urls = ['http://quotes.toscrape.com/']
def parse(self, response):
for quote in response.css('.quote') :
# print(quote.getall()... | normal | {
"blob_id": "ce26ad27b7729164e27c845e2803a670b506bad8",
"index": 580,
"step-1": "<mask token>\n\n\nclass QuoteesxtractorSpider(scrapy.Spider):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass QuoteesxtractorSpider(scrapy.Spider):\n <mask token>\n... | [
1,
2,
3,
4,
5
] |
from django.shortcuts import render
from django.http import HttpResponse
# Create your views here.
def index(request):
#return HttpRequest("Hi This is SAU5081 page.")
return render(request, "sau5081/sau5081.html") | normal | {
"blob_id": "ac1ac80739bed0cebf7a89a7d55e1b4fa6c68cdf",
"index": 3428,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef index(request):\n return render(request, 'sau5081/sau5081.html')\n",
"step-3": "from django.shortcuts import render\nfrom django.http import HttpResponse\n\n\ndef index(reque... | [
0,
1,
2,
3
] |
# -*- coding: utf-8 -*-
import urllib
from pingpp import http_client, util
class WxpubOauth:
"""
用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid
WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能
详细内容可参考http://mp.weixin.qq.com/wiki/17/c0f37d5704f0b64713d5d2c37b468d75.html
"""
@staticmethod
def get_openid(a... | normal | {
"blob_id": "58058065ac78ffbf7550416b751e1440976c7898",
"index": 8467,
"step-1": "# -*- coding: utf-8 -*-\nimport urllib\n\nfrom pingpp import http_client, util\n\n\nclass WxpubOauth:\n \"\"\"\n 用于微信公众号OAuth2.0鉴权,用户授权后获取授权用户唯一标识openid\n WxpubOAuth中的方法都是可选的,开发者也可根据实际情况自行开发相关功能\n 详细内容可参考http://mp.weixi... | [
0
] |
import pytest
import mock
from awx.main.models import (
UnifiedJob,
WorkflowJob,
WorkflowJobNode,
Job
)
def test_unified_job_workflow_attributes():
with mock.patch('django.db.ConnectionRouter.db_for_write'):
job = UnifiedJob(id=1, name="job-1", launch_type="workflow")
job.unified_... | normal | {
"blob_id": "80a397b0974e41c4669f07638b5b38830b58cb37",
"index": 9051,
"step-1": "<mask token>\n\n\n@pytest.fixture\ndef unified_job(mocker):\n mocker.patch.object(UnifiedJob, 'can_cancel', return_value=True)\n j = UnifiedJob()\n j.status = 'pending'\n j.cancel_flag = None\n j.save = mocker.MagicM... | [
2,
4,
5,
6,
7
] |
import matplotlib
matplotlib.use('TkAgg')
import matplotlib.pyplot as plt
import numpy as np
import struct
import wave
scale = 0.01
wav = wave.open('output.wav', 'r')
print 'channels %d'%wav.getnchannels()
print 'smpl width %d'%wav.getsampwidth()
print 'frame rate %f'%wav.getframerate()
nframes = wav.getnframes()
pri... | normal | {
"blob_id": "c105f06e302740e9b7be100df905852bb5610a2c",
"index": 49,
"step-1": "import matplotlib\nmatplotlib.use('TkAgg')\nimport matplotlib.pyplot as plt\nimport numpy as np\nimport struct\nimport wave\n\nscale = 0.01\nwav = wave.open('output.wav', 'r')\n\nprint 'channels %d'%wav.getnchannels()\nprint 'smpl wi... | [
0
] |
list_1 = ['color','white','black']#taking the colors of t-shirts as input
list_2 = ['short','medium','large','xl']#taking sizes of t-shirts as input
for color in list_1:
for size in list_2:
#using cartesien product asking to give output as the combinations of color and size of t-shirts we ... | normal | {
"blob_id": "6cba431650ee8b74baa8310c144321b2e587155e",
"index": 2163,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor color in list_1:\n for size in list_2:\n print(color, size)\n<mask token>\nlist_3.reverse()\nprint(list_3)\n",
"step-3": "list_1 = ['color', 'white', 'black']\nlist_2 = ['... | [
0,
1,
2,
3
] |
import sys
sys.path.append('../')
import constants as cnst
import os
os.environ['PYTHONHASHSEED'] = '2'
import tqdm
from model.stg2_generator import StyledGenerator
import numpy as np
from my_utils.visualize_flame_overlay import OverLayViz
from my_utils.flm_dynamic_fit_overlay import camera_ringnetpp
from my_utils.gene... | normal | {
"blob_id": "d0991d8ea47379a0c1de836b5d215c99166ad049",
"index": 5936,
"step-1": "<mask token>\n\n\ndef ge_gen_in(flm_params, textured_rndr, norm_map, normal_map_cond,\n texture_cond):\n if normal_map_cond and texture_cond:\n return torch.cat((textured_rndr, norm_map), dim=1)\n elif normal_map_co... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def main():
authorizer = DummyAuthorizer()
authorizer.add_user('user', '12345', '.', perm='elradfmwMT')
authorizer.add_anonymous(os.getcwd())
handler = FTPHandler
handler.authorizer = authorizer
handler.b... | flexible | {
"blob_id": "a12fe733e607b1ce4cf0f3f4adc3ea85d082e769",
"index": 6615,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n authorizer = DummyAuthorizer()\n authorizer.add_user('user', '12345', '.', perm='elradfmwMT')\n authorizer.add_anonymous(os.getcwd())\n handler = FTPHandler\... | [
0,
1,
2,
3,
4
] |
import vigra
import os
import sys
import time
import json
from simpleference.inference.inference import run_inference_n5
# from simpleference.backends.pytorch import PyTorchPredict
from simpleference.backends.pytorch import InfernoPredict
from simpleference.backends.pytorch.preprocess import preprocess
def single_g... | normal | {
"blob_id": "5ca990bdcbe9378747e438015beb46760b1e987b",
"index": 7212,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef single_gpu_inference(sample, gpu):\n raw_path = (\n '/groups/saalfeld/home/papec/Work/neurodata_hdd/cremi_warped/sample%s_inference.n5'\n % sample)\n model_pa... | [
0,
1,
2,
3,
4
] |
import cv2
import torch
print('haha')
| normal | {
"blob_id": "00f8992173321dfa5ac5b125a2e663b159fafb23",
"index": 4267,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('haha')\n",
"step-3": "import cv2\nimport torch\nprint('haha')\n",
"step-4": null,
"step-5": null,
"step-ids": [
0,
1,
2
]
} | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.Migration):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class Migration(migrations.... | flexible | {
"blob_id": "f15ce7cec032ace65604771fa56e3d9969c98209",
"index": 1964,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass Migration(migrations.Migration):\n <mask token>\n <mask token>\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass Migration(migrations.Migration):\n initial = T... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class PipelineTest(unittest.TestCase):
<|reserved_special_token_0|>
class CustomTransform(PTransform):
def expand(self, pcoll):
return pcoll | '+1' >> FlatMap(lambda x: [x + 1])
class Visitor(PipelineVisitor):
def __init__(self, visited):
... | flexible | {
"blob_id": "edc7c74a19a272bdd6da81b3ce2d214a2b613984",
"index": 5835,
"step-1": "<mask token>\n\n\nclass PipelineTest(unittest.TestCase):\n <mask token>\n\n\n class CustomTransform(PTransform):\n\n def expand(self, pcoll):\n return pcoll | '+1' >> FlatMap(lambda x: [x + 1])\n\n\n clas... | [
37,
60,
63,
68,
85
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def employee_name(name):
getting_a_name = name.split()
name_staff = getting_a_name[-1]
name_staff = name_staff.capitalize()
return name_staff
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reser... | flexible | {
"blob_id": "4c4275b96d3eceb5ff89a746c68d7f8736a1c2a5",
"index": 8561,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef employee_name(name):\n getting_a_name = name.split()\n name_staff = getting_a_name[-1]\n name_staff = name_staff.capitalize()\n return name_staff\n\n\n<mask token>\n",... | [
0,
1,
2,
3
] |
import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
#led = 21
pins = [21, 25, 18]
# 0 1 2 3 4
names = ["First", "Second", "Third"]
for x in range(len(pins)):
GPIO.setup(pins[x], GPIO.IN, pull_up_down=GPIO.PUD_UP)
#GPIO.setup(led, GPIO.OUT)
while True:
input_state = 0
for i in ran... | normal | {
"blob_id": "d292de887c427e3a1b95d13cef17de1804f8f9ee",
"index": 6535,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nGPIO.setmode(GPIO.BCM)\n<mask token>\nfor x in range(len(pins)):\n GPIO.setup(pins[x], GPIO.IN, pull_up_down=GPIO.PUD_UP)\nwhile True:\n input_state = 0\n for i in range(len(pins... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while True:
ten = N // 10
one = N % 10
total = ten + one
new_N = one * 10 + total % 10
cycle += 1
N = new_N
if new_N == StopPoint:
break
print(cycle)
<|reserved_special_token_1|>
N = int(inpu... | flexible | {
"blob_id": "047b3b25cb064115a46cde1f1480ce55a1256bc1",
"index": 5827,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n ten = N // 10\n one = N % 10\n total = ten + one\n new_N = one * 10 + total % 10\n cycle += 1\n N = new_N\n if new_N == StopPoint:\n break\nprint... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('list len: ', len(testList))
print('切片(slice):', testList[1:])
print('追加一个元素')
testList.append("i'm new here!")
print('list len: ', len(testList))
print('last item :', testList[-1])
print('pop: ', testList.pop())
print('list... | flexible | {
"blob_id": "4f19eed272c12be137df92bfd3c72e978408c974",
"index": 3216,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('list len: ', len(testList))\nprint('切片(slice):', testList[1:])\nprint('追加一个元素')\ntestList.append(\"i'm new here!\")\nprint('list len: ', len(testList))\nprint('last item :', testLi... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def httpResponse(msg):
response = ['HTTP/1.1 200 ok', 'Server: py', 'Content-Type: text/plain',
'Content-Length: ' + str(len(msg)), '\r\n']
return '\r\n'.join(response).encode('utf8') + msg
<|reserved_special_token_0|>
def usage_uvloop():
try:
import uvloop... | flexible | {
"blob_id": "9320926c9eb8a03d36446f3692f11b242c4fc745",
"index": 8364,
"step-1": "<mask token>\n\n\ndef httpResponse(msg):\n response = ['HTTP/1.1 200 ok', 'Server: py', 'Content-Type: text/plain',\n 'Content-Length: ' + str(len(msg)), '\\r\\n']\n return '\\r\\n'.join(response).encode('utf8') + msg\... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
class FitSim(object):
<|reserved_special_token_0|>
def __init__(self, participant_choice_property='Actions',
participant_reward_property='Rewards', model_fitting_variable=
'ActionProb', task_stimuli_property=None, fit_subset=None,
action_options_property=N... | flexible | {
"blob_id": "1d5db3db319e67e050036e718bbe0c538365d229",
"index": 1976,
"step-1": "<mask token>\n\n\nclass FitSim(object):\n <mask token>\n\n def __init__(self, participant_choice_property='Actions',\n participant_reward_property='Rewards', model_fitting_variable=\n 'ActionProb', task_stimuli_... | [
12,
15,
16,
17,
19
] |
# Makes use of the scholar.py Google Scholar parser available here:
# https://github.com/ckreibich/scholar.py
# to run a list of citations collected from other sources (PubMed, PsychINFO, etc.) through
# Google Scholar to return a consistent format and saved as a .csv file.
# This can be imported into a spreadsheet for... | normal | {
"blob_id": "58eef45f8827df02c0aa0ac45eafa77f70f81679",
"index": 9276,
"step-1": "# Makes use of the scholar.py Google Scholar parser available here:\n# https://github.com/ckreibich/scholar.py\n# to run a list of citations collected from other sources (PubMed, PsychINFO, etc.) through\n# Google Scholar to return... | [
0
] |
def TriSelection(S):
""" Tri par sélection
Le tableau est constitué de deux parties : la 1ère constituée des éléments triés
(initialisée avec seulement le 1er élément) et la seconde constituée des éléments
non triés (initialisée du 2ème au dernier élément) """
for i in range(0, len(S)-1):
... | normal | {
"blob_id": "4c752c96b7e503ae5c9bc87a038fcf6dc176b776",
"index": 5830,
"step-1": "def TriSelection(S):\r\n \"\"\" Tri par sélection\r\n\r\n Le tableau est constitué de deux parties : la 1ère constituée des éléments triés\r\n (initialisée avec seulement le 1er élément) et la seconde constituée des éléme... | [
0
] |
i = 0
num = ''
while len(num) < 1e6:
i += 1
num += str(i)
prod = 1
for i in xrange(0, 7):
prod *= int(num[10 ** i - 1])
print prod
| normal | {
"blob_id": "f19056222be713c1556817d852af14d04483c9a3",
"index": 5931,
"step-1": "i = 0\nnum = ''\n\nwhile len(num) < 1e6:\n i += 1\n num += str(i)\n\nprod = 1\nfor i in xrange(0, 7):\n prod *= int(num[10 ** i - 1])\n\nprint prod\n",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null... | [
0
] |
M, N = map(int, input().split())
def is_prime(num):
if num <= 1:
return False
i = 2
while i * i <= num:
if num % i == 0:
return False
i += 1
return True
if __name__=="__main__":
for i in range(M, N+1):
if is_prime(i):
print(i)
| normal | {
"blob_id": "07fdf6605d970d2491116ad82a1119499b561d1f",
"index": 4144,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef is_prime(num):\n if num <= 1:\n return False\n i = 2\n while i * i <= num:\n if num % i == 0:\n return False\n i += 1\n return True\n\n... | [
0,
1,
2,
3,
4
] |
rf = open('A-large.in', 'r')
wf = open('A-large.out', 'w')
cases = int(rf.readline())
for case in range(1, cases + 1):
digits = [False] * 10
n = int(rf.readline())
if n == 0:
wf.write('Case #%s: INSOMNIA\n' % case)
continue
for i in range(1, 999999):
cur = n * i
for c in ... | normal | {
"blob_id": "0074b0cd1e4317e36ef4a41f8179464c2ec6c197",
"index": 8250,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor case in range(1, cases + 1):\n digits = [False] * 10\n n = int(rf.readline())\n if n == 0:\n wf.write('Case #%s: INSOMNIA\\n' % case)\n continue\n for i in r... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if src is None:
print('Image load failed')
sys.exit()
<|reserved_special_token_0|>
if lines is not None:
for i in range(lines.shape[0]):
pt1 = lines[i][0][0], lines[i][0][1]
pt2 = lines[i][0][2], lines[... | flexible | {
"blob_id": "ff7cb8261f3abb70599725fe7c598c571d037226",
"index": 9535,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif src is None:\n print('Image load failed')\n sys.exit()\n<mask token>\nif lines is not None:\n for i in range(lines.shape[0]):\n pt1 = lines[i][0][0], lines[i][0][1]\n ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('This program calculates whether the year is a leap year or not')
<|reserved_special_token_0|>
if year.isdecimal():
year = int(year)
if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:
print('{0} is a leap year'.format(year))
el... | flexible | {
"blob_id": "fdea48b6012b67327aea90e40eacbea5a1930d07",
"index": 9688,
"step-1": "<mask token>\n",
"step-2": "print('This program calculates whether the year is a leap year or not')\n<mask token>\nif year.isdecimal():\n year = int(year)\n if year % 4 == 0 and year % 100 != 0 or year % 400 == 0:\n ... | [
0,
1,
2,
3
] |
import boto3, os, shutil, datetime, time, sys
session = boto3.Session(profile_name='default')
s3 = boto3.resource('s3')
bucket = s3.Bucket('netball-ml-processed')
#print(bucket.objects)
#needs to be run with *** sudo **** otherwise it won't work...
while True:
#change to the motion working Directory
os.... | normal | {
"blob_id": "ec0697d8d78fafe6bfd4630be2a1fb20eb9eb4cf",
"index": 2472,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n os.chdir('/home/ec2-user/ML-Processed')\n print(str(os.getcwd()))\n for f in os.listdir(os.getcwd()):\n print('looping in file')\n file_name, file_ext... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for i in range(len(string)):
if string[i] in vowels:
Kevin += len(string) - i
else:
Stuart += len(string) - i
if Kevin > Stuart:
print('Kevin', Kevin)
elif Kevin < Stuart:
print('Stuart', Stuart)
el... | flexible | {
"blob_id": "c96ebfe41b778e85e954e2b7d6de4b078e72c81f",
"index": 7203,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(len(string)):\n if string[i] in vowels:\n Kevin += len(string) - i\n else:\n Stuart += len(string) - i\nif Kevin > Stuart:\n print('Kevin', Kevin)\ne... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for a, b in AB:
battery -= a - now_time
if battery <= 0:
ans = 'No'
break
battery += b - a
battery = min(battery, N)
now_time = b
battery -= T - now_time
if battery <= 0:
ans = 'No'
print(an... | flexible | {
"blob_id": "15a7f6a63536ed24b6cf17395643476c689ec99b",
"index": 8499,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor a, b in AB:\n battery -= a - now_time\n if battery <= 0:\n ans = 'No'\n break\n battery += b - a\n battery = min(battery, N)\n now_time = b\nbattery -= T ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class AffiliatedStoreManager(models.Manager):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
class AffiliatedStore(models.Model):
class Meta:
db_table = 'affiliated_store'
objects = AffiliatedStoreManager()
title ... | flexible | {
"blob_id": "e2b439974b66e45a899605bc7234850783c3dfb0",
"index": 2231,
"step-1": "<mask token>\n\n\nclass AffiliatedStoreManager(models.Manager):\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AffiliatedStore(models.Model):\n\n\n class Meta:\n db_table = 'affiliated_store'\n object... | [
5,
6,
7,
9,
10
] |
<|reserved_special_token_0|>
def create_app(config_object=DevConfig):
app = Flask(__name__.split('.')[0])
app.config.from_object(config_object)
app.config.from_envvar('DUFFY_SETTINGS', silent=True)
register_extensions(app)
register_blueprints(app)
register_errorhandlers(app)
return app
<... | flexible | {
"blob_id": "11101273a02abec17fc884d5c1d5d182eb82ee0c",
"index": 4625,
"step-1": "<mask token>\n\n\ndef create_app(config_object=DevConfig):\n app = Flask(__name__.split('.')[0])\n app.config.from_object(config_object)\n app.config.from_envvar('DUFFY_SETTINGS', silent=True)\n register_extensions(app)... | [
2,
3,
4,
5,
6
] |
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
def test_guest_should_see_button_add_to_basket(browser):
browser.get(lin... | normal | {
"blob_id": "464be943f4fe34dda826ebada9e128f1d7d671ac",
"index": 8485,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef test_guest_should_see_button_add_to_basket(browser):\n browser.get(link)\n btn_add = 'btn.btn-lg.btn-primary.btn-add-to-basket'\n found_button = WebDriverWait(browser, 5)... | [
0,
1,
2,
3,
4
] |
"""Tests for our `neo login` subcommand."""
import pytest
import os
from neo.libs import login
from neo.libs import utils
class TestAuth:
@pytest.mark.run(order=0)
def test_do_login(self, monkeypatch):
login.load_env_file()
username = os.environ.get('OS_USERNAME')
passwd = os.environ.g... | normal | {
"blob_id": "dfe7f0e25f340601886334c61a50806491a4ae2b",
"index": 8621,
"step-1": "<mask token>\n\n\nclass TestAuth:\n <mask token>\n <mask token>\n\n def test_env_file(self):\n assert login.check_env() == True\n\n def test_create_env_file(self):\n home = os.path.expanduser('~')\n ... | [
3,
4,
5,
6,
7
] |
# bot.py
import os
import shutil
import discord
import youtube_dl
from discord.ext import commands
import urllib.parse
import urllib.request
import re
import dotenv
from pathlib import Path # Python 3.6+ only
from dotenv import load_dotenv
env_path = Path('.') / '.env'
load_dotenv(dotenv_path=env_path)
client = disc... | normal | {
"blob_id": "94ca18088664393fdfdc68bfb8bcad8b78e9e36a",
"index": 7887,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nload_dotenv(dotenv_path=env_path)\n<mask token>\n\n\n@botCommand.event\nasync def on_ready():\n print(f'{client.user} is connected to the following guild:\\n')\n\n\n@botCommand.command... | [
0,
1,
2,
3,
4
] |
width,height = int(input("Width? ")), int(input("Height? "))
on_row = 0
while on_row <= height:
if on_row == 0 or on_row == height:
print("*"*width)
else:
stars = "*" + " "*(width-2) + "*"
print(stars)
on_row += 1
# height = 0
# width = 0
# while True:
# try:
# height... | normal | {
"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
] |
mapName =input('\nEnter map name(s) (omitting the mp_ prefix)\nSeparate map names with comma\n:').lower()
mapNameList =mapName.split(',')
def convertWPFile(mapName):
#Converts mapname_waypoints.gsc file (old style PEzBot format) to newer mapname.gsc file (new style Bot Warfare format)
fullMapName ='mp_'+m... | normal | {
"blob_id": "1aacd04234d60e495888fc44abe3fbacf404e0ce",
"index": 5799,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef convertWPFile(mapName):\n fullMapName = 'mp_' + mapName + '_waypoints.gsc'\n waypoints = open(fullMapName, 'r')\n wpLines = waypoints.readlines()\n waypoints.close()\n... | [
0,
1,
2,
3,
4
] |
"""
Test 1, problem 1.
Authors: David Mutchler, Dave Fisher, Valerie Galluzzi, Amanda Stouder,
their colleagues and Nathan Gupta. March 2016.
""" # DONE: 1. PUT YOUR NAME IN THE ABOVE LINE.
def main():
""" Calls the TEST functions in this module. """
test_problem1a()
test_problem1b()
t... | normal | {
"blob_id": "ca6a9656efe439c9e90f2724e38e652a09e46dae",
"index": 7686,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef is_palindrome(n):\n \"\"\"\n What comes in: An non-negative integer n.\n What goes out: Returns True if the given integer is a palindrome,\n that is, if it reads t... | [
0,
5,
9,
10,
11
] |
from django.urls import path
from redjit.post.views import MyPost, PostView
urlpatterns = [
path('newpost/', MyPost.as_view(), name='newpost')
path('subredjit/<subredjit>/<post_id>/', PostView.as_view(), name='post')
] | normal | {
"blob_id": "e0fc7e5771f6cb8e0638bc8c9549cfe1a92d3d82",
"index": 8719,
"step-1": "from django.urls import path\nfrom redjit.post.views import MyPost, PostView\n\n\n\nurlpatterns = [\n path('newpost/', MyPost.as_view(), name='newpost')\n path('subredjit/<subredjit>/<post_id>/', PostView.as_view(), name='pos... | [
0
] |
<|reserved_special_token_0|>
def get_neighbours(graph, v):
return [color for color, _ in graph[v]]
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def parse_rule(rule):
elem_regex = re.compile('(\\d+) (.*) bags?.*')
rule = rule[:-1]
color, inside = tuple(r... | flexible | {
"blob_id": "730aaa0404a0c776ce4d3a351f292f90768b6867",
"index": 7781,
"step-1": "<mask token>\n\n\ndef get_neighbours(graph, v):\n return [color for color, _ in graph[v]]\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_rule(rule):\n elem_regex = re.compile('(\\\\d+) (.*) bags?.*')\n rule... | [
1,
4,
5,
6,
7
] |
#%%
import numpy as np
import cv2
import matplotlib.pyplot as plt
import win32gui,win32ui,win32con,win32api
import pyautogui as pg
from PIL import ImageGrab
import time
import pandas as pd
# %%
def get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'):
handle_of_hearthstone=win32gui.FindWindow(... | normal | {
"blob_id": "e36d2426fb8a268ab9ff4f3d6135aa72697e6326",
"index": 1505,
"step-1": "<mask token>\n\n\ndef get_window(lpClassName='UnityWndClass', lpWindowName='炉石传说'):\n handle_of_hearthstone = win32gui.FindWindow(lpClassName, lpWindowName)\n return win32gui.GetClientRect(handle_of_hearthstone)\n\n\ndef coun... | [
5,
6,
7,
8,
9
] |
import torch
import torch.nn as nn
import torch.optim as optim
from torch.optim import lr_scheduler
import numpy as np
import torchvision
from torchvision import datasets, models, transforms
#import matplotlib.pyplot as plt
import time
import os
import copy
import torch.nn.functional as F
from PIL import Image, ExifTag... | normal | {
"blob_id": "d807a363c08d117c848ffdc0a768c696ea7746bd",
"index": 1787,
"step-1": "<mask token>\n\n\ndef train_model_snapshot(model, criterion, lr, dataloaders, dataset_sizes,\n device, num_cycles, num_epochs_per_cycle):\n since = time.time()\n best_model_wts = copy.deepcopy(model.state_dict())\n best... | [
2,
3,
4,
5,
6
] |
# Generated by Django 3.0.8 on 2020-07-12 19:05
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('CRUD', '0001_initial'),
]
operations = [
migrations.RenameField(
model_name='employee',
old_name='eAdddress',
ne... | normal | {
"blob_id": "b1d8a454e590dfa4afa257ca665376c320a4acb5",
"index": 5264,
"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 = [('CRUD', '000... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class BucketSort:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class BucketSort:
<|reserved_special_token_0|>
def result(self, bucketCount=10):
buckets = [[] for i in range(bucketCount + 1)... | flexible | {
"blob_id": "3b803850418638bf65528088044918e93ecabff6",
"index": 3085,
"step-1": "<mask token>\n",
"step-2": "class BucketSort:\n <mask token>\n <mask token>\n",
"step-3": "class BucketSort:\n <mask token>\n\n def result(self, bucketCount=10):\n buckets = [[] for i in range(bucketCount + 1... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class Group(models.Model):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __str__(self):
return self.name
<|reserved_special_token_0|>
<|reserved_... | flexible | {
"blob_id": "51563f52e700a286451663a6e837d56e104c2c72",
"index": 2849,
"step-1": "<mask token>\n\n\nclass Group(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __str__(self):\n return self.name\n <mask token>\n <mask token>\n\n\ncla... | [
5,
7,
8,
9,
11
] |
import unittest
from unittest.mock import patch
from redis import Redis
from rq.job import JobStatus
from rq.maintenance import clean_intermediate_queue
from rq.queue import Queue
from rq.utils import get_version
from rq.worker import Worker
from tests import RQTestCase
from tests.fixtures import say_hello
class Ma... | normal | {
"blob_id": "8dd864f1313f1e6f131ee11d4db99fbc46519126",
"index": 9826,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass MaintenanceTestCase(RQTestCase):\n <mask token>\n",
"step-3": "<mask token>\n\n\nclass MaintenanceTestCase(RQTestCase):\n\n @unittest.skipIf(get_version(Redis()) < (6, 2... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class WeixinSpider(Driver):
<|reserved_special_token_0|>
def get_article(self, data_list=[]):
article_list = (self.
until_presence_of_all_elements_located_by_css_selector(
css_selector=page_weixin_2.listcssselector.list_css_selector))
for i... | flexible | {
"blob_id": "1a7a28a2264ed0204184ab1dd273b0b114657fa7",
"index": 3004,
"step-1": "<mask token>\n\n\nclass WeixinSpider(Driver):\n <mask token>\n\n def get_article(self, data_list=[]):\n article_list = (self.\n until_presence_of_all_elements_located_by_css_selector(\n css_select... | [
3,
4,
5,
6,
7
] |
from typing import List
def sift_up(heap: List, pos: int = None):
if pos is None:
pos = len(heap) - 1
current, parent = pos, (pos - 1) // 2
while current > 0:
if heap[current] > heap[parent]:
heap[current], heap[parent] = heap[parent], heap[current]
else:
b... | normal | {
"blob_id": "9cc6700ab14bed9d69d90c1540f6d42186033a19",
"index": 5052,
"step-1": "<mask token>\n\n\ndef sift_up(heap: List, pos: int=None):\n if pos is None:\n pos = len(heap) - 1\n current, parent = pos, (pos - 1) // 2\n while current > 0:\n if heap[current] > heap[parent]:\n h... | [
4,
6,
7,
8,
9
] |
BLUE = "#1A94D6"
GREEN = "#73AD21"
PALE_GREEN = "#BBF864"
PALE_BLUE = "#A2C4DA"
BRIGHT_BLUE = "#04BAE3"
ORANGE = "#FF8000"
DARK_ORANGE = "#E65C00"
LIGHT_ORANGE = "#FFAA3E"
PALE_ORANGE = "#F8C381"
GUAVA = "#FF4F40"
FUSCIA = "#E22EFF"
PALE_FUSCIA = "#DFA0E9"
PURPLE = "#AE37C1"
PALE_PURPLE = "#C3AACF"
COLORS = [BLU... | normal | {
"blob_id": "6d8c32fe51fadbe6b6ee14419e1e37c65d4f57bf",
"index": 2508,
"step-1": "<mask token>\n",
"step-2": "BLUE = '#1A94D6'\nGREEN = '#73AD21'\nPALE_GREEN = '#BBF864'\nPALE_BLUE = '#A2C4DA'\nBRIGHT_BLUE = '#04BAE3'\nORANGE = '#FF8000'\nDARK_ORANGE = '#E65C00'\nLIGHT_ORANGE = '#FFAA3E'\nPALE_ORANGE = '#F8C38... | [
0,
1,
2
] |
import numpy as np
from matplotlib import pylab as plt
from os import listdir,path
from os.path import isfile,join,isdir
def get_files(directory_path):
dirpath=directory_path
files=[f for f in listdir(dirpath) if (isfile(join(dirpath, f)) and ".npy" in f)]
files=sorted(files)
n_files=len(files)
pr... | normal | {
"blob_id": "b240e328ee6c5677991d3166c7b00f1b3a51787e",
"index": 4765,
"step-1": "<mask token>\n\n\ndef get_files(directory_path):\n dirpath = directory_path\n files = [f for f in listdir(dirpath) if isfile(join(dirpath, f)) and \n '.npy' in f]\n files = sorted(files)\n n_files = len(files)\n ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Survey(models.Model):
name = models.CharField(max_length=200)
description = models.TextField()
category = models.ForeignKey(Category, blank=True, null=True, on_delete
=models.CASCADE)
users = models.ManyToManyField(User, through='SurveyToUser')
groups = m... | flexible | {
"blob_id": "33b6a4c76079ed698809b29772abb59a34831472",
"index": 5900,
"step-1": "<mask token>\n\n\nclass Survey(models.Model):\n name = models.CharField(max_length=200)\n description = models.TextField()\n category = models.ForeignKey(Category, blank=True, null=True, on_delete\n =models.CASCADE)... | [
16,
17,
18,
19,
22
] |
<|reserved_special_token_0|>
@six.add_metaclass(abc.ABCMeta)
class ParallelMigrationStrategy(base.BaseStrategy):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|r... | flexible | {
"blob_id": "43e721ac45570e4f9ab9c1970abee3da6db40afa",
"index": 156,
"step-1": "<mask token>\n\n\n@six.add_metaclass(abc.ABCMeta)\nclass ParallelMigrationStrategy(base.BaseStrategy):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n ... | [
11,
13,
16,
18,
19
] |
import os, json, locale, requests, dash, dash_table, copy, time, flask, base64
import dash_core_components as dcc
import dash_html_components as html
import plotly.graph_objects as go
import pandas as pd
from os import listdir
import plotly.figure_factory as ff
from concurrent.futures import ThreadPoolExecutor, Process... | normal | {
"blob_id": "c5f41b69ac215bd661ee39bdc8c3119db9606ca8",
"index": 6020,
"step-1": "<mask token>\n\n\n@app.callback(Output('ganttpersoon', 'figure'), [Input(\n 'dropdownganttpersoon', 'value'), Input('dropdownganttpersoonstatus',\n 'value')])\ndef update_ganttpersoon(v1, v2):\n ganttdata = []\n for i, ... | [
2,
8,
10,
11,
12
] |
"""
Project: tomsim simulator
Module: FunctionalUnit
Course: CS2410
Author: Cyrus Ramavarapu
Date: 19 November 2016
"""
# DEFINES
BUSY = 1
FREE = 0
class FunctionalUnit:
"""FunctionalUnit Class to encompass methods needed for
Integer, Divide, Multipler, Load, Store Functional
Units in tomsim
... | normal | {
"blob_id": "a2a94e87bb9af1ccaf516581d6662d776caf0b0d",
"index": 6284,
"step-1": "<mask token>\n\n\nclass FunctionalUnit:\n <mask token>\n <mask token>\n\n def __str__(self):\n return (\n \"\"\"\n Id: {}\n Instruction Count: {}\n Latency:... | [
7,
8,
11,
12,
13
] |
<|reserved_special_token_0|>
class TestSwitchMapIndex(unittest.TestCase):
def test_switch_map_indexed_uses_index(self):
scheduler = TestScheduler()
xs = scheduler.create_hot_observable(on_next(300, 'a'), on_next(400,
'b'), on_next(500, 'c'))
def create_inner(x: str, i: int):
... | flexible | {
"blob_id": "03dd37346ed12bbd66cbebc46fadc37be319b986",
"index": 548,
"step-1": "<mask token>\n\n\nclass TestSwitchMapIndex(unittest.TestCase):\n\n def test_switch_map_indexed_uses_index(self):\n scheduler = TestScheduler()\n xs = scheduler.create_hot_observable(on_next(300, 'a'), on_next(400,\n... | [
5,
7,
8,
9,
10
] |
# -*- coding: utf-8 -*-
"""
Created on Wed Apr 12 16:38:22 2017
@author: secoder
"""
import io
import random
import nltk
from nltk.tokenize import RegexpTokenizer
from sklearn.feature_extraction.text import CountVectorizer
from sklearn.feature_extraction.text import TfidfTransformer
from collections import Ordered... | normal | {
"blob_id": "4a8a733a965e25ad7ef53600fad6dd47343655b0",
"index": 8677,
"step-1": "<mask token>\n\n\nclass recommendationsys:\n\n def __init__(self, nyear):\n self.activityyear = 10\n self.debug = 0\n self.nremd = 3\n PROJECT_DIRECTORY = 'output/project/' + project_name\n sel... | [
21,
25,
35,
43,
47
] |
print('hello world123')
| normal | {
"blob_id": "004a02f7ff49cb1b63ebedfcfcb4937377859099",
"index": 1187,
"step-1": "<mask token>\n",
"step-2": "print('hello world123')\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
import math
import sys
from PIL import Image
import numpy as np
import torch
from torch.utils.data import Dataset
from sklearn.gaussian_process.kernels import RBF
from sklearn.gaussian_process import GaussianProcessRegressor
sys.path.append("..")
from skssl.utils.helpers import rescale_range
__all__ = ["SineDataset... | normal | {
"blob_id": "870de8888c00bbf9290bcc847e2a4fbb823cd4b7",
"index": 6305,
"step-1": "<mask token>\n\n\nclass GPDataset(Dataset):\n <mask token>\n <mask token>\n\n def __len__(self):\n return self.n_samples\n\n def __getitem__(self, index):\n self.counter += 1\n if self.counter == se... | [
10,
11,
13,
14,
17
] |
import numpy as np
import cv2
import glob
from scipy.spatial.transform import Rotation
import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
import mpl_toolkits.mplot3d.art3d as art3d
from matplotlib.patches import Rectangle
import celluloid
from celluloid import Camera # couldn't save animation ... | normal | {
"blob_id": "50ae47c88bbc0f281ef75784377fb65192e257b0",
"index": 1206,
"step-1": "<mask token>\n\n\nclass DLT(object):\n <mask token>\n\n def getimg(self, idx):\n images = sorted(glob.glob(datadir + 'images_undistorted/*.jpg'))\n return cv2.imread(images[idx])\n <mask token>\n\n def est... | [
4,
6,
7,
8,
10
] |
<|reserved_special_token_0|>
class spotify_data_parser(unittest.TestCase):
def test_open_file_and_return_formated_data_split_by_coma(self):
with patch('builtins.open', mock_open(read_data='split,by,')):
result = music_compare.spotify_data_parser().read_file('/test_path'
)
... | flexible | {
"blob_id": "eec08b3fdd4beb7d88ac0dc6d2e8776cf54fda35",
"index": 2727,
"step-1": "<mask token>\n\n\nclass spotify_data_parser(unittest.TestCase):\n\n def test_open_file_and_return_formated_data_split_by_coma(self):\n with patch('builtins.open', mock_open(read_data='split,by,')):\n result = m... | [
20,
23,
27,
28,
29
] |
import time
import os
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
from app.wechat_subscription.object_page.home_page import HomePage
from conf.decorator import teststep, teststeps
from conf.base_page import BasePage
from selenium.webdriver... | normal | {
"blob_id": "600b49c7884f8b6e3960549702a52deb20089f5a",
"index": 3503,
"step-1": "<mask token>\n\n\nclass LoginPage(BasePage):\n <mask token>\n\n @teststeps\n def __init__(self):\n self.home = HomePage()\n self.toast = Toast()\n <mask token>\n\n @teststeps\n def wait_check_test1(s... | [
17,
18,
20,
21,
22
] |
import random
s = {1: 1, 2: 2, 3: 3, 4: 4, 5: 5}
t = True
while t:
a = random.randint(1, 10)
if a not in s:
t = False
s[a] = a
print(s)
| normal | {
"blob_id": "b9b113bdc5d06b8a7235333d3b3315b98a450e51",
"index": 6562,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile t:\n a = random.randint(1, 10)\n if a not in s:\n t = False\n<mask token>\nprint(s)\n",
"step-3": "<mask token>\ns = {(1): 1, (2): 2, (3): 3, (4): 4, (5): 5}\nt = Tru... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def fig_porc_projects(plan):
df = pd.DataFrame(plan)
fig = px.timeline(df, x_start='Начало', x_end='Завершение', y='Проект',
color='РЦ', facet_row_spacing=0.2, facet_col_spacing=0.1, opacity=
0.5, hover_data=plan[0].keys(), title=f'Диаграмма проектов')
"""
... | flexible | {
"blob_id": "09850f0d3d295170545a6342337e97a0f190989a",
"index": 6578,
"step-1": "<mask token>\n\n\ndef fig_porc_projects(plan):\n df = pd.DataFrame(plan)\n fig = px.timeline(df, x_start='Начало', x_end='Завершение', y='Проект',\n color='РЦ', facet_row_spacing=0.2, facet_col_spacing=0.1, opacity=\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
def fetch_logs():
item_in_location_list = os.listdir(logs_location)
content_path_list = list(map(lambda log: logs_location + log,
item_in_location_list))
text_file_list = list(filter(lambda path: string_contained_in_all_logs in
path, content_path_list))
log... | flexible | {
"blob_id": "bc536440a8982d2d4a1bc5809c0d9bab5ac6553a",
"index": 2313,
"step-1": "<mask token>\n\n\ndef fetch_logs():\n item_in_location_list = os.listdir(logs_location)\n content_path_list = list(map(lambda log: logs_location + log,\n item_in_location_list))\n text_file_list = list(filter(lambda... | [
4,
6,
8,
9,
10
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def binarySearchR(array, target, leftPointer, rightPointer):
if leftPointer > rightPointer:
return -1
else:
midPointer = (leftPointer + rightPointer) // 2
if target == array[midPointer]:
... | flexible | {
"blob_id": "57d6b9e7f48d32e5d10bfd6a340ea56281f5d82d",
"index": 1890,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef binarySearchR(array, target, leftPointer, rightPointer):\n if leftPointer > rightPointer:\n return -1\n else:\n midPointer = (leftPointer + rightPointer) // 2\... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
class GcodeSender(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __init__(self, **kwargs):
super(GcodeSender, self).__init__(**kwargs)
self._stop = threading.Event()
self.parsing_thread = None
self.command_queue = Queue(... | flexible | {
"blob_id": "10d35ba3c04d9cd09e152c575e74b0382ff60572",
"index": 48,
"step-1": "<mask token>\n\n\nclass GcodeSender(object):\n <mask token>\n <mask token>\n\n def __init__(self, **kwargs):\n super(GcodeSender, self).__init__(**kwargs)\n self._stop = threading.Event()\n self.parsing_... | [
9,
14,
15,
16,
18
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def fun1(fun):
return 'Hai!!!! ' + fun
def message():
return 'How are you'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def fun1(fun):
return 'Hai!!!! ' + fun
def message():
return 'How are you'
<|reserved_special_token... | flexible | {
"blob_id": "e9fff1fb0a79493d4d7f3417c7d554eb10a978a0",
"index": 6616,
"step-1": "<mask token>\n",
"step-2": "def fun1(fun):\n return 'Hai!!!! ' + fun\n\n\ndef message():\n return 'How are you'\n\n\n<mask token>\n",
"step-3": "def fun1(fun):\n return 'Hai!!!! ' + fun\n\n\ndef message():\n return ... | [
0,
2,
3,
4,
5
] |
#! /usr/bin/env python
import os
import glob
import math
from array import array
import sys
import time
import subprocess
import ROOT
mass=[600,700,800,900,1000]
cprime=[01,02,03,05,07,10]
BRnew=[00,01,02,03,04,05]
for i in range(len(mass)):
for j in range(len(cprime)):
for k in range(len(BRnew)):
... | normal | {
"blob_id": "a9e5d4d48f96974da772f47a4c20ebc96bc31d85",
"index": 8740,
"step-1": "#! /usr/bin/env python\nimport os\nimport glob\nimport math\nfrom array import array\nimport sys\nimport time\nimport subprocess\nimport ROOT\n\nmass=[600,700,800,900,1000]\ncprime=[01,02,03,05,07,10]\nBRnew=[00,01,02,03,04,05]\n\n... | [
0
] |
class HashTable:
def __init__(self):
self.size = 11
self.slots = [None] * self.size
self.data = [None] * self.size
def put(self, key, data):
# there are three situations,
#1. the hashvalue returned by hashfunction of the slot is empty, just put the key in that slot, and the data in the datalist
hashvalu... | normal | {
"blob_id": "75741d11bebcd74b790efe7e5633d4507e65a25f",
"index": 6034,
"step-1": "class HashTable:\n <mask token>\n\n def put(self, key, data):\n hashvalue = self.hashfunction(key, len(self.slots))\n if self.slots[hashvalue] == None:\n self.slots[hashvalue] = key\n self.... | [
5,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
def ratings_to_matrix(ratings):
matrix_rows = USER_COUNT
matrix_cols = ITEM_COUNT
matrix = np.zeros([matrix_rows, matrix_cols])
for row, col, rating in ratings:
matrix[row, col] = rating
return matrix
def mask_validation(data, use_three_way):
masked_data ... | flexible | {
"blob_id": "af1eab58fd641b14ac054fa26e28d52c9741fb16",
"index": 7675,
"step-1": "<mask token>\n\n\ndef ratings_to_matrix(ratings):\n matrix_rows = USER_COUNT\n matrix_cols = ITEM_COUNT\n matrix = np.zeros([matrix_rows, matrix_cols])\n for row, col, rating in ratings:\n matrix[row, col] = rati... | [
16,
19,
21,
22,
24
] |
import numpy as np
import json
from netCDF4 import Dataset,stringtochar,chartostring,Variable,Group
def is_json(myjson):
try:
json_object = json.loads(myjson)
except:
return False
return True
def getType(type):
t=np.dtype(type).char
if t=="S":return 'S1'
if t=="U":return 'U1'
return t
def get... | normal | {
"blob_id": "57490e56833154d3ed3a18b5bf7bc4db32a50d69",
"index": 2979,
"step-1": "<mask token>\n\n\ndef prepareTransformAttributes(attributes):\n dtype = attributes.get('type')\n dtype = '{}'.format(dtype)\n min = attributes.get('min')\n max = attributes.get('max')\n ftype = attributes.get('ftype'... | [
6,
7,
11,
12,
13
] |
<|reserved_special_token_0|>
class SampleMemory(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def append(self, item):
self.memory[self.tail_index, :] = item
self.tail_index = (self.tail_index + 1) % self.max_size
self.num_store... | flexible | {
"blob_id": "89dfd9a32b008307eb4c456f2324804c29f3b68f",
"index": 6510,
"step-1": "<mask token>\n\n\nclass SampleMemory(object):\n <mask token>\n <mask token>\n <mask token>\n\n def append(self, item):\n self.memory[self.tail_index, :] = item\n self.tail_index = (self.tail_index + 1) % s... | [
3,
7,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('testfile.txt') as fp:
msg = EmailMessage()
msg.set_content('test')
<|reserved_special_token_0|>
s.send_message(msg)
s.quit()
<|reserved_special_token_1|>
<|reserved_special_token_0|>
with open('testfile.txt')... | flexible | {
"blob_id": "9feb24da78113310509664fa9efcf5f399be5335",
"index": 5914,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwith open('testfile.txt') as fp:\n msg = EmailMessage()\n msg.set_content('test')\n<mask token>\ns.send_message(msg)\ns.quit()\n",
"step-3": "<mask token>\nwith open('testfile.txt... | [
0,
1,
2,
3,
4
] |
# print all cards with even numbers.
cards = ["2", "3", "4", "5", "6", "7", "8", "9", "10", "J", "Q", "K", "A"]
for card in cards:
try:
number = int(card)
if number % 2 == 0: # modulo operator
print(card, "is an even card.")
except ValueError:
print (card, "can not be divi... | normal | {
"blob_id": "b5180a2dbe1f12e1bbc92874c67ea99c9a84a9ed",
"index": 19,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor card in cards:\n try:\n number = int(card)\n if number % 2 == 0:\n print(card, 'is an even card.')\n except ValueError:\n print(card, 'can not be d... | [
0,
1,
2,
3
] |
import numpy as np
import json
import random
from encapsulate_state import StateEncapsulator
from scalar_to_action import ActionMapper
import pickle
from basis_functions import identity_basis, interactive_basis, actions_only_basis, actions_cubic_basis, BASIS_MAP
import matplotlib.pyplot as plt
STATE_FILENAME = "stat... | normal | {
"blob_id": "e9a6baf10efc5b6bd07af1fe352b0b17ecc172bd",
"index": 1855,
"step-1": "<mask token>\n\n\nclass LinearBot(object):\n\n def __init__(self, player, player_name, weights_file, basis):\n self.reader = StateEncapsulator(player, player_name)\n with open(STATE_FILENAME, 'r') as f:\n ... | [
3,
5,
6,
7,
8
] |
<|reserved_special_token_0|>
class InsightSerializer(serializers.ModelSerializer):
id = serializers.StringRelatedField()
category = CategorySerializer()
class Meta:
model = models.Insight
fields = 'id', 'caption', 'category', 'source_url', 'created_at'
<|reserved_special_token_1|>
<|r... | flexible | {
"blob_id": "704047cb7eb05db9fa5f7ae61763ddbc8942ff60",
"index": 9614,
"step-1": "<mask token>\n\n\nclass InsightSerializer(serializers.ModelSerializer):\n id = serializers.StringRelatedField()\n category = CategorySerializer()\n\n\n class Meta:\n model = models.Insight\n fields = 'id', 'c... | [
2,
3,
4,
5,
6
] |
no_list = {"tor:", "getblocktemplate", " ping ", " pong "}
for i in range(1, 5):
with open("Desktop/"+str(i)+".log", "r") as r:
with open("Desktop/"+str(i)+"-clean.log", "a+") as w:
for line in r:
if not any(s in line for s in no_list):
w.write(line)
| normal | {
"blob_id": "f14a8d0d51f0baefe20b2699ffa82112dad9c38f",
"index": 6582,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor i in range(1, 5):\n with open('Desktop/' + str(i) + '.log', 'r') as r:\n with open('Desktop/' + str(i) + '-clean.log', 'a+') as w:\n for line in r:\n ... | [
0,
1,
2,
3
] |
from collections import OrderedDict
import re
from copy import copy
from datetime import datetime
import json
from bson import ObjectId
from bson.errors import InvalidId
from wtforms import Field
class StringField(Field):
def __init__(self, label=None, validators=None, empty_to_default=True,
st... | normal | {
"blob_id": "72b29764f584c7f824eaa63ab0fdb1839a8d9102",
"index": 8166,
"step-1": "<mask token>\n\n\nclass DateTimeField(Field):\n <mask token>\n\n def process_formdata(self, values):\n if values:\n value = values[0].strip()\n if value == '':\n self.data = self.de... | [
19,
21,
23,
30,
34
] |
"""
The Snail v 2
"Buy the dips! ... then wait"
STRATEGY
1. Selects coins that are X% (percent_below) below their X day (LIMIT) maximum
2. ** NEW ** Finds movement (MOVEMENT) range over X Days
- if MOVEMENT* > TAKE_PROFIT coins pass to 3
3. Check coins are not already owned
4. Uses MACD to check if coins are current... | normal | {
"blob_id": "77f94ecd205ae9f240f25d959a6d5cd9cf844d86",
"index": 844,
"step-1": "<mask token>\n\n\nclass TextColors:\n BUY = '\\x1b[92m'\n WARNING = '\\x1b[93m'\n SELL_LOSS = '\\x1b[91m'\n SELL_PROFIT = '\\x1b[32m'\n DIM = '\\x1b[2m\\x1b[35m'\n DEFAULT = '\\x1b[39m'\n YELLOW = '\\x1b[33m'\n ... | [
5,
7,
8,
9,
10
] |
<|reserved_special_token_0|>
class Playground:
<|reserved_special_token_0|>
def __init__(self, root, screen, mouse, keyboard):
self.root = root
self.screen = screen
self.mouse = mouse
self.keyboard = keyboard
self.cells = []
self.clickSwitch = False
sel... | flexible | {
"blob_id": "80d5cc9871ec753fb9239df7680ac62809baa496",
"index": 8177,
"step-1": "<mask token>\n\n\nclass Playground:\n <mask token>\n\n def __init__(self, root, screen, mouse, keyboard):\n self.root = root\n self.screen = screen\n self.mouse = mouse\n self.keyboard = keyboard\n... | [
12,
16,
17,
18,
19
] |
import pymysql
def main():
conn = pymysql.connect(host='127.0.0.1', port=3306,user='root',password='383240gyz',db='bycicle',charset='utf8')
print(conn)
try:
with conn.cursor() as cursor: # 上下文语法否则需要 # cursor.close()
cursor.execute('''drop table if exists pymysql''')
curs... | normal | {
"blob_id": "3135483c68880eeeaf7ebc085a6cd3c0c7f0550c",
"index": 1859,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef main():\n conn = pymysql.connect(host='127.0.0.1', port=3306, user='root',\n password='383240gyz', db='bycicle', charset='utf8')\n print(conn)\n try:\n with... | [
0,
1,
2,
3,
4
] |
from datetime import datetime
from logging import Logger
from pathlib import Path
from typing import Dict
import ignite
import ignite.distributed as idist
import torch
from omegaconf import OmegaConf
from config_schema import ConfigSchema
def log_metrics(
logger: Logger, epoch: int, elapsed: float, tag: str, me... | normal | {
"blob_id": "d8fb5aeb5453b986cc698165749992e4a7677257",
"index": 1506,
"step-1": "<mask token>\n\n\ndef prepare_output_directory(config: ConfigSchema) ->None:\n formatted = datetime.now().strftime(config.output_path_format)\n output_path = Path(formatted)\n output_path.mkdir(parents=True, exist_ok=False... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
while n > 0:
res += n % 10
n //= 10
print(res, n)
print(res)
<|reserved_special_token_1|>
n = eval(input('Entrez valeur: '))
res = 0
while n > 0:
res += n % 10
n //= 10
print(res, n)
print(res)
<|reser... | flexible | {
"blob_id": "391ecb2f23cc0ce59bd9fac6f97bd4c1788444b9",
"index": 4416,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile n > 0:\n res += n % 10\n n //= 10\n print(res, n)\nprint(res)\n",
"step-3": "n = eval(input('Entrez valeur: '))\nres = 0\nwhile n > 0:\n res += n % 10\n n //= 10\n ... | [
0,
1,
2,
3
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.