text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> params = { 'number': '498032', 'numbering_identifier': 'refs/heads/master', 'numbering_type': 'COMMIT_POSITION', 'project': 'chromium', 'repo': 'chromium/src' } return_value = { 'git_sha': '4c9925b198332f5fbb82b3edb672ed55071f87dd', 'repo...
code_fim
medium
{ "lang": "python", "repo": "catapult-project/catapult", "path": "/dashboard/dashboard/services/crrev_service_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def main(test=0): # add all the objects in a list objectList = [Q, M, E, EV] # set the length of the experiment maxSimTime = 100.0 # call the runSimulation giving the objects and the length of the experiment runSimulation(objectList, maxSimTime) # calculate metrics workin...
code_fim
hard
{ "lang": "python", "repo": "sunhughees/manpy", "path": "/manpy/simulation/Examples/BalancingABuffer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunhughees/manpy path: /manpy/simulation/Examples/BalancingABuffer.py from manpy.simulation.imports import Machine, Queue, Exit, Part, EventGenerator from manpy.simulation.Globals import runSimulation, setWIP, G # method to check if the buffer is starving and refill it def balanceQueue(buffer, r...
code_fim
hard
{ "lang": "python", "repo": "sunhughees/manpy", "path": "/manpy/simulation/Examples/BalancingABuffer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ 判断回文主要是前半部分和后半部分的比较,将后半部分反转(仍然是单链表),则可以方便的判断回文。 时间 O(n),空间O(1). :type head: ListNode :rtype: bool """ if not head or not head.next: return True mid = self.midOfLists(head) bhead = self.reverseList(mid.next) ...
code_fim
medium
{ "lang": "python", "repo": "zhaoxinlu/leetcode-algorithms", "path": "/03LinkedList/234PalindromeLinkedList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhaoxinlu/leetcode-algorithms path: /03LinkedList/234PalindromeLinkedList.py # -*- coding: utf-8 -*- """ Editor: Zhao Xinlu School: BUPT Date: 2018-04-11 算法思想:判断是不是回文链表 """ # Definition for singly-linked list. class ListNode(object): <|fim_suffix|> if not head: return head ...
code_fim
hard
{ "lang": "python", "repo": "zhaoxinlu/leetcode-algorithms", "path": "/03LinkedList/234PalindromeLinkedList.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pre = None cur = head nhead = None while cur: nextN = cur.next if cur.next == None: nhead = cur cur.next = pre pre = cur cur = nextN return nhead<|fim_prefix|># repo: zhaoxinlu/leetcode-al...
code_fim
medium
{ "lang": "python", "repo": "zhaoxinlu/leetcode-algorithms", "path": "/03LinkedList/234PalindromeLinkedList.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsst-sitcom/spot_motion_monitor path: /spot_motion_monitor/camera/camera_status.py # This file is part of spot_motion_monitor. # # Developed for LSST System Integration, Test and Commissioning. # # See the LICENSE file at the top-level directory of this distribution # for details of code ownershi...
code_fim
medium
{ "lang": "python", "repo": "lsst-sitcom/spot_motion_monitor", "path": "/spot_motion_monitor/camera/camera_status.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"""Camera related information Attributes ---------- CameraStatus : collections.namedtuple Current values of particular camera information * name (str) : The name of the current camera. * currentFps (int) : The current Frames per Second rate. * isRoiMode (bool) : Flag for is the camera is ...
code_fim
medium
{ "lang": "python", "repo": "lsst-sitcom/spot_motion_monitor", "path": "/spot_motion_monitor/camera/camera_status.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> rep2 = Table(domain, metrics=["metric_1", "metric_2"]) rep2.from_database(rep.database, table=rep.default_database_table) rep3 = Table(domain, metrics=["metric_1", "metric_2"]) rep3.from_database(os.path.join(db_dir, "db.json"), table=rep.default_...
code_fim
hard
{ "lang": "python", "repo": "Sprinterzzj/hypertunity", "path": "/hypertunity/reports/tests/test_table.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sprinterzzj/hypertunity path: /hypertunity/reports/tests/test_table.py import os import tempfile from hypertunity.optimisation.base import EvaluationScore from ..table import Table def test_from_to_history(generated_history): history, domain = generated_history rep = Table( do...
code_fim
hard
{ "lang": "python", "repo": "Sprinterzzj/hypertunity", "path": "/hypertunity/reports/tests/test_table.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def set_debug_print_state(debug_enable): """Enable/disable debug prints""" global _debug _debug = debug_enable def reset_device_state(enable): """Reset the device state bits to the default enabled or disabled state""" clean_enable_state = _get_addr_for_bit(_eeprom_bit) clean_dis...
code_fim
hard
{ "lang": "python", "repo": "Rudysmama/pi-topPULSE", "path": "/library/ptpulse/configuration.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rudysmama/pi-topPULSE path: /library/ptpulse/configuration.py # configuration.py (pi-topPULSE) # Copyright (C) 2017 CEED ltd. # from math import pow import smbus import sys import time _bus_id = 1 _device_addr = 0x24 _debug = False _speaker_bit = 0 _mcu_bit = 1 _eeprom_bit = 2 _16khz_bit = 3 ...
code_fim
hard
{ "lang": "python", "repo": "Rudysmama/pi-topPULSE", "path": "/library/ptpulse/configuration.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Returns visibility of final level text as a boolean.""" final_level_text = self.driver.find_element_by_name(self.FINAL_LEVEL_TEXT_NAME) return final_level_text.is_displayed() def press_up_navigation_back_button(self): """Press up navigation back button.""" b...
code_fim
hard
{ "lang": "python", "repo": "only4arunkumar/aws-device-farm-appium-python-tests-for-android-sample-app", "path": "/tests/pages/nested_views_page.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """Press next level button.""" next_level_button = self.driver.find_element_by_name(self.NEXT_LEVEL_BUTTON_NAME) next_level_button.click() def get_counter(self): """Returns the current page counter as an int.""" counter = self.driver.find_element_by_name(self.C...
code_fim
hard
{ "lang": "python", "repo": "only4arunkumar/aws-device-farm-appium-python-tests-for-android-sample-app", "path": "/tests/pages/nested_views_page.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: only4arunkumar/aws-device-farm-appium-python-tests-for-android-sample-app path: /tests/pages/nested_views_page.py # Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"). # You may not use this file except in com...
code_fim
hard
{ "lang": "python", "repo": "only4arunkumar/aws-device-farm-appium-python-tests-for-android-sample-app", "path": "/tests/pages/nested_views_page.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mitre-cyber-academy/2013-grabbag-300 path: /src/addNums.py from PIL import Image import numpy as np import argparse def main(): <|fim_suffix|> img = Image.open(args.inFile) imgArr = np.array(img) ax1, ax2, ax3 = imgArr.shape currSum = 0 for i in range(ax1): for j in range(ax2): for k in...
code_fim
medium
{ "lang": "python", "repo": "mitre-cyber-academy/2013-grabbag-300", "path": "/src/addNums.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> img = Image.open(args.inFile) imgArr = np.array(img) ax1, ax2, ax3 = imgArr.shape currSum = 0 for i in range(ax1): for j in range(ax2): for k in range(ax3): currSum += imgArr[i,j,k] print currSum if __name__ == '__main__': main()<|fim_prefix|># repo: mitre-cyber-academy/2013-grabbag-300 ...
code_fim
medium
{ "lang": "python", "repo": "mitre-cyber-academy/2013-grabbag-300", "path": "/src/addNums.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data_container.set_expected_outputs(new_expected_outputs_data_container.data_inputs) current_ids = self.hash(data_container) data_container.set_current_ids(current_ids) return data_container class InputAndOutputTransformerMixin: """ Base output transformer step ...
code_fim
hard
{ "lang": "python", "repo": "Eric2Hamel/Neuraxle", "path": "/neuraxle/steps/output_handlers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eric2Hamel/Neuraxle path: /neuraxle/steps/output_handlers.py """ Output Handlers Steps ==================================== You can find here output handlers steps that changes especially the data outputs. .. Copyright 2019, Neuraxio Inc. Licensed under the Apache License, Version 2.0 (...
code_fim
hard
{ "lang": "python", "repo": "Eric2Hamel/Neuraxle", "path": "/neuraxle/steps/output_handlers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='pregunta', name='tipo', field=models.CharField(choices=[('A', 'Falso y Verdadero'), ('B', 'Multiple Opcion 1 Respuetsa'), ('C', 'Multiple Opcion Multiple Respuesta')], max_length=45), ), ]<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/migrations/0017_auto_20191027_0106.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('eval', '0016_auto_20191027_0102'), ] operations = [ migrations.AlterField( model_name='pregunta', name='tipo', field=models.CharField(choices=[('A', 'Falso y Verdadero'), ('B', 'Multiple Opcion 1 Respuetsa'), ('C', 'Multi...
code_fim
medium
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/migrations/0017_auto_20191027_0106.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mezoreth/sis325_eval path: /eval/migrations/0017_auto_20191027_0106.py # Generated by Django 2.2.6 on 2019-10-27 05:06 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('eval', '0016_auto_20191027_0102'), ] operations = [ migrations.AlterFie...
code_fim
medium
{ "lang": "python", "repo": "Mezoreth/sis325_eval", "path": "/eval/migrations/0017_auto_20191027_0106.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>## Output Description If it's possible to convert between the units, print the output as follows: 3 metres is 118.1 inches If it's not possible to convert between the units, print as follows: 3 metres can't be converted to pounds # Notes Rather than creating a method to do each separate type of co...
code_fim
medium
{ "lang": "python", "repo": "DayGitH/Python-Challenges", "path": "/DailyProgrammer/DP20140728A.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DayGitH/Python-Challenges path: /DailyProgrammer/DP20140728A.py """ [7/28/2014] Challenge #173 [Easy] Unit Calculator https://www.reddit.com/r/dailyprogrammer/comments/2bxntq/7282014_challenge_173_easy_unit_calculator/ <|fim_suffix|>## Input Description You will be given a request in the format...
code_fim
hard
{ "lang": "python", "repo": "DayGitH/Python-Challenges", "path": "/DailyProgrammer/DP20140728A.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k in del_ids: del self.traces[k] # 4. publish current bounding boxes self.__publish_bbox() # 5. publish tracking image self.__publish_tracking_image(self.image, self.bboxes) if __name__ == '__main__': rospy.init_node('iou_tracker', anonymou...
code_fim
hard
{ "lang": "python", "repo": "ZhiangChen/ros_iou_tracking", "path": "/src/iou_tracker.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZhiangChen/ros_iou_tracking path: /src/iou_tracker.py #!/usr/bin/env python3 """ ros_iou_tracking Copyright 2021 Zhiang Chen 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 ...
code_fim
hard
{ "lang": "python", "repo": "ZhiangChen/ros_iou_tracking", "path": "/src/iou_tracker.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Write to a file named payoffs.csv # Make sure that there is a header line [Indicating the column names, eg. Player, Payoff] # and the lines are ended properly [Hint: put a newline character at the end of each line] # and the you close the file. def save_to_file(): with open('payoffs.csv', 'w') as...
code_fim
hard
{ "lang": "python", "repo": "koltpython/python-assignments-fall2019", "path": "/Assignment2-B/assignment2b.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for player in players: if players_guesses[player] == jar_contains_mostly(): payoffs[player] = prize else: payoffs[player] = 0 #This method prints the players' payoffs at the end of program. def print_payoffs(): print(f'Since there were more {jar_contains_mo...
code_fim
hard
{ "lang": "python", "repo": "koltpython/python-assignments-fall2019", "path": "/Assignment2-B/assignment2b.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: koltpython/python-assignments-fall2019 path: /Assignment2-B/assignment2b.py import random # In your code don't directly use numbers, but use this variables. payoffs = {} players_guesses = {} number_of_balls = 100 number_of_players = 5 red_ratio = random.uniform(0, 1) prize = 20 # This line choo...
code_fim
hard
{ "lang": "python", "repo": "koltpython/python-assignments-fall2019", "path": "/Assignment2-B/assignment2b.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> GafferUI.CompoundPlugValueWidget.__init__( self, plug, collapsed, label, self.__summary ) @staticmethod def __summary( plug ) : info = [] translate = plug["translate"].getValue() if translate[0] != 0 or translate[1] != 0 or translate[2] != 0 : info.append( "Translate " + str( translate...
code_fim
medium
{ "lang": "python", "repo": "dneg/gaffer", "path": "/python/GafferUI/TransformPlugValueWidget.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: dneg/gaffer path: /python/GafferUI/TransformPlugValueWidget.py ########################################################################## # # Copyright (c) 2013, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modificat...
code_fim
hard
{ "lang": "python", "repo": "dneg/gaffer", "path": "/python/GafferUI/TransformPlugValueWidget.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sigmarising/poetry-statistics-summary path: /personLocation.py """ File: personLocation.py Desc: 脚本 - 用于统计各个朝代的 诗词作品中提及到的人物、地点 数量 """ import os import json import settings from collections import Counter from module.ColorLogDecorator import ColorLogDecorator INPUT_DIR = os.path.join(set...
code_fim
hard
{ "lang": "python", "repo": "sigmarising/poetry-statistics-summary", "path": "/personLocation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pointer += 1 msg = " Handling {0} {1:.2f}% : {2}".format(dynasty, pointer * 100 / this_len, file) print(ColorLogDecorator.blue(msg)) file_path = os.path.join(dynasty_path, file) with open(file_path, 'r+', encoding='utf-8', errors='ignore') as f:...
code_fim
hard
{ "lang": "python", "repo": "sigmarising/poetry-statistics-summary", "path": "/personLocation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nsang0u/TweetMapping path: /2get_tweets.py ''' Geo_pull extracts tweet location geocode / date tuples from CSV. get_coords translates geocode to coordinate and writes these to a new csv. ''' import csv import geopy from geopy.geocoders import Nominatim GEOCOL = 5 DATECOL = 2 def geo_...
code_fim
hard
{ "lang": "python", "repo": "nsang0u/TweetMapping", "path": "/2get_tweets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Old description: Uses geopy to pull coordinates from the geo_set, passes over errors from set items that arent coordinates, returns set of long/lat tuples. """ from geopy.geocoders import Nominatim #coord_list = list() #print(str(location_set)+"!") with op...
code_fim
medium
{ "lang": "python", "repo": "nsang0u/TweetMapping", "path": "/2get_tweets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m .parking import Parking # noqa from .parking_area import ParkingArea # noqa<|fim_prefix|># repo: maxg0/parkkihubi path: /parkings/models/__init__.py from .address import Address # noqa fr<|fim_middle|>om .operator import Operator # noqa fro
code_fim
easy
{ "lang": "python", "repo": "maxg0/parkkihubi", "path": "/parkings/models/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maxg0/parkkihubi path: /parkings/models/__init__.py from .address import Address # noqa fr<|fim_suffix|>m .parking import Parking # noqa from .parking_area import ParkingArea # noqa<|fim_middle|>om .operator import Operator # noqa fro
code_fim
easy
{ "lang": "python", "repo": "maxg0/parkkihubi", "path": "/parkings/models/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for record in data: try: table.put_item(Item=record, ConditionExpression=f'attribute_not_exists({primaryKey})') time.sleep(0.1) except ClientError as cErr: if cErr.response['Error']['Code'] == 'ConditionalCheckFailedException...
code_fim
hard
{ "lang": "python", "repo": "fabirami/quickstart-aws-industrial-machine-connectivity", "path": "/functions/source/AssetModelConverter/drivers/kepserver_file_driver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> except ClientError as cErr: if cErr.response['Error']['Code'] == 'ConditionalCheckFailedException': log.info('Ignoring existing record {}'.format(record[primaryKey])) else: raise def processEvent(self, event): ...
code_fim
hard
{ "lang": "python", "repo": "fabirami/quickstart-aws-industrial-machine-connectivity", "path": "/functions/source/AssetModelConverter/drivers/kepserver_file_driver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabirami/quickstart-aws-industrial-machine-connectivity path: /functions/source/AssetModelConverter/drivers/kepserver_file_driver.py import json import logging import os import time import boto3 from boto3.dynamodb.conditions import Key from botocore.exceptions import ClientError log = logging...
code_fim
hard
{ "lang": "python", "repo": "fabirami/quickstart-aws-industrial-machine-connectivity", "path": "/functions/source/AssetModelConverter/drivers/kepserver_file_driver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gangadhar-kadam/sapphite_lib path: /core/page/data_import_tool/data_import_tool.py # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. # MIT License. See license.txt from __future__ import unicode_literals import webnotes, json import webnotes.model.doc import webnotes.model.doctype from web...
code_fim
hard
{ "lang": "python", "repo": "gangadhar-kadam/sapphite_lib", "path": "/core/page/data_import_tool/data_import_tool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if empty_cols: if columns[-1*len(empty_cols):] == empty_cols: # filter empty columns if they exist at the end columns = columns[:-1*len(empty_cols)] else: webnotes.msgprint(_("Please make sure that there are no empty columns in the file."), raise_exception=1) return columns d...
code_fim
hard
{ "lang": "python", "repo": "gangadhar-kadam/sapphite_lib", "path": "/core/page/data_import_tool/data_import_tool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self._factory.create_batch([txn]) def name_to_address(self, name): return LISP_NAMESPACE + self._factory.sha512(name.encode())[:64]<|fim_prefix|># repo: nickdrozd/sawtooth-lisp path: /families/lisp/lisp_test/lisp_message_factory.py import json from sawtooth_lisp.lisp import L...
code_fim
hard
{ "lang": "python", "repo": "nickdrozd/sawtooth-lisp", "path": "/families/lisp/lisp_test/lisp_message_factory.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nickdrozd/sawtooth-lisp path: /families/lisp/lisp_test/lisp_message_factory.py import json from sawtooth_lisp.lisp import LISP_NAMESPACE from sawtooth_processor_test.message_factory import MessageFactory class LispMessageFactory: def __init__(self, private=None, public=None): self....
code_fim
hard
{ "lang": "python", "repo": "nickdrozd/sawtooth-lisp", "path": "/families/lisp/lisp_test/lisp_message_factory.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Meenadshi/GoogleKickStart-2020 path: /Round C/candies.py # Copyright (c) 2020 kamyu. All rights reserved. # # Google Kick Start 2020 Round C - Problem D. Candies # https://codingcompetitions.withgoogle.com/kickstart/round/000000000019ff43/0000000000337b4d # # Time: O(N + QlogN) # Space: O(N) # ...
code_fim
medium
{ "lang": "python", "repo": "Meenadshi/GoogleKickStart-2020", "path": "/Round C/candies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> T, MT = BIT(A, False), BIT(A, True) result = 0 for _ in xrange(Q): o, a, b = raw_input().strip().split() if o == 'U': x, v = int(a)-1, int(b) update(A, T, MT, x, v) continue l, r = int(a)-1, int(b)-1 sign = 1 if l%2 == 0 else ...
code_fim
hard
{ "lang": "python", "repo": "Meenadshi/GoogleKickStart-2020", "path": "/Round C/candies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i += 1 # Extra one for dummy node. ret = 0 while i > 0: ret += self.__bit[i] i -= (i & -i) return ret def update(A, T, MT, i, v): diff = v-A[i] sign = 1 if i%2 == 0 else -1 T.add(i, sign*diff) MT.add(i, sign*diff*(i+1)) A[i] = v...
code_fim
medium
{ "lang": "python", "repo": "Meenadshi/GoogleKickStart-2020", "path": "/Round C/candies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure/WALinuxAgent path: /tests/protocol/test_goal_state.py IG_NAME], "The retry request did not include the expected header for the RoleConfigName") def test_fetch_goal_state_should_raise_on_incomplete_goal_state(self): with mock_wire_protocol(mockwiredata.DATA_FILE) as protocol: ...
code_fim
hard
{ "lang": "python", "repo": "Azure/WALinuxAgent", "path": "/tests/protocol/test_goal_state.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with mock_wire_protocol(mockwiredata.DATA_FILE_VM_SETTINGS) as protocol: invalid_vm_settings_file = "hostgaplugin/vm_settings-parse_error.json" data_file = mockwiredata.DATA_FILE_VM_SETTINGS.copy() data_file["vm_settings"] = invalid_vm_settings_file ...
code_fim
hard
{ "lang": "python", "repo": "Azure/WALinuxAgent", "path": "/tests/protocol/test_goal_state.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # The most recent goal state is FastTrack timestamp = datetime.datetime.utcnow() + datetime.timedelta(seconds=15) protocol.mock_wire_data.set_vm_settings_source(GoalStateSource.FastTrack) protocol.mock_wire_data.set_etag('222222', timestamp) goa...
code_fim
hard
{ "lang": "python", "repo": "Azure/WALinuxAgent", "path": "/tests/protocol/test_goal_state.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> s = SortedSetCache("chunk") count = 1000 for x in range(count): s.add((x + 1, x + 1)) prev_score = 0 for c, item in enumerate(s.chunk(chunk=500, desc=False), 1): self.assertLess(prev_score, item[0]) self.assertEqual(count, c) ...
code_fim
hard
{ "lang": "python", "repo": "Jaymon/caches", "path": "/tests/core_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_exists(self): c = SetCache('exists') self.assertFalse(c.exists()) c.add(1) self.assertTrue(c.exists()) def test_set(self): key = ['sfoo__init__', 'bar__init__'] c = SetCache(key, ttl=1) c.add('happy') self.assertTrue('happy'...
code_fim
hard
{ "lang": "python", "repo": "Jaymon/caches", "path": "/tests/core_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jaymon/caches path: /tests/core_test.py ache('ktest_increment') c.serialize = False c += 1 self.assertEqual(1, c.data) c2 = Cache('ktest_increment') c2.serialize = False self.assertEqual(1, int(c2)) c2.increment(10) self.assertEqu...
code_fim
hard
{ "lang": "python", "repo": "Jaymon/caches", "path": "/tests/core_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 4. Extract space dimensions test_env = PettingZooEnv(env_creator({})) obs_space = test_env.observation_space act_space = test_env.action_space # 5. Configuration for multiagent setup with policy sharing: config["multiagent"] = { "policies": { # the first tupl...
code_fim
hard
{ "lang": "python", "repo": "ray-project/maze-raylit", "path": "/rllib/examples/pettingzoo_env.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env = pistonball_v1.env(local_ratio=config.get("local_ratio", 0.2)) env = dtype_v0(env, dtype=float32) env = color_reduction_v0(env, mode="R") env = normalize_obs_v0(env) return env num_cpus = 1 num_rollouts = 2 # 1. Gets default training configuration...
code_fim
hard
{ "lang": "python", "repo": "ray-project/maze-raylit", "path": "/rllib/examples/pettingzoo_env.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ray-project/maze-raylit path: /rllib/examples/pettingzoo_env.py from copy import deepcopy from numpy import float32 import os from supersuit import normalize_obs_v0, dtype_v0, color_reduction_v0 import ray from ray.rllib.agents.registry import get_agent_class from ray.rllib.env import PettingZoo...
code_fim
hard
{ "lang": "python", "repo": "ray-project/maze-raylit", "path": "/rllib/examples/pettingzoo_env.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scaplan/ev2-optionality path: /swed-corpus_grep.py #!/usr/bin/python # -*- coding: utf-8 -*- import sys, math reload(sys) sys.setdefaultencoding('utf-8') import unicodedata from unicodedata import normalize def corpusGrep(searchString, fileName): with open(fileName, 'r') as currFile: curr...
code_fim
hard
{ "lang": "python", "repo": "scaplan/ev2-optionality", "path": "/swed-corpus_grep.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # check if we're reading in a word if currLineTokens[0] == "<w": currWordRaw = currLineTokens[-1] currWordClean = currWordRaw[currWordRaw.find(">")+1:currWordRaw.find("<")] currWordClean = currWordClean.lower() currSentenceClean = currSentenceClean + " " + currWordClean if 'VB' i...
code_fim
hard
{ "lang": "python", "repo": "scaplan/ev2-optionality", "path": "/swed-corpus_grep.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if 'att' in currSentenceClean: print "\n----- " + currSentenceClean + " -----" #for markupLine in currSentenceMarkup: # sys.stdout.write(markupLine) for inst in instances: sys.stdout.write(inst+"\n") sys.stdout.flush() currSentenceMarkup = [] currSentenceClean...
code_fim
hard
{ "lang": "python", "repo": "scaplan/ev2-optionality", "path": "/swed-corpus_grep.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dboun/nnDetection path: /nndet/utils/info.py """ Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may ...
code_fim
hard
{ "lang": "python", "repo": "dboun/nnDetection", "path": "/nndet/utils/info.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> try: return fn(*args, **kwargs) except Exception as e: logger.error(str(e)) raise e return wrapper @contextmanager def file_logger(path: Union[str, Path], level: str = "DEBUG", overwrite: bool = True): """ context manager to automatically c...
code_fim
hard
{ "lang": "python", "repo": "dboun/nnDetection", "path": "/nndet/utils/info.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Args: fn: function to wrap Returns: Any """ def wrapper(*args, **kwargs): try: return fn(*args, **kwargs) except Exception as e: logger.error(str(e)) raise e return wrapper @contextmanager def file_logger(path: Unio...
code_fim
hard
{ "lang": "python", "repo": "dboun/nnDetection", "path": "/nndet/utils/info.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: marlenebDC/pycon path: /backend/api/users/schema.py from typing import List import strawberry from graphql import GraphQLError from users.models import get_countries from .types import Country, MeUser <|fim_suffix|> return user @strawberry.type class CountryQuery: @strawberry.fi...
code_fim
hard
{ "lang": "python", "repo": "marlenebDC/pycon", "path": "/backend/api/users/schema.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @strawberry.field def countries(self, info) -> List[Country]: resp = get_countries() return [Country(code=country["code"], name=country["name"]) for country in resp] @strawberry.field def country(self, info, code: str = "") -> Country: resp = get_countries(code) ...
code_fim
medium
{ "lang": "python", "repo": "marlenebDC/pycon", "path": "/backend/api/users/schema.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- File (Optionnal) """ digit_dic={'0':'Zero','1':'One','2':'Two','3':'Three','4':'Four','5':'Five','6':'Six','7':'Seven','8':'Eight','9':'Nine'} f.write("\n% 2. Histogram sessions with given requests") f.write("\n\\newcommand{\\%s}{%d}"%('ThresholdRequestsPerS...
code_fim
medium
{ "lang": "python", "repo": "pedroramaciotti/LogDiv", "path": "/logdiv/sessionfeatures/session_hist_tex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedroramaciotti/LogDiv path: /logdiv/sessionfeatures/session_hist_tex.py def session_hist_tex(f, session_data,threshold_requests_per_session): """ Write session caracteristics in latex file Parameters ---------- f: file <|fim_suffix|> Returns -------...
code_fim
medium
{ "lang": "python", "repo": "pedroramaciotti/LogDiv", "path": "/logdiv/sessionfeatures/session_hist_tex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: online-behaviour/machine-learning path: /eval.py #!/usr/bin/python3 -W all # eval: compute precision and recall for classifier output # usage: eval < file # note: expects gold tag and guessed tag as final two tokens on line # 20170413 erikt(at)xs4all.nl import re import sys ALL = "" # tag r...
code_fim
medium
{ "lang": "python", "repo": "online-behaviour/machine-learning", "path": "/eval.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>correct = {} # dictionary with correct counts gold = {} # dictionary with gold tag counts guessed = {} # dictionary with guessed tag counts correct[ALL] = 0 gold[ALL] = 0 guessed[ALL] = 0 for line in sys.stdin: # remove final newline line = line.rstrip() # get the tokens on the line to...
code_fim
medium
{ "lang": "python", "repo": "online-behaviour/machine-learning", "path": "/eval.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># show results for tag in sorted(gold): if not tag in correct: correct[tag] = 0.0 if not tag in guessed: guessed[tag] = 0.0 if guessed[tag] > 0.0: precision = float(correct[tag])/float(guessed[tag]) else: precision = 0.0 if gold[tag] > 0.0: recall = float(correct[tag])/float(gold[tag])...
code_fim
hard
{ "lang": "python", "repo": "online-behaviour/machine-learning", "path": "/eval.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: msmiglo/pkwscraper path: /pkwscraper/lib/dbdriver.py structor creates empty table. `from_df` method gets data from `pandas.DataFrame` object. `Table` can be created as read only - the modifying and deleting operations cannot be performed. Records can be read directly by record I...
code_fim
hard
{ "lang": "python", "repo": "msmiglo/pkwscraper", "path": "/pkwscraper/lib/dbdriver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ DEPRECATED """ book = xlrd.open_workbook(filepath) sheet = book.sheets()[0] n_rows = sheet.nrows column_names = sheet.row(0) column_names = [col.value for col in column_names] data = [] for i in range(1, n_rows): row = sheet....
code_fim
hard
{ "lang": "python", "repo": "msmiglo/pkwscraper", "path": "/pkwscraper/lib/dbdriver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = [] for i in range(1, n_rows): row = sheet.row(i) record = { column_names[j]: cell.value for j, cell in enumerate(row) } data.append(record) table_df = pd.DataFrame(data) if column_names[...
code_fim
hard
{ "lang": "python", "repo": "msmiglo/pkwscraper", "path": "/pkwscraper/lib/dbdriver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> doBAM=False if '-bam' in sys.argv: doBAM=True chrominfo=sys.argv[sys.argv.index('-bam')+1] samtools=sys.argv[sys.argv.index('-bam')+2] chromInfoList = [] chromInfoDict = {} linelist=open(chrominfo) for line in linelist: fields = l...
code_fim
hard
{ "lang": "python", "repo": "georgimarinov/GeorgiScripts", "path": "/SAMstats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> SeenDict={} SeenTwiceDict={} doPaired=False if '-paired' in sys.argv: doPaired=True print 'will treat reads as paired' # SeenDictPaired={} # SeenDictPairedSpliced={} print 'examining read multiplicty' ReadLengthDict={} NoSeqLen = 0 if doBAM...
code_fim
hard
{ "lang": "python", "repo": "georgimarinov/GeorgiScripts", "path": "/SAMstats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: georgimarinov/GeorgiScripts path: /SAMstats.py the mate is unmapped 1 # 0x0010 16 strand of the query (0 for forward; 1 for reverse strand) # 0x0020 32 strand of the mate 1 # 0x0040 64 the read is the first read in a pair 1,2 # 0x0080 128 the read is the second read in a pair 1,2 # 0x0100 256 the...
code_fim
hard
{ "lang": "python", "repo": "georgimarinov/GeorgiScripts", "path": "/SAMstats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blockspacer/siggraphwall path: /gen.py #!/usr/bin/env python # -*- coding: utf-8 -*- # vim: set ts=4: # system modules import os from random import shuffle import sys reload(sys) sys.setdefaultencoding('utf-8') # 3rd-party modules from bibpy import bib from PIL import Image from staticjinja im...
code_fim
hard
{ "lang": "python", "repo": "blockspacer/siggraphwall", "path": "/gen.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> template_folder = os.path.join(os.getcwd(), 'templates') renderer = Renderer( template_folder=template_folder, contexts=[ ('index.html', get_works), ]) renderer.run(debug=True, use_reloader=False) return 0 if __name__ == "__main__": ...
code_fim
medium
{ "lang": "python", "repo": "blockspacer/siggraphwall", "path": "/gen.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: aither64/havesnippet path: /api/forms.py from datetime import datetime from django import forms from django.db.models import F from django.utils import timezone from datetime import timedelta from api.models import AuthKey from snippet.models import Snippet, Language, ACCESSIBILITY from snippet i...
code_fim
hard
{ "lang": "python", "repo": "aither64/havesnippet", "path": "/api/forms.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def clean_accessibility(self): access = self.cleaned_data.get("accessibility") if not access: access = 1 if not self.user and access > 1: raise forms.ValidationError('accessibility must be 0 or 1') return access def clean_expiration(self)...
code_fim
hard
{ "lang": "python", "repo": "aither64/havesnippet", "path": "/api/forms.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def il_to_eeschema( inp: intermediate_lang.OutputIL, out, library: intermediate_lang.LibraryIL ): symbols_used = set( library.symbols[component.human_name].raw_data for component in inp.components if type(component) == entities.Cell ) lib_symbols = Schemat...
code_fim
hard
{ "lang": "python", "repo": "ThomasPDye/asg", "path": "/asg/output/eeschema/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> components = [ component_to_eeschema(component, library) for component in inp.components ] symbol_instances = SchematicElement( "symbol_instances", [ SchematicElement( "path", [ f"/{c.uuid}", ...
code_fim
hard
{ "lang": "python", "repo": "ThomasPDye/asg", "path": "/asg/output/eeschema/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThomasPDye/asg path: /asg/output/eeschema/__init__.py import uuid from typing import Tuple import asg.intermediate_lang as intermediate_lang import asg.entities as entities from asg.grammar import * class SchematicElement(Atom): def __init__(self, name, children): super()...
code_fim
hard
{ "lang": "python", "repo": "ThomasPDye/asg", "path": "/asg/output/eeschema/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Team-Hydra-Hacking/Python3-NoXss path: /engine.py method = case.method url = case.url headers = case.headers body = case.body args = case.args old_param = args[2] old_value = args[3] print('Verify case use:\n%s' % url) # time...
code_fim
hard
{ "lang": "python", "repo": "Team-Hydra-Hacking/Python3-NoXss", "path": "/engine.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ parse xxx.xml from burpsuite proxy. :return: """ if os.path.exists(self.burp): import base64 from xml.etree import cElementTree as ET from model import HttpRequest, HttpResponse with open(self.burp)as f: ...
code_fim
hard
{ "lang": "python", "repo": "Team-Hydra-Hacking/Python3-NoXss", "path": "/engine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def process_param(self): rtn = Detector.detect_param(self.request) if rtn: self.param_dict = rtn @functimeout(30) def process_reflect(self): for param, value in list(self.param_dict.items()): # improve accuracy if len(value) > 1: ...
code_fim
hard
{ "lang": "python", "repo": "Team-Hydra-Hacking/Python3-NoXss", "path": "/engine.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: salesforce/cloudsplaining path: /cloudsplaining/output/report.py """Creates the HTML Reports""" import json import datetime import os.path from typing import Dict, Any from jinja2 import Environment, FileSystemLoader from cloudsplaining.bin.version import __version__ app_bundle_path = os.path.j...
code_fim
hard
{ "lang": "python", "repo": "salesforce/cloudsplaining", "path": "/cloudsplaining/output/report.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def get_vendor_bundle_path() -> str: """Finds the vendored javascript bundle even if it has a hash suffix""" vendor_bundle_directory = os.path.join(os.path.dirname(__file__), "dist", "js") file_list_with_full_path = [] for f in os.listdir(vendor_bundle_directory): file_path = os.p...
code_fim
hard
{ "lang": "python", "repo": "salesforce/cloudsplaining", "path": "/cloudsplaining/output/report.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: omp87/vdms path: /docker/demo/examples/getDescriptors.py import cv2 import vdms import sys import os import urllib import time import json import unittest import numpy as np import csv import face_recognition import util <|fim_suffix|> # Draw a rectangle around the faces counter = 0 f...
code_fim
hard
{ "lang": "python", "repo": "omp87/vdms", "path": "/docker/demo/examples/getDescriptors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # compute the facial embedding for the face encodings = face_recognition.face_encodings(rgb, boxes) # Draw a rectangle around the faces counter = 0 for (top, right, bottom, left) in boxes: cv2.rectangle(image, (left, top), (right, bottom), (0, 255, 0), 2) y = top - 15 ...
code_fim
hard
{ "lang": "python", "repo": "omp87/vdms", "path": "/docker/demo/examples/getDescriptors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('logistica', '0057_alter_notafiscal_data_base'), ] operations = [ migrations.AlterField( model_name='notafiscal', name='empresa', field=models.SmallIntegerField(choices=[(1, 'Tussor'), (2, 'Agator'), (3, 'Corte'), (4, 'Gav...
code_fim
easy
{ "lang": "python", "repo": "anselmobd/fo2", "path": "/src/logistica/migrations/0058_alter_notafiscal_empresa.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('logistica', '0057_alter_notafiscal_data_base'), ] operations = [ migrations.AlterField( model_name='notafiscal', name='empresa', field=models.SmallIntegerField(choices=[(1, 'Tussor'), (2, 'Agator'), (3, 'Corte'), (4, 'Gavi...
code_fim
easy
{ "lang": "python", "repo": "anselmobd/fo2", "path": "/src/logistica/migrations/0058_alter_notafiscal_empresa.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anselmobd/fo2 path: /src/logistica/migrations/0058_alter_notafiscal_empresa.py # Generated by Django 3.2.16 on 2023-07-24 15:09 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('logistica', '0057_alter_notafiscal_data_base'), ] operations = [ ...
code_fim
easy
{ "lang": "python", "repo": "anselmobd/fo2", "path": "/src/logistica/migrations/0058_alter_notafiscal_empresa.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhivyadharshin/pytorch path: /tools/test/test_translate_annotations.py import re import unittest from tools.linter.translate_annotations import parse_annotation, parse_diff, translate flake8_regex \ = r'^(?P<filename>.*?):(?P<lineNumber>\d+):(?P<columnNumber>\d+): (?P<errorCode>\w+\d+) (?P<...
code_fim
hard
{ "lang": "python", "repo": "dhivyadharshin/pytorch", "path": "/tools/test/test_translate_annotations.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_parse_diff_haskell(self) -> None: self.assertEqual( parse_diff(haskell_diff), { 'old_filename': 'hello.hs', 'hunks': [ { 'old_start': 1, 'old_count': 1, ...
code_fim
hard
{ "lang": "python", "repo": "dhivyadharshin/pytorch", "path": "/tools/test/test_translate_annotations.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # at this point, we have a stretch of lines that are identical # in both versions of the file, but the original version of the # file had 4 lines before this section whereas the new version # has only 3 lines before this section self.assertEqual(translate(diff, 4), ...
code_fim
hard
{ "lang": "python", "repo": "dhivyadharshin/pytorch", "path": "/tools/test/test_translate_annotations.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Checks if coin's parent ID matches the ID from the condition """ if unspent.coin.parent_coin_info != condition.vars[0]: return Err.ASSERT_MY_PARENT_ID_FAILED return None def mempool_assert_my_puzzlehash(condition: ConditionWithArgs, unspent: CoinRecord) -> Optional[Err]: ...
code_fim
hard
{ "lang": "python", "repo": "Aloe-Network/aloe-blockchain", "path": "/aloe/full_node/mempool_check_conditions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aloe-Network/aloe-blockchain path: /aloe/full_node/mempool_check_conditions.py import time from typing import Dict, List, Optional, Set from aloe.consensus.cost_calculator import NPCResult from aloe.full_node.generator import create_generator_args, setup_generator_args from aloe.types.blockchain...
code_fim
hard
{ "lang": "python", "repo": "Aloe-Network/aloe-blockchain", "path": "/aloe/full_node/mempool_check_conditions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: rennat/django_delta_logger path: /src/django_delta_logger/migrations/0001_initial.py # Generated by Django 2.2.3 on 2019-07-31 01:53 from django.db import migrations, models import django.db.models.deletion import django_delta_logger import django_delta_logger.fields <|fim_suffix|> operation...
code_fim
medium
{ "lang": "python", "repo": "rennat/django_delta_logger", "path": "/src/django_delta_logger/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> initial = True dependencies = [ ('contenttypes', '0002_remove_content_type_name'), ] operations = [ migrations.CreateModel( name='DeltaEvent', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, ve...
code_fim
medium
{ "lang": "python", "repo": "rennat/django_delta_logger", "path": "/src/django_delta_logger/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: haihua-sysu/onlinejudge path: /web/contest/views.py #!/usr/bin/env python # coding: utf-8 from django.core.context_processors import csrf from django.template import Context, RequestContext from django.http import HttpResponseRedirect from django.shortcuts import get_object_or_404, render_to_re...
code_fim
hard
{ "lang": "python", "repo": "haihua-sysu/onlinejudge", "path": "/web/contest/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }