code stringlengths 13 6.09M | order_type stringclasses 2
values | original_example dict | step_ids listlengths 1 5 |
|---|---|---|---|
<|reserved_special_token_0|>
def run():
word = randomWord()
hiddenWord = ['-'] * len(word)
tries = 0
while True:
displayBoard(hiddenWord, tries)
currentLetter = str(raw_input('Escoge una letra: '))
letterIndexes = []
for i in range(len(word)):
if word[i] == ... | flexible | {
"blob_id": "074defa92c8bc5afc221c9c19842d808fbf1e112",
"index": 197,
"step-1": "<mask token>\n\n\ndef run():\n word = randomWord()\n hiddenWord = ['-'] * len(word)\n tries = 0\n while True:\n displayBoard(hiddenWord, tries)\n currentLetter = str(raw_input('Escoge una letra: '))\n ... | [
1,
4,
5,
6,
7
] |
a = range(10)
[x*x for x in a]
| normal | {
"blob_id": "018b9533074d2766dc5010ff9c5e70888d249b45",
"index": 1832,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n[(x * x) for x in a]\n",
"step-3": "a = range(10)\n[(x * x) for x in a]\n",
"step-4": "a = range(10)\n[x*x for x in a]\n",
"step-5": null,
"step-ids": [
0,
1,
2,
3... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def eval_cifar10(path_in, path_out, net, testloader, oodloader, use_cuda=
True, save_dir=None):
f1 = open(path_in, 'w')
f2 = open(path_out, 'w')
ece_criterion = ECELoss().cuda()
net.eval()
net.training = False
correct = 0
total = 0
logits_list = []
... | flexible | {
"blob_id": "edd2b7b453d7fa33e6cca3b5dbc895f034a9e22a",
"index": 2746,
"step-1": "<mask token>\n\n\ndef eval_cifar10(path_in, path_out, net, testloader, oodloader, use_cuda=\n True, save_dir=None):\n f1 = open(path_in, 'w')\n f2 = open(path_out, 'w')\n ece_criterion = ECELoss().cuda()\n net.eval()... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
"""
Noting is perfect, errors and timeouts may happen, and when such failures happen, the
consumer has to decide what to do with that. By default, the consumer would reject the
envelope (RabbitMQ message) when a failure happens. However, errors and timeouts
issues, unless there is a software bug... | normal | {
"blob_id": "848934680253ff2950db7723b1fe82b2ae799900",
"index": 801,
"step-1": "<mask token>\n\n\nclass LimitedRetriesPolicy(BaseRetryPolicy):\n <mask token>\n\n def __init__(self, consumer, retry_delays, retry_queue_suffix='retry',\n **kwargs):\n \"\"\"\n :param Consumer consumer: me... | [
9,
13,
15,
23,
27
] |
from typing import Any
from typing import List
from xsdata.codegen.mixins import RelativeHandlerInterface
from xsdata.codegen.models import Attr
from xsdata.codegen.models import Class
from xsdata.models.enums import Tag
from xsdata.utils.namespaces import build_qname
class ClassEnumerationHandler(RelativeHandlerInt... | normal | {
"blob_id": "4d9064add28302fe173a8b0a81ee7d187db8aead",
"index": 6029,
"step-1": "<mask token>\n\n\nclass ClassEnumerationHandler(RelativeHandlerInterface):\n <mask token>\n <mask token>\n\n def process(self, target: Class):\n \"\"\"\n Process class receiver.\n\n Steps:\n ... | [
6,
7,
9,
10,
11
] |
from django.db import models
#from ingredients.models import *
class Unit(models.Model):
short_name = models.CharField(max_length=20)
full_name = models.CharField(max_length=255, null=True)
weight_in_grams = models.FloatField(default=1.0)
def __str__(self):
return f"{self.short_name}" | normal | {
"blob_id": "fa880adcb9f009ffc206de59e8284ac6350fef4c",
"index": 5948,
"step-1": "<mask token>\n\n\nclass Unit(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "<mask token>\n\n\nclass Unit(models.Model):\n <mask token>\n <mask token>\n <mask token>\... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
def mark_object(event, x, y, flags, params):
global rect, startPoint, endPoint
if event == cv2.EVENT_LBUTTONDOWN:
if startPoint == True and endPoint == True:
startPoint = False
endPoint = False
rect = 0, 0, 0, 0
if startPoint == ... | flexible | {
"blob_id": "0f3e19b02dbe508bc4e0ef7879af81a9eabfd8c9",
"index": 6141,
"step-1": "<mask token>\n\n\ndef mark_object(event, x, y, flags, params):\n global rect, startPoint, endPoint\n if event == cv2.EVENT_LBUTTONDOWN:\n if startPoint == True and endPoint == True:\n startPoint = False\n ... | [
1,
2,
3,
4,
5
] |
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: MIT
"""
The main service module
MIT License
Copyright (c) 2017-2020, Leo Moll
"""
# -- Imports ------------------------------------------------
from resources.lib.service import MediathekViewService
# -- Main Code ----------------------------------------------
if... | normal | {
"blob_id": "e769e930ab8f0356116679bc38a09b83886eb8f6",
"index": 4003,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n SERVICE = MediathekViewService()\n SERVICE.init()\n SERVICE.run()\n SERVICE.exit()\n del SERVICE\n",
"step-3": "<mask token>\nfrom resources.... | [
0,
1,
2,
3
] |
"""
*** Three Number Sum ***
Write a function that takes in a non-empty array of distinct integers and an integer representing a target sum. The function
should find all triplets. The numbers in each triplet should be ordered in ascending order, and the triplets themeselves
should be ordered in ascending order with re... | normal | {
"blob_id": "240f5e9cbb38f319b6e03b1b7f9cae7655ac4385",
"index": 5258,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef threeNumberSum(array, targetSum):\n array.sort()\n triplet = []\n for i in range(len(array) - 2):\n left = i + 1\n right = len(array) - 1\n while lef... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def check_ip_or_mask(temp_str):
IPv4_regex = '(?:[0-9]{1,3}\\.){3}[0-9]{1,3}'
temp_list_ip_mask = re.findall(IPv4_regex, temp_str)
binary_temp_list_ip_mask = []
temp_binary_ip_mask = ''
for x in range(len(temp_list_ip_mask)):
split... | flexible | {
"blob_id": "fe597ad4462b1af3f3f99346c759c5fa8a7c14f4",
"index": 741,
"step-1": "<mask token>\n",
"step-2": "def check_ip_or_mask(temp_str):\n IPv4_regex = '(?:[0-9]{1,3}\\\\.){3}[0-9]{1,3}'\n temp_list_ip_mask = re.findall(IPv4_regex, temp_str)\n binary_temp_list_ip_mask = []\n temp_binary_ip_mask... | [
0,
1,
2
] |
config = {'numIndividuals': 50, 'maxNumGen': 20, 'eliteProp': 0.1,
'mutantProp': 0.2, 'inheritanceProb': 0.7}
| normal | {
"blob_id": "85d1069d85e285bc5c36811f569dabd793b5064b",
"index": 4460,
"step-1": "<mask token>\n",
"step-2": "config = {'numIndividuals': 50, 'maxNumGen': 20, 'eliteProp': 0.1,\n 'mutantProp': 0.2, 'inheritanceProb': 0.7}\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1... | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def minimumDeviation(self, nums: List[int]) ->int:
hq, left, right, res = [], inf, 0, inf
for num in nums:
if num % 2:
... | flexible | {
"blob_id": "975b2f3443e19f910c71f872484350aef9f09dd2",
"index": 7370,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def minimumDeviation(self, nums: List[int]) ->int:\n hq, left, right, res = [], inf, 0, inf\n for num in nums:\n ... | [
0,
1,
2
] |
def IsPn(a):
temp = (24*a+1)**0.5+1
if temp % 6 == 0:
return True
else:
return False
def IsHn(a):
temp = (8*a+1)**0.5+1
if temp % 4 == 0:
return True
else:
return False
def CalTn(a):
return (a**2+a)/2
i = 286
while 1:
temp = CalTn(i)
if IsHn(temp) and IsPn(temp):
break
i += 1
print i,temp | normal | {
"blob_id": "7474e60feff61c4ef15680ecc09d910e6e1d6322",
"index": 4603,
"step-1": "def IsPn(a):\n\ttemp = (24*a+1)**0.5+1\n\tif temp % 6 == 0:\n\t\treturn True\n\telse:\n\t\treturn False\n\ndef IsHn(a):\n\ttemp = (8*a+1)**0.5+1\n\tif temp % 4 == 0:\n\t\treturn True\n\telse:\n\t\treturn False\n\ndef CalTn(a):\n\tr... | [
0
] |
# Generated by Django 3.0.2 on 2020-02-18 05:52
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('myapp', '0003_admin'),
]
operations = [
migrations.DeleteModel(
name='admin',
),
migrations.RemoveField(
mod... | normal | {
"blob_id": "c0bf146ebfdb54cce80ef85c4c7f4a61632e67d4",
"index": 3371,
"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 = [('myapp', '00... | [
0,
1,
2,
3,
4
] |
#
# LeetCode
# ver.Python
#
# Created by GGlifer
#
# Open Source
"""
21. Merge Two Sorted Lists
"""
from typing import List
import sys
# Definition for singly-linked list.
class ListNode:
def __init__(self, val=0, next=None):
self.val = val
self.next = next
class Solution:
def mergeTwoList... | normal | {
"blob_id": "2730b2a1016f306936dcac3c3b44a3fd7194bac6",
"index": 7216,
"step-1": "<mask token>\n\n\nclass ListNode:\n\n def __init__(self, val=0, next=None):\n self.val = val\n self.next = next\n\n\nclass Solution:\n\n def mergeTwoLists(self, l1: ListNode, l2: ListNode) ->ListNode:\n r... | [
4,
6,
7,
8,
9
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def saveListToCSV(filepath, _list):
with open(filepath, 'ab') as f:
np.savetxt(f, [_list], delimiter=',', fmt='%f')
<|reserved_special_token_1|>
<|reserved_special_token_0|>
import numpy as np
def saveListToCSV(... | flexible | {
"blob_id": "555f4e41661ff4cbf4b9d72feab41ca8b7da2d5f",
"index": 750,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef saveListToCSV(filepath, _list):\n with open(filepath, 'ab') as f:\n np.savetxt(f, [_list], delimiter=',', fmt='%f')\n",
"step-3": "<mask token>\nimport numpy as np\n\n\... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
def calculate_vwap():
add_order_df = pd.read_csv('add_order_data.csv', index_col=None, names=
['Stock', 'Timestamp', 'Reference', 'Shares', 'Price'])
ord_exec_df = pd.read_csv('ord_exec_data.csv', index_col=None, names=[
'Reference', 'Shares'])
ord_exec_pr_df =... | flexible | {
"blob_id": "806124926008078e592141d80d08ccfbb3046dbf",
"index": 7092,
"step-1": "<mask token>\n\n\ndef calculate_vwap():\n add_order_df = pd.read_csv('add_order_data.csv', index_col=None, names=\n ['Stock', 'Timestamp', 'Reference', 'Shares', 'Price'])\n ord_exec_df = pd.read_csv('ord_exec_data.csv... | [
1,
2,
3,
4,
5
] |
# Generated by Django 3.0.3 on 2020-04-24 14:03
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('HMS', '0009_auto_20200329_0911'),
]
operations = [
migrations.CreateModel(
name='mess_timetable',
fields=[
... | normal | {
"blob_id": "e307bcc28526081141f1f2204c225d8e5f0100a8",
"index": 9015,
"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 = [('HMS', '0009... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def is_alive(cell):
starvation_threshold = conf.ENERGY_THRESHOLD
if cell.energy_level < starvation_threshold:
return False
else:
return True
<|reserved_special_token_0|>
def dna_copy_or_sub_slice(cell):
if dna_decoding.dna_should_sub_slice(cell.dna, len... | flexible | {
"blob_id": "de557c3c1455acc0a3facfca5729a010f3d123dc",
"index": 4208,
"step-1": "<mask token>\n\n\ndef is_alive(cell):\n starvation_threshold = conf.ENERGY_THRESHOLD\n if cell.energy_level < starvation_threshold:\n return False\n else:\n return True\n\n\n<mask token>\n\n\ndef dna_copy_or_... | [
2,
6,
7,
8,
9
] |
from unittest import TestCase
from ch4.array_to_btree import to_btree
from ch4.is_subtree import is_subtree
class IsSubtreeTest(TestCase):
def test_should_be_subtree(self):
container = to_btree([1, 2, 3, 4, 5, 6])
contained = to_btree([1, 3, 2])
self.assertTrue(is_subtree(container, conta... | normal | {
"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|>
<|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": "90b9dcd2dfc28446d1979d58ed49a12a85ce5b98",
"index": 7429,
"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
] |
from rest_framework.serializers import ModelSerializer
from rest_framework.serializers import ReadOnlyField
from rest_framework.serializers import SlugField
from rest_framework.validators import UniqueValidator
from django.db import models
from illumidesk.teams.util import get_next_unique_team_slug
from illumidesk.us... | normal | {
"blob_id": "c005ae9dc8b50e24d72dbc99329bb5585d617081",
"index": 5590,
"step-1": "<mask token>\n\n\nclass InvitationSerializer(ModelSerializer):\n <mask token>\n <mask token>\n\n\n class Meta:\n model = Invitation\n fields = 'id', 'team', 'email', 'role', 'invited_by', 'is_accepted'\n\n\nc... | [
4,
6,
8,
9,
10
] |
'''
Take list of iam users in a csv file like
S_NO, IAM_User_Name,Programatic_Access,Console_Access,PolicyARN
1,XYZ, Yes,No,arn:aws:iam::aws:policy/AdministratorAccess
2.pqr,Yes,Yes,arn:aws:iam::aws:policy/AdministratorAccess
3.abc,No,Yes,arn:aws:iam::aws:policy/AmazonAPIGatewayInvokeFullAccess
'''
import boto3,s... | normal | {
"blob_id": "00afab442f56d364c785324f816b52b4a6be609d",
"index": 3078,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile True:\n session = boto3.session.Session(profile_name='dev_root')\n iam_re = session.resource(service_name='iam')\n for each in range(701, 1100):\n try:\n ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
try:
from setuptools import setup, find_packages
except ImportError:
from distutils.core import setup, find_packages
setup(name='stripe-requests', version='1.9.1-dev', description=
'Stripe python bindings using request... | flexible | {
"blob_id": "a6ee2be7bed59b419fa66fd6cfe4b5fff3fac260",
"index": 2596,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ntry:\n from setuptools import setup, find_packages\nexcept ImportError:\n from distutils.core import setup, find_packages\nsetup(name='stripe-requests', version='1.9.1-dev', descrip... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if __name__ == '__main__':
orderapi.app.debug = True
orderapi.app.run(host='0.0.0.0', port=34203)
views.app.debug = True
views.app.run(host='0.0.0.0', port=42720)
<|reserved_special_token_1|>
<|reserved_special_... | flexible | {
"blob_id": "3218a9e82cd19bab1680079aee5f09a97992629e",
"index": 6038,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif __name__ == '__main__':\n orderapi.app.debug = True\n orderapi.app.run(host='0.0.0.0', port=34203)\n views.app.debug = True\n views.app.run(host='0.0.0.0', port=42720)\n",
... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
class PW(QWidget):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def ButtonNoAction(self):
table = 'patient_' + str(self.pid)
send_answer(self.question[self.index]['qid'], 'Нет', table)
if self.index < self.maxim - 1:
self.Pat =... | flexible | {
"blob_id": "f35569e2d8d26f43d4b2395b5088902c6cd3b826",
"index": 2232,
"step-1": "<mask token>\n\n\nclass PW(QWidget):\n <mask token>\n <mask token>\n\n def ButtonNoAction(self):\n table = 'patient_' + str(self.pid)\n send_answer(self.question[self.index]['qid'], 'Нет', table)\n if ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
def most_frequent_char(lst):
char_dict = {}
for word in lst:
for char in word:
if char in char_dict:
char_dict[char] += 1
else:
char_dict[char] = 1
max_value = max(char_dict.values())... | flexible | {
"blob_id": "be1ddaf5b4a7fb203fea62d061b06afb45d6867d",
"index": 4690,
"step-1": "<mask token>\n",
"step-2": "def most_frequent_char(lst):\n char_dict = {}\n for word in lst:\n for char in word:\n if char in char_dict:\n char_dict[char] += 1\n else:\n ... | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
data.drop(columns=drop, inplace=True)
<|reserved_special_token_0|>
model.fit(X_train, Y_train)
<|reserved_special_token_0|>
print('With Standar Scaler')
print(f'The R2 accuracy is: {r2(Y_test, pred_test)}')
print(f'The mean square... | flexible | {
"blob_id": "4a17db6b65e1615b0d519581b3e63bc34ad16093",
"index": 1288,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndata.drop(columns=drop, inplace=True)\n<mask token>\nmodel.fit(X_train, Y_train)\n<mask token>\nprint('With Standar Scaler')\nprint(f'The R2 accuracy is: {r2(Y_test, pred_test)}')\nprint(... | [
0,
1,
2,
3,
4
] |
import sys
from photo_dl.request import request
from photo_dl.request import MultiRequest
class Jav_ink:
def __init__(self):
self.parser_name = 'jav_ink'
self.domain = 'https://www.jav.ink'
self.album_flag = {}
@staticmethod
def category2albums(category_url):
category_url ... | normal | {
"blob_id": "9fff345dedcfc7051a258bc471acf07aece95bcf",
"index": 9319,
"step-1": "<mask token>\n\n\nclass Jav_ink:\n\n def __init__(self):\n self.parser_name = 'jav_ink'\n self.domain = 'https://www.jav.ink'\n self.album_flag = {}\n <mask token>\n\n def album2photos(self, album_url,... | [
3,
4,
5,
6,
7
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
ipshell = IPShellEmbed('Dropping to IPython shell')
filename = 'SPY-VXX-20090507-20100427.hdf5'
start_day = 1
end_day = 245
start_day = 120
end_day = 245
start_day = 1
end_day = 120
start_day = 120
end_day = 180
start_day = 0
end_... | flexible | {
"blob_id": "175e8ecdd0c9faa5fc981447f821763e0eb58b4d",
"index": 5609,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nipshell = IPShellEmbed('Dropping to IPython shell')\nfilename = 'SPY-VXX-20090507-20100427.hdf5'\nstart_day = 1\nend_day = 245\nstart_day = 120\nend_day = 245\nstart_day = 1\nend_day = 12... | [
0,
1,
2,
3
] |
from xml.dom import minidom
import simplejson as json
import re
camel_split = re.compile(r'(^[a-z]+|[A-Z][a-z]+|[a-z0-9]+)')
def get_items(xml):
for obj_node in xml.getElementsByTagName('item'):
obj = dict(obj_node.attributes.items())
if 'name' in obj:
obj['title'] = (' '.join(camel_sp... | normal | {
"blob_id": "69a3471ee8d2c317264b667d6ae0f9b500c6222f",
"index": 6497,
"step-1": "from xml.dom import minidom\nimport simplejson as json\nimport re\n\ncamel_split = re.compile(r'(^[a-z]+|[A-Z][a-z]+|[a-z0-9]+)')\n\ndef get_items(xml):\n for obj_node in xml.getElementsByTagName('item'):\n obj = dict(obj... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
if N >= M // 2:
print(M // 2)
else:
answer = N
M -= 2 * N
N = 0
print(answer + M // 4)
<|reserved_special_token_1|>
N, M = map(int, input().split())
if N >= M // 2:
print(M // 2)
else:
answer = N
... | flexible | {
"blob_id": "ba26aa2f33983019b515c5ea287bd5d5d190eeac",
"index": 7685,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif N >= M // 2:\n print(M // 2)\nelse:\n answer = N\n M -= 2 * N\n N = 0\n print(answer + M // 4)\n",
"step-3": "N, M = map(int, input().split())\nif N >= M // 2:\n pr... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class parameter:
opt = 0
xp = 0
yp = 0
zp = 0
xv = 0
yv = 0
zv = 0
p = 0
<|reserved_special_token_0|>
def help():
if len(sys.argv) == 2 and sys.argv[1] == '-h':
print('USAGE')
print(' ./104intersection opt xp yp zp xv yv zv p')
... | flexible | {
"blob_id": "d1af148bc6b27d38052f2e57f1c610c86eccebef",
"index": 7757,
"step-1": "<mask token>\n\n\nclass parameter:\n opt = 0\n xp = 0\n yp = 0\n zp = 0\n xv = 0\n yv = 0\n zv = 0\n p = 0\n\n\n<mask token>\n\n\ndef help():\n if len(sys.argv) == 2 and sys.argv[1] == '-h':\n prin... | [
5,
7,
8,
11,
12
] |
import pytest
import responses
from auctioneer import constants, controllers, entities
from common.http import UnExpectedResult
def test_keywordbid_rule_init(kwb_rule, account):
assert kwb_rule.get_max_bid_display() == kwb_rule.max_bid * 1_000_000
assert kwb_rule.get_bid_increase_percentage_display() == kwb_... | normal | {
"blob_id": "e0435b0b34fc011e7330ab8882865131f7f78882",
"index": 922,
"step-1": "<mask token>\n\n\ndef test_keywordbid_rule_init(kwb_rule, account):\n assert kwb_rule.get_max_bid_display() == kwb_rule.max_bid * 1000000\n assert kwb_rule.get_bid_increase_percentage_display(\n ) == kwb_rule.bid_increa... | [
3,
4,
6,
7,
8
] |
<|reserved_special_token_0|>
class stochasticGradient:
def __init__(self, kwargs):
self.inputVectors = kwargs['inputVectors']
self.expectedOutput = kwargs['expectedOutput']
self.noOfEpochs = kwargs['noOfEpochs']
self.activationFnsForAllLayers = kwargs['activationFnsForAllLayers']
... | flexible | {
"blob_id": "775900d4c059c89bfb10f5c3c2a924a41a049438",
"index": 8205,
"step-1": "<mask token>\n\n\nclass stochasticGradient:\n\n def __init__(self, kwargs):\n self.inputVectors = kwargs['inputVectors']\n self.expectedOutput = kwargs['expectedOutput']\n self.noOfEpochs = kwargs['noOfEpoch... | [
17,
18,
23,
26,
29
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
del get_versions
<|reserved_special_token_1|>
<|reserved_special_token_0|>
__version__ = get_versions()['version']
del get_versions
<|reserved_special_token_1|>
from .core import S3FileSystem, S3File
from .mapping import S3M... | flexible | {
"blob_id": "32e60c672d6e73600d442c4344743deccaed6796",
"index": 8819,
"step-1": "<mask token>\n",
"step-2": "<mask token>\ndel get_versions\n",
"step-3": "<mask token>\n__version__ = get_versions()['version']\ndel get_versions\n",
"step-4": "from .core import S3FileSystem, S3File\nfrom .mapping import S3M... | [
0,
1,
2,
3
] |
import os
import redis
import requests
import lxml.html
ads_api_url = "http://adslabs.org/adsabs/api/search/"
ads_html_url = "http://labs.adsabs.harvard.edu/adsabs/abs/"
rdb = redis.Redis()
def get_dev_key():
# Credit: Andy Casey
ads_dev_key_filename = os.path.abspath(
os.path.expanduser("~/.ads/dev... | normal | {
"blob_id": "9e314cdf4ef09ecf4a4b43358ae32f76c40aaea8",
"index": 8037,
"step-1": "<mask token>\n\n\ndef get_dev_key():\n ads_dev_key_filename = os.path.abspath(os.path.expanduser('~/.ads/dev_key')\n )\n if os.path.exists(ads_dev_key_filename):\n with open(ads_dev_key_filename, 'r') as fp:\n ... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
SQL_INSERCION_COCHE = (
'INSERT INTO tabla_coches(marca, modelo, color, motor, precio) VALUES (%s,%s,%s,%s,%s);'
)
SQL_LISTADO_COCHES = 'SELECT * FROM tabla_coches;'
<|reserved_special_token_1|>
SQL_INSERCION_COCHE = "INSERT INTO tabla_coches(marca... | flexible | {
"blob_id": "fd41e6d8530d24a8a564572af46078be77e8177f",
"index": 6573,
"step-1": "<mask token>\n",
"step-2": "SQL_INSERCION_COCHE = (\n 'INSERT INTO tabla_coches(marca, modelo, color, motor, precio) VALUES (%s,%s,%s,%s,%s);'\n )\nSQL_LISTADO_COCHES = 'SELECT * FROM tabla_coches;'\n",
"step-3": "SQL_INS... | [
0,
1,
2
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
for business, business_reviews in reviews.items():
for target_user in user_weights:
if target_user in business_reviews:
target_stars = business_reviews[target_user]['stars']
star_sum = 0
... | flexible | {
"blob_id": "be90447eb7c717ae0bae28fd7f10238be733648d",
"index": 3617,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nfor business, business_reviews in reviews.items():\n for target_user in user_weights:\n if target_user in business_reviews:\n target_stars = business_reviews[target_u... | [
0,
1,
2,
3,
4
] |
import pickle
from numpy import *
import math
import matplotlib.pyplot as plt
import numpy as np
from matplotlib import animation
from math import factorial
def savitzky_golay(y, window_size, order, deriv=0, rate=1):
order_range = range(order+1)
half_window = (window_size -1) // 2
b = np.mat([[k**i for i i... | normal | {
"blob_id": "8beafcd4f9c02657a828d8c37f2aecda325ba180",
"index": 9439,
"step-1": "<mask token>\n\n\ndef savitzky_golay(y, window_size, order, deriv=0, rate=1):\n order_range = range(order + 1)\n half_window = (window_size - 1) // 2\n b = np.mat([[(k ** i) for i in order_range] for k in range(-half_windo... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class Solution:
def minimumDeletions(self, nums: List[int]) ->int:
n = len(nums)
a = nums.index(min(nums))
b = nums.index(max(nums))
if a > b... | flexible | {
"blob_id": "14f3c941856ddf6bd7b3e046f21072f0b5f7b036",
"index": 5009,
"step-1": "<mask token>\n",
"step-2": "class Solution:\n <mask token>\n",
"step-3": "class Solution:\n\n def minimumDeletions(self, nums: List[int]) ->int:\n n = len(nums)\n a = nums.index(min(nums))\n b = nums.... | [
0,
1,
2
] |
<|reserved_special_token_0|>
class PBody(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def update(self, dT):
""" Updates our object:
1. Changes position due to current velocity.
2. (optional) Apply friction
... | flexible | {
"blob_id": "2238345a69c2d7a1958a23a470dcb2be6469caeb",
"index": 6643,
"step-1": "<mask token>\n\n\nclass PBody(object):\n <mask token>\n <mask token>\n <mask token>\n\n def update(self, dT):\n \"\"\" Updates our object:\n 1. Changes position due to current velocity.\n 2.... | [
8,
11,
12,
13,
16
] |
<|reserved_special_token_0|>
def show_examples(images_base, labels_base, index_list, output_path):
results = []
for index in tqdm(index_list):
img = cv2.imread(os.path.join(images_base, index + '.jpg'))
lab = np.array(Image.open(os.path.join(labels_base, index + '.png')
).convert('... | flexible | {
"blob_id": "b1b478965ad939a98478b19b4a94f3250167e25a",
"index": 2189,
"step-1": "<mask token>\n\n\ndef show_examples(images_base, labels_base, index_list, output_path):\n results = []\n for index in tqdm(index_list):\n img = cv2.imread(os.path.join(images_base, index + '.jpg'))\n lab = np.ar... | [
2,
3,
4,
5,
6
] |
import re
list = ["Protein XVZ [Human]","Protein ABC [Mouse]","go UDP[3] glucosamine N-acyltransferase [virus1]","Protein CDY [Chicken [type1]]","Protein BBC [type 2] [Bacteria] [cat] [mat]","gi p19-gag protein [2] [Human T-lymphotropic virus 2]"]
pattern = re.compile("\[(.*?)\]$")
for string in list:
match = re.se... | normal | {
"blob_id": "21c12aabfb21e84f3ea546842fb55c41d2129ff9",
"index": 6526,
"step-1": "import re\nlist = [\"Protein XVZ [Human]\",\"Protein ABC [Mouse]\",\"go UDP[3] glucosamine N-acyltransferase [virus1]\",\"Protein CDY [Chicken [type1]]\",\"Protein BBC [type 2] [Bacteria] [cat] [mat]\",\"gi p19-gag protein [2] [Hum... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
from django.shortcuts import render
from django.http import HttpResponse
<|reserved_special_token_1|>
from django.shortcuts import render
from django.http import HttpResponse
# # Create your views here.
# def Login_Form(request):
# return render... | flexible | {
"blob_id": "ee161ff66a6fc651a03f725427c3731bdf4243eb",
"index": 6906,
"step-1": "<mask token>\n",
"step-2": "from django.shortcuts import render\nfrom django.http import HttpResponse\n",
"step-3": "from django.shortcuts import render\r\nfrom django.http import HttpResponse\r\n\r\n\r\n\r\n# # Create your vie... | [
0,
1,
2
] |
def ex(x, y):
max = 0
print(x) if x > y else print(y)
return max
| normal | {
"blob_id": "4ffc00e9425992bdd8277341d67a0739119a4798",
"index": 2773,
"step-1": "<mask token>\n",
"step-2": "def ex(x, y):\n max = 0\n print(x) if x > y else print(y)\n return max\n",
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0,
1
]
} | [
0,
1
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def parse_rule(rules: dict, rule_str: str=None) ->Rule:
if rule_str is None:
rule_str: str = rules[0]
if '"' in rule_str:
return CharacterMatch(rule_str.strip('"'))
elif '|' in rule_str:
or_ru... | flexible | {
"blob_id": "4d4f7db6d5b4ed7eac3ced73aca76d3c952c84f4",
"index": 1456,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef parse_rule(rules: dict, rule_str: str=None) ->Rule:\n if rule_str is None:\n rule_str: str = rules[0]\n if '\"' in rule_str:\n return CharacterMatch(rule_str.s... | [
0,
1,
2,
3
] |
class thrs:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_1|>
class thrs:
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def getThrs(self, pos):
if pos - self.last_det < self.D0:
return self.n_ma... | flexible | {
"blob_id": "2cdee8799678e8ead21a0f81c42eb7ce209cfec7",
"index": 7289,
"step-1": "class thrs:\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "class thrs:\n <mask token>\n <mask token>\n\n def getThrs(self, pos):\n if pos - self.last_det < self.D0:\n return self.n... | [
1,
2,
3,
4,
5
] |
#
# Standard tests on the standard set of model outputs
#
import pybamm
import numpy as np
class StandardOutputTests(object):
"""Calls all the tests on the standard output variables."""
def __init__(self, model, parameter_values, disc, solution):
# Assign attributes
self.model = model
... | normal | {
"blob_id": "e81373c7b9c43b178f0f12382501be8899189660",
"index": 6700,
"step-1": "<mask token>\n\n\nclass PotentialTests(BaseOutputTest):\n\n def __init__(self, model, param, disc, solution, operating_condition):\n super().__init__(model, param, disc, solution, operating_condition)\n self.phi_s_... | [
19,
32,
43,
44,
55
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print('# ------------- Simple Variable ------------- #')
<|reserved_special_token_0|>
print(x)
<|reserved_special_token_0|>
print(y)
print(y.grad_fn)
<|reserved_special_token_0|>
print('z = y * y * 3\n', z, out)
print('# ---------... | flexible | {
"blob_id": "ba1648143d49110a163da02e60fb0fd024a10b79",
"index": 5140,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint('# ------------- Simple Variable ------------- #')\n<mask token>\nprint(x)\n<mask token>\nprint(y)\nprint(y.grad_fn)\n<mask token>\nprint('z = y * y * 3\\n', z, out)\nprint('# -----... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
@webhook_view('Freshping')
@has_request_variables
def api_freshping_webhook(request: HttpRequest, user_profile: UserProfile,
payload: Dict[str, Any]=REQ(argument_type='body')) ->HttpResponse:
body = get_body_for_http_request(payload)
subject = get_subject_for_http_request(payl... | flexible | {
"blob_id": "f60d02fb14364fb631d87fcf535b2cb5782e728f",
"index": 6539,
"step-1": "<mask token>\n\n\n@webhook_view('Freshping')\n@has_request_variables\ndef api_freshping_webhook(request: HttpRequest, user_profile: UserProfile,\n payload: Dict[str, Any]=REQ(argument_type='body')) ->HttpResponse:\n body = ge... | [
1,
3,
4,
5,
6
] |
#!/usr/bin/env python3
import asyncio
import bs4
import itertools
import logging
import sys
import os
import zipfile
from asyncio import TimeoutError
from aiohttp import ClientSession, ClientConnectionError
from aiohttp.client_exceptions import ContentTypeError, ServerDisconnectedError
from bs4 import BeautifulSoup
... | normal | {
"blob_id": "002f65fd77ce5043d1a0495ed13c15e3b4d2fb76",
"index": 7244,
"step-1": "<mask token>\n\n\ndef _split_journal_attrs(attrs):\n if attrs:\n return [t.text.replace(':', '').strip().split('\\n') for t in [k for\n k in attrs if isinstance(k, bs4.element.Tag)]]\n return []\n\n\ndef _ge... | [
6,
8,
9,
10,
11
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('Hello, Django girls!')
<|reserved_special_token_0|>
if volume < 20:
print("It's kinda quiet.")
elif 20 <= volume < 40:
print("It's nice for background music")
elif 40 <= volume < 60:
print('Perfect, I can hear all the details')
elif 60 <= v... | flexible | {
"blob_id": "00fd5efa4c66b7bd4617f4c886eddcdf38b951b7",
"index": 9507,
"step-1": "<mask token>\n",
"step-2": "print('Hello, Django girls!')\n<mask token>\nif volume < 20:\n print(\"It's kinda quiet.\")\nelif 20 <= volume < 40:\n print(\"It's nice for background music\")\nelif 40 <= volume < 60:\n prin... | [
0,
1,
2,
3
] |
import curses
from zeep import Client
from zeep import xsd
from zeep.plugins import HistoryPlugin
import time
from datetime import datetime
import os
LDB_TOKEN = 'NULLTOKEN'
WSDL = 'http://lite.realtime.nationalrail.co.uk/OpenLDBWS/wsdl.aspx?ver=2017-10-01'
if LDB_TOKEN == '':
raise Exception("Please configure y... | normal | {
"blob_id": "302634b93725ceb9333e236021cbb64e023ff798",
"index": 2135,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nif LDB_TOKEN == '':\n raise Exception(\n 'Please configure your OpenLDBWS token in getDepartureBoardExample!')\n<mask token>\n\n\ndef main(stdscr):\n res = client.service.Get... | [
0,
2,
3,
4,
5
] |
from turtle import Screen
import time
from snake import Snake
from snake_food import Food
from snake_score import Scoreboard
screen = Screen()
screen.setup(width=600,height=600)
screen.bgcolor("black")
screen.title("Snake Game")
screen.tracer(0)
snake = Snake()
food=Food()
score=Scoreboard()
screen.... | normal | {
"blob_id": "cfc0ca0d8528937526f6c42721870f1739a2ae95",
"index": 5467,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nscreen.setup(width=600, height=600)\nscreen.bgcolor('black')\nscreen.title('Snake Game')\nscreen.tracer(0)\n<mask token>\nscreen.listen()\nscreen.onkey(snake.up, 'Up')\nscreen.onkey(snake... | [
0,
1,
2,
3,
4
] |
import json
from faker import Faker
import random
fake = Faker()
from faker.providers import date_time
fake.add_provider(date_time)
class Hour(object):
def __init__(self):
self.dayOfTheWeek = fake.day_of_week()
self.openingTime = str(random.randint(1, 12)) + 'AM'
self.closingTime = str(ra... | normal | {
"blob_id": "e3386b01bb0bdc7064a2e3e9f3edce8a3231721b",
"index": 3664,
"step-1": "<mask token>\n\n\nclass Hour(object):\n\n def __init__(self):\n self.dayOfTheWeek = fake.day_of_week()\n self.openingTime = str(random.randint(1, 12)) + 'AM'\n self.closingTime = str(random.randint(1, 12)) +... | [
2,
3,
4,
5
] |
from django.db import models
# Login Admin Model
class AdminLoginModel(models.Model):
user_name = models.CharField(max_length=30,unique=True)
password = models.CharField(max_length=16)
# Swiggy Admin State Table
class AdminStateModel(models.Model):
state_id = models.AutoField(primary_key=True)
sta... | normal | {
"blob_id": "5d4ef314bb7169f5de4795e5c1aca62a1a060bae",
"index": 772,
"step-1": "<mask token>\n\n\nclass AdminCityTable(models.Model):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n\nclass AdminAreaModel(models.Model):\n area_id = models.AutoField(primary_key=True)\n area_name ... | [
7,
10,
14,
15,
16
] |
<|reserved_special_token_0|>
class UnknownImageOpener(ImageOpener):
@staticmethod
def open(filename):
print("You don't hame program for %s extension" % filename.split(
'.')[-1].upper())
class Image(object):
@classmethod
def open_file(cls, filename):
ext = filename.split... | flexible | {
"blob_id": "c199b2f87b7a4ac820001dab13f24fdd287a1575",
"index": 3507,
"step-1": "<mask token>\n\n\nclass UnknownImageOpener(ImageOpener):\n\n @staticmethod\n def open(filename):\n print(\"You don't hame program for %s extension\" % filename.split(\n '.')[-1].upper())\n\n\nclass Image(obj... | [
5,
6,
12,
13,
15
] |
# -*- coding: utf-8 -*-
'''
一球从100米高度自由落下
每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?
求两个东西, 1是经过了多少米, 2是反弹多高
1: 100 100+50+50 100+50+50+25+25
2: 100 100/2=50 50/2=25 25/2=2
'''
import math
start_height = 100
rebound_rate = 0.5
meter_list = [100]
def rebound(time):
m = start_height*(r... | normal | {
"blob_id": "f25d86e857970854b2239ce0ab5280132b89280e",
"index": 6900,
"step-1": "# -*- coding: utf-8 -*-\n'''\n 一球从100米高度自由落下\n 每次落地后反跳回原高度的一半;再落下,求它在第10次落地时,共经过多少米?第10次反弹多高?\n\n 求两个东西, 1是经过了多少米, 2是反弹多高\n 1: 100 100+50+50 100+50+50+25+25\n 2: 100 100/2=50 50/2=25 25/2=2\n'''\nimport math\n\n... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
print(df.head())
<|reserved_special_token_1|>
<|reserved_special_token_0|>
n1 = 'ADS'
api_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1
df = pd.read_csv(api_url)
df = df.head(100)
print(df.head())
<|reserved... | flexible | {
"blob_id": "3dd4b4d4241e588cf44230891f496bafb30c6153",
"index": 46,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nprint(df.head())\n",
"step-3": "<mask token>\nn1 = 'ADS'\napi_url = 'https://www.quandl.com/api/v3/datasets/WIKI/%s.csv' % n1\ndf = pd.read_csv(api_url)\ndf = df.head(100)\nprint(df.head(... | [
0,
1,
2,
3,
4
] |
import os
import torch
from collections import OrderedDict
from PIL import Image
import numpy as np
from matplotlib import pyplot as plt
from matplotlib import image as mplimg
from torch.nn.functional import upsample
import networks.deeplab_resnet as resnet
from mypath import Path
from dataloaders import helpers as h... | normal | {
"blob_id": "2c8b8e9767ac8400fb6390e0851d9df10df7cd8c",
"index": 8729,
"step-1": "<mask token>\n\n\ndef maskRCNN_model():\n config_file = (\n '/home/raj/data/Raj/IndividualProject/maskRCNN/configs/caffe2/e2e_mask_rcnn_R_50_FPN_1x_caffe2.yaml'\n )\n cfg.merge_from_file(config_file)\n cfg.me... | [
4,
5,
6,
7,
8
] |
import torch
from torch.nn import functional as F
from sklearn.metrics import f1_score, accuracy_score
@torch.no_grad()
def validate(data, model):
model.evaluate()
out = model(data.x, data.train_index)
return model.loss(out[data.val_mask == 1], data.y[data.val_mask == 1])
@torch.no_grad()
def validate_... | normal | {
"blob_id": "83c109bc5aab6739a3a32116fae4f0c011d6118e",
"index": 4136,
"step-1": "<mask token>\n\n\n@torch.no_grad()\ndef validate(data, model):\n model.evaluate()\n out = model(data.x, data.train_index)\n return model.loss(out[data.val_mask == 1], data.y[data.val_mask == 1])\n\n\n@torch.no_grad()\ndef ... | [
3,
4,
5,
6,
7
] |
from functools import wraps
import os
def restoring_chdir(fn):
#XXX:dc: This would be better off in a neutral module
@wraps(fn)
def decorator(*args, **kw):
try:
path = os.getcwd()
return fn(*args, **kw)
finally:
os.chdir(path)
return decorator
clas... | normal | {
"blob_id": "3fbf1768a2fe78df591c49490dfce5fb374e7fc2",
"index": 4,
"step-1": "from functools import wraps\nimport os\n\n\ndef restoring_chdir(fn):\n #XXX:dc: This would be better off in a neutral module\n @wraps(fn)\n def decorator(*args, **kw):\n try:\n path = os.getcwd()\n ... | [
0
] |
<|reserved_special_token_0|>
class Whouse:
<|reserved_special_token_0|>
def get_tech_to_whouse(self, equip: Equipment):
if self.total == self.max_volume:
raise OverflowError('Склад заполнен!')
self.storage[self.add_mapper[type(equip)]].add(equip)
print(type(equip))
... | flexible | {
"blob_id": "03bc377bef1de7d512b7982a09c255af1d82fb7d",
"index": 3905,
"step-1": "<mask token>\n\n\nclass Whouse:\n <mask token>\n\n def get_tech_to_whouse(self, equip: Equipment):\n if self.total == self.max_volume:\n raise OverflowError('Склад заполнен!')\n self.storage[self.add_... | [
9,
11,
12,
16,
17
] |
/Users/apple/miniconda3/lib/python3.7/sre_constants.py | normal | {
"blob_id": "71a5ba520f8bc42e80d8f4ce8cf332bdd5fb96de",
"index": 5293,
"step-1": "/Users/apple/miniconda3/lib/python3.7/sre_constants.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
# Run 'python setup.py build' on cmd
import sys
from cx_Freeze import setup, Executable
import os.path
PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__))
os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6')
os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 't... | normal | {
"blob_id": "f317d67b98eab1f0f192fa41f9bcc32b0c1e8eb0",
"index": 8301,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nsetup(name='Arkanoid', version='1.0', description='Python Game', options=\n options, executables=executables)\n",
"step-3": "<mask token>\nPYTHON_INSTALL_DIR = os.path.dirname(os.pat... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
async def main(host: str, endpoint: str, message: str):
msg = msgpack.packb({'endpoint': endpoint, 'headers': {'Content-Type':
'text/json'}, 'payload': message.encode('utf-8')})
redis = await aioredis.create_redi... | flexible | {
"blob_id": "e94d66732a172286814bc0b0051a52c1374a4de5",
"index": 3168,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nasync def main(host: str, endpoint: str, message: str):\n msg = msgpack.packb({'endpoint': endpoint, 'headers': {'Content-Type':\n 'text/json'}, 'payload': message.encode('u... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class StaffApp(CMSApp):
name = _('Staff')
urls = ['blog.urls']
app_name = 'staff'
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
class StaffApp(CMSApp):
name = _('St... | flexible | {
"blob_id": "40ee790f4272c05c1619eb7b2cc66a8b57bbe8a8",
"index": 5988,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name = _('Staff')\n urls = ['blog.urls']\n app_name = 'staff'\n\n\n<mask token>\n",
"step-3": "<mask token>\n\n\nclass StaffApp(CMSApp):\n name... | [
0,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Local(object):
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
<|reserved_special_token_0|>
def __delattr__(self, item):
self.__lock__.acquire()
try:
try:
... | flexible | {
"blob_id": "f55b286448f114f3823f099a576af7bec1780a8c",
"index": 461,
"step-1": "<mask token>\n\n\nclass Local(object):\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n <mask token>\n\n def __delattr__(self, item):\n self.__lock__.acquire()\n try:\n try:\n ... | [
8,
11,
12,
15,
16
] |
#!/usr/bin/env python
# -*-coding:utf-8-*-
# Author:SemaseMing <blog.v-api.cn>
# Email: admin@v-api.cn
# Time: 2016-10-19 11:56
import gevent
def foo():
print('Running in foo')
gevent.sleep(0)
print('Explicit context switch to foo ageni')
def bar():
print('Explicit context to bar')
gevent.sleep... | normal | {
"blob_id": "7f131e17f4fbd7d6b333a51dae557ddb07c30046",
"index": 9077,
"step-1": "<mask token>\n\n\ndef bar():\n print('Explicit context to bar')\n gevent.sleep(0)\n print('Implicit contenxt switch back to bar')\n\n\n<mask token>\n",
"step-2": "<mask token>\n\n\ndef foo():\n print('Running in foo')... | [
1,
2,
3,
4,
5
] |
import pandas as pd
def ranked(country, variety, price, num):
data = pd.read_csv("wine_final.csv")
if num == 0:
return None
if country !='':
data = data.query("country==\"{}\"".format(country))
if variety !='':
data = data.query("variety==\"{}\"".format(variety))
if pric... | normal | {
"blob_id": "d983cb4ae79d8370ed0809b86762c1e2ea125320",
"index": 6614,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef ranked(country, variety, price, num):\n data = pd.read_csv('wine_final.csv')\n if num == 0:\n return None\n if country != '':\n data = data.query('country==... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print('this is something new')
for a in range(10):
print(sum(a))
print('the loop worked')
<|reserved_special_token_1|>
#This is just a test
print("this is something new")
for a in range(10):
print(sum(a))
print("the loop worked")
| flexible | {
"blob_id": "df317e914073f5b236f73b616b87f86ae378ef38",
"index": 8755,
"step-1": "<mask token>\n",
"step-2": "print('this is something new')\nfor a in range(10):\n print(sum(a))\nprint('the loop worked')\n",
"step-3": "#This is just a test\nprint(\"this is something new\")\nfor a in range(10):\n print(su... | [
0,
1,
2
] |
"""A twitter bot that retweets positive tweets from cool lists."""
import sys
import os
from random import choice
from random import shuffle
import twitter
import unirest
twitter = twitter.Api(
consumer_key=os.environ['TWITTER_CONSUMER_KEY'],
consumer_secret=os.environ['TWITTER_CONSUMER_SECRET'],
access_... | normal | {
"blob_id": "9dddae5e85bda67bdbb6f0336a29949cb1f4d59e",
"index": 3798,
"step-1": "\"\"\"A twitter bot that retweets positive tweets from cool lists.\"\"\"\n\nimport sys\nimport os\nfrom random import choice\nfrom random import shuffle\nimport twitter\nimport unirest\n\n\ntwitter = twitter.Api(\n consumer_key=... | [
0
] |
from random import randint
#given a list of names, cities and neigborhoods, generate a client table.
#------------------------MODEL------------------------------
#([cliente_id], [nome], [sexo], [telefone], [cpf], [cidade_nome], [cidade_bairro_nome], [cidade_bairro_cep])
class Employee:
def __init__(self, id, name ,s... | normal | {
"blob_id": "a9ce341ffe26ab6c476237030e23e6ae57b8fa33",
"index": 7560,
"step-1": "from random import randint\n\n#given a list of names, cities and neigborhoods, generate a client table.\n\n#------------------------MODEL------------------------------\n#([cliente_id], [nome], [sexo], [telefone], [cpf], [cidade_nom... | [
0
] |
import random
import pygame
pygame.init()
# 큐브의 크기
cubeSize = 2
# GUI 관련 변수
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
YELLOW = (255, 204, 0)
ORANGE = (255, 102, 0)
WHITE = (255, 255, 255)
GREY = (128, 128, 128)
pieceSize = 50
gridSize = pieceSize * cubeSize
screen = pygame.display.se... | normal | {
"blob_id": "1d8e48aab59869831defcccdd8902230b0f3daa7",
"index": 5368,
"step-1": "<mask token>\n\n\nclass Cube:\n <mask token>\n\n def sortPieces(self):\n self.pieces.sort(key=lambda x: x.location[2] * cubeSize * cubeSize +\n x.location[1] * cubeSize + x.location[0])\n <mask token>\n\n... | [
19,
23,
24,
26,
29
] |
/usr/share/pyshared/screenlets/plugins/SizeConverter.py | normal | {
"blob_id": "58ddf496245741498177a67b7ce692b97bbd476a",
"index": 9887,
"step-1": "/usr/share/pyshared/screenlets/plugins/SizeConverter.py",
"step-2": null,
"step-3": null,
"step-4": null,
"step-5": null,
"step-ids": [
0
]
} | [
0
] |
<|reserved_special_token_0|>
class ConcatOffsetNet(nn.Cell):
def __init__(self, axis):
super(ConcatOffsetNet, self).__init__()
self.op = G.ConcatOffset(2, axis)
def construct(self, x0, x1):
return self.op((x0, x1))
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|rese... | flexible | {
"blob_id": "2064fe029bc7db14505a5b38750e324b55556abb",
"index": 7032,
"step-1": "<mask token>\n\n\nclass ConcatOffsetNet(nn.Cell):\n\n def __init__(self, axis):\n super(ConcatOffsetNet, self).__init__()\n self.op = G.ConcatOffset(2, axis)\n\n def construct(self, x0, x1):\n return self... | [
3,
4,
5,
6,
7
] |
# -*- coding: utf-8 -*-
#借鉴的扫码单文件
import qrcode
from fake_useragent import UserAgent
from threading import Thread
import time, base64
import requests
from io import BytesIO
import http.cookiejar as cookielib
from PIL import Image
import os
requests.packages.urllib3.disable_warnings()
ua = UserAgent(pa... | normal | {
"blob_id": "c268c61e47698d07b7c1461970dc47242af55777",
"index": 1637,
"step-1": "<mask token>\n\n\nclass showpng(Thread):\n\n def __init__(self, data):\n Thread.__init__(self)\n self.data = data\n\n def run(self):\n img = Image.open(BytesIO(self.data))\n img.show()\n\n\ndef isl... | [
4,
5,
7,
8,
9
] |
from connect_to_elasticsearch import *
# returns the name of all indices in the elasticsearch server
def getAllIndiciesNames():
indicies = set()
for index in connect_to_elasticsearch().indices.get_alias( "*" ):
indicies.add( index )
print( index )
return indicies
| normal | {
"blob_id": "23c75840efd9a8fd68ac22d004bfe3b390fbe612",
"index": 2314,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef getAllIndiciesNames():\n indicies = set()\n for index in connect_to_elasticsearch().indices.get_alias('*'):\n indicies.add(index)\n print(index)\n return in... | [
0,
1,
2,
3
] |
#!/usr/local/bin/python
i = 0
while i == 0:
try:
print("Let's divide some numbers!")
a1 = input("Enter numerator: ")
b1 = input("Enter denominator: ")
a = int(a1)
b = int(b1)
print(a1 + " divied by " + b1 + " equals: " + str(a/b))
i += 1
except... | normal | {
"blob_id": "dcc1b0decf2fca6309dbb60faebd3f0a6944cd7d",
"index": 9130,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nwhile i == 0:\n try:\n print(\"Let's divide some numbers!\")\n a1 = input('Enter numerator: ')\n b1 = input('Enter denominator: ')\n a = int(a1)\n b ... | [
0,
1,
2,
3
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
print(1)
print(2)
print('Jenkins')
print('Jenkins2')
print('Jenkins3')
print('Jenkins44')
print('Jenkins55khlk')
print('3333333')
print('44444444')
print('jhjhj')
<|reserved_special_token_1|>
print(1)
print(2)
print("Jenkins")
print("Jenkins2")
print("Jenk... | flexible | {
"blob_id": "77a82f99ab10e3d53e3f8466d43b67e8b87c1588",
"index": 2418,
"step-1": "<mask token>\n",
"step-2": "print(1)\nprint(2)\nprint('Jenkins')\nprint('Jenkins2')\nprint('Jenkins3')\nprint('Jenkins44')\nprint('Jenkins55khlk')\nprint('3333333')\nprint('44444444')\nprint('jhjhj')\n",
"step-3": "print(1)\npr... | [
0,
1,
2
] |
from core.models import AnalyticsCacheSearchKeywordDay
from datetime import datetime, timedelta
def get_month():
return ["2017-10","2017-11","2017-12","2018-1","2018-2","2018-3","2018-4","2018-5","2018-6","2018-7","2018-8","2018-9","2018-10","2018-11", "2018-12"]
def run():
day = datetime.strptime("2017-1... | normal | {
"blob_id": "b048319a2ed182e70aa7f8a736ff02953577ec39",
"index": 2008,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run():\n day = datetime.strptime('2017-10', '%Y-%m')\n next_day = datetime.strptime('2017-11', '%Y-%m')\n last_day = datetime.strptime('2018-11', '%Y-%m')\n monthes = ... | [
0,
1,
2,
3,
4
] |
<|reserved_special_token_0|>
def bisection(st, maxnum, maxer, xlf, xuf):
file2 = open('test.txt', 'w')
file2.write('Hello World')
file2.close()
fi = open('test.txt', 'w')
x = sp.Symbol('x')
y = sp.Symbol('y')
H = sympify(st)
print(H)
table = []
x1 = []
y1 = []
xu = []
... | flexible | {
"blob_id": "a1c1f18e7b95f36a214a1a16f2434be2825829c3",
"index": 3110,
"step-1": "<mask token>\n\n\ndef bisection(st, maxnum, maxer, xlf, xuf):\n file2 = open('test.txt', 'w')\n file2.write('Hello World')\n file2.close()\n fi = open('test.txt', 'w')\n x = sp.Symbol('x')\n y = sp.Symbol('y')\n ... | [
1,
2,
3,
4,
5
] |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import numpy as np
class ZoomPanHandler:
"""
Matplotlib callback class to handle pan and zoom events.
"""
def __init__(self, axes, scale_factor=2, mouse_button=2):
"""
Default constructor for the ZoomPanHandler class.
Parameters... | normal | {
"blob_id": "6afcb8f17f7436f0ae9fa3a8c2a195245a9801f1",
"index": 6533,
"step-1": "<mask token>\n\n\nclass ZoomPanHandler:\n <mask token>\n\n def __init__(self, axes, scale_factor=2, mouse_button=2):\n \"\"\"\n Default constructor for the ZoomPanHandler class.\n\n Parameters\n ax... | [
13,
14,
15,
16,
19
] |
import sys
lines = sys.stdin.readlines()
t = int(lines[0])
for i in range(t):
c = i*10+1
n = int(lines[c]) - 1
first = [x.strip() for x in [
lines[c+1],
lines[c+2],
lines[c+3],
lines[c+4]]]
first = [s.split() for s in first]
m = int(lines[c+5]) - 1
second = [x.... | normal | {
"blob_id": "d6bc8afcdb7636085b01add860f808024fbe566d",
"index": 2428,
"step-1": "import sys\n\nlines = sys.stdin.readlines()\n\nt = int(lines[0])\n\nfor i in range(t):\n c = i*10+1\n n = int(lines[c]) - 1\n first = [x.strip() for x in [\n lines[c+1],\n lines[c+2],\n lines[c+3],\n ... | [
0
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def word2cloud(text: str, mask_image: Image=None):
if mask_image == None:
wc = WordCloud(font_path='simhei.ttf', width=800, height=600, mode=
'RGBA', background_color=None).generate(text)
else:
... | flexible | {
"blob_id": "f9310aa6c26ec10041dac272fa17ac21f74c21ac",
"index": 9326,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef word2cloud(text: str, mask_image: Image=None):\n if mask_image == None:\n wc = WordCloud(font_path='simhei.ttf', width=800, height=600, mode=\n 'RGBA', backgr... | [
0,
1,
2,
3
] |
from PyQt4 import QtCore
SceneName = "sphere"
DefaultColor = QtCore.Qt.yellow
| normal | {
"blob_id": "874b87ca20385aa15cc7299707c9c1c0360ace43",
"index": 1045,
"step-1": "<mask token>\n",
"step-2": "<mask token>\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n",
"step-3": "from PyQt4 import QtCore\nSceneName = 'sphere'\nDefaultColor = QtCore.Qt.yellow\n",
"step-4": "from PyQt4 import Q... | [
0,
1,
2,
3
] |
from lib import gen, core
Shellcode = gen.Varname_Creator()
Hide_Window = gen.Varname_Creator()
def Start():
Start_Code = "#include <windows.h>\n"
Start_Code += "#include <tlhelp32.h>\n"
Start_Code += "#include <stdio.h>\n"
Start_Code += "#include <stdlib.h>\n"
Start_Code += "#include <string.... | normal | {
"blob_id": "e9b9f87a18a5788ac86b1e85c0f3d7858946e03a",
"index": 2999,
"step-1": "<mask token>\n\n\ndef Start():\n Start_Code = '#include <windows.h>\\n'\n Start_Code += '#include <tlhelp32.h>\\n'\n Start_Code += '#include <stdio.h>\\n'\n Start_Code += '#include <stdlib.h>\\n'\n Start_Code += '#in... | [
4,
5,
6,
7,
8
] |
# coding: utf-8
'''
Precision, Recall, F1で評価する
Leave-one-outの結果
K-foldの結果
'''
import sys
import os.path
import snlocest.util as util
import numpy as np
import pandas as pd
from sklearn.model_selection import KFold
from sklearn.metrics import precision_recall_fscore_support, classification_report
def precision_re... | normal | {
"blob_id": "79c7a2f2e5f0301c15efe1b26a7839a12098f793",
"index": 6618,
"step-1": "<mask token>\n\n\ndef precision_recall_fscore(nodes, y_true, y_pred):\n df = pd.DataFrame({'true': y_true, 'pred': y_pred}, index=nodes)\n n_predicted_nodes = len(df[df['pred'] != 0])\n n_corrects = len(df[df['pred'] == df... | [
2,
3,
4,
5,
6
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def run():
day = datetime.strptime('2017-10', '%Y-%m')
next_day = datetime.strptime('2017-11', '%Y-%m')
last_day = datetime.strptime('2018-11', '%Y-%m')
monthes = get_month()
result_keyword = {}
result_co... | flexible | {
"blob_id": "b048319a2ed182e70aa7f8a736ff02953577ec39",
"index": 2008,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef run():\n day = datetime.strptime('2017-10', '%Y-%m')\n next_day = datetime.strptime('2017-11', '%Y-%m')\n last_day = datetime.strptime('2018-11', '%Y-%m')\n monthes = ... | [
0,
1,
2,
3,
4
] |
#
# Util for WebDriver
#
import sys
from string import Formatter
from functools import wraps
from numbers import Integral
from .locator import Locator
from .keys import Keys
PY3 = sys.version_info[0] == 3
class MemorizeFormatter(Formatter):
"""Customize the Formatter to record used and unused kwargs."""
... | normal | {
"blob_id": "773fc4660def134410eca92886b2629be6977f74",
"index": 4095,
"step-1": "<mask token>\n\n\nclass MemorizeFormatter(Formatter):\n \"\"\"Customize the Formatter to record used and unused kwargs.\"\"\"\n\n def __init__(self):\n \"\"\"Initialize the MemorizeFormatter.\"\"\"\n Formatter._... | [
10,
11,
12,
13,
15
] |
class Box:
def __init__(self, id, capacity):
self.id = id
self.dogs = []
self.capacity = capacity
@property
def status(self):
return len(self.dogs)
def add_dog(self, dog):
if self.capacity > self.status:
self.dogs.append(dog)
return True... | normal | {
"blob_id": "5f24c5a21dc151e9efbbfaff0fe1e71e65d1eb67",
"index": 1590,
"step-1": "class Box:\n\n def __init__(self, id, capacity):\n self.id = id\n self.dogs = []\n self.capacity = capacity\n <mask token>\n <mask token>\n <mask token>\n",
"step-2": "class Box:\n\n def __init... | [
2,
3,
4,
5
] |
from flask import Flask, render_template, jsonify, request, make_response #BSD License
import requests #Apache 2.0
#StdLibs
import json
from os import path
import csv
###################################################
#Programmato da Alex Prosdocimo e Matteo Mirandola#
###################################... | normal | {
"blob_id": "14b9927435536a4b29b0930791ab4525acd80bc9",
"index": 5783,
"step-1": "<mask token>\n\n\n@application.route('/')\ndef index():\n return make_response(render_template('index.html'))\n\n\n@application.route('/getGraph', methods=['POST', 'GET'])\ndef getgraph():\n if request.method == 'POST':\n ... | [
2,
3,
4,
6,
7
] |
"""
test_extra.py:
In this file i wrote extra tests to my calculator program.
Divided to some main parts:
- Math Errors Tests (divide in zero, factorial, complex numbers)
- Test with edge cases of minus (operator / sign)
- Big results tests: expression that their result
... | normal | {
"blob_id": "f17d59ca9bfa82848ec6a599e98f759449ccdd14",
"index": 6376,
"step-1": "<mask token>\n\n\ndef test_divide_in_zero_from_start():\n expression = '56/0'\n result = main_evaluate(expression)\n assert result.error_type == DIVIDE_ZERO\n\n\n<mask token>\n\n\ndef test_mod_in_zero():\n expression = ... | [
16,
25,
26,
33,
36
] |
<|reserved_special_token_0|>
class AppUpdate(ModelMutation):
class Arguments:
id = graphene.ID(description='ID of an app to update.', required=True)
input = AppInput(required=True, description=
'Fields required to update an existing app.')
class Meta:
description = 'Upd... | flexible | {
"blob_id": "972a063bab35926472be592e6a17d450034fbf37",
"index": 4745,
"step-1": "<mask token>\n\n\nclass AppUpdate(ModelMutation):\n\n\n class Arguments:\n id = graphene.ID(description='ID of an app to update.', required=True)\n input = AppInput(required=True, description=\n 'Fields ... | [
1,
2,
3,
4,
5
] |
<|reserved_special_token_0|>
class Contact(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
class Order(models.Model):
order_id = mo... | flexible | {
"blob_id": "d123083358a4fd69f6f8de27fa177afac3bf80ce",
"index": 5680,
"step-1": "<mask token>\n\n\nclass Contact(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\n\nclass Order(models.Model):\n order... | [
7,
9,
11,
12,
13
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def get_html(url):
"""
Returns the html of url or None if status code is not 200
"""
req = urllib.request.Request(url, headers={'User-Agent':
'Python Learning Program', 'From': 'hklee310@gmail.com'})
... | flexible | {
"blob_id": "4572e243f75ad92c04f5cdc0b454df7389183a6a",
"index": 3238,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef get_html(url):\n \"\"\"\n Returns the html of url or None if status code is not 200\n \"\"\"\n req = urllib.request.Request(url, headers={'User-Agent':\n 'Pytho... | [
0,
1,
2,
3
] |
# Copyright (c) 2019 Uber Technologies, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | normal | {
"blob_id": "64b254db6d8f352b2689385e70f2ea7d972c9191",
"index": 4797,
"step-1": "<mask token>\n\n\ndef bsigs():\n S = lists(floats(allow_infinity=False, allow_nan=False), min_size=N_SIG,\n max_size=N_SIG)\n return S\n\n\ndef sigs():\n S = lists(bsigs(), min_size=1)\n return S\n\n\n<mask token... | [
4,
6,
7,
9,
10
] |
import os
import time
import requests
from dotenv import load_dotenv
from twilio.rest import Client
load_dotenv()
BASE_URL = 'https://api.vk.com/method/users.get'
def get_status(user_id):
params = {'user_ids': user_id, 'V': os.getenv('API_V'), 'access_token':
os.getenv('ACCESS_TOKEN'), 'fields': 'online'}... | normal | {
"blob_id": "6b2a9e8c6e95f52e9ebf999b81f9170fc669cce4",
"index": 6329,
"step-1": "<mask token>\n\n\ndef send_sms(sms_text):\n account_sid = os.getenv('TWILIO_ACCOUNT_SID')\n auth_token = os.getenv('TWILIO_AUTH_TOKEN')\n client = Client(account_sid, auth_token)\n message = client.messages.create(body=... | [
1,
3,
4,
5
] |
<|reserved_special_token_0|>
<|reserved_special_token_1|>
<|reserved_special_token_0|>
def twos_complement(lsb, msb):
signBit = (msb & 128) >> 7
msb &= 127
if signBit:
x = (msb << 8) + lsb
x ^= 32767
x = -1 - x
else:
x = (msb << 8) + lsb
x = x >> 6
return x
... | flexible | {
"blob_id": "a1b579494d20e8b8a26f7636ebd444252d2aa250",
"index": 4824,
"step-1": "<mask token>\n",
"step-2": "<mask token>\n\n\ndef twos_complement(lsb, msb):\n signBit = (msb & 128) >> 7\n msb &= 127\n if signBit:\n x = (msb << 8) + lsb\n x ^= 32767\n x = -1 - x\n else:\n ... | [
0,
1,
2,
3,
4
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.