text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: NaanProphet/imac-esp32-pwm-brightness path: /micropy/src/shell.py import sys import pwm def shell(): sys.stdout.write(b"ESP32 UART brightness control loop...\n") sys.stdout.write(b"Type 'repl' to return to micropython REPL.\n") led_ctrl = pwm.iMacBrightnessPWM(2, 1000, 0) imac_ct...
code_fim
medium
{ "lang": "python", "repo": "NaanProphet/imac-esp32-pwm-brightness", "path": "/micropy/src/shell.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Something(Hospital): def __init__(self): super(Something, self).__init__('something') # pass class Works(Something): def __init__(self): super(Works, self).__init__() # pass x = Works() print x.capacity # a = Patient('Bob', []) # b = Patient('Cody', []) #...
code_fim
hard
{ "lang": "python", "repo": "hmp36/python_aug_2017", "path": "/instruction/hospital.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hmp36/python_aug_2017 path: /instruction/hospital.py import random class Patient(object): def __init__(self, name, allergies): self.id = random.randint(1, 10000) self.name = name self.allergies = allergies self.bed_number = None <|fim_suffix|> x = Works() pri...
code_fim
hard
{ "lang": "python", "repo": "hmp36/python_aug_2017", "path": "/instruction/hospital.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(Something, self).__init__('something') # pass class Works(Something): def __init__(self): super(Works, self).__init__() # pass x = Works() print x.capacity # a = Patient('Bob', []) # b = Patient('Cody', []) # c = Hospital('Codys Hospital') # c.admit(a) # c.a...
code_fim
hard
{ "lang": "python", "repo": "hmp36/python_aug_2017", "path": "/instruction/hospital.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>n = 0 #starting number while (True): #condition print (n) n = n + 1 #increment by one if(n==10): #condition checking if value of n is equal to 10 break ...
code_fim
easy
{ "lang": "python", "repo": "paratropper/starting", "path": "/DAY1/handOn2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: paratropper/starting path: /DAY1/handOn2.py # -*- coding: utf-8 -*- """ Created on Mon Jun 3 21:11:27 2019 <|fim_suffix|>n = 0 #starting number while (True): #condition print (n) n = n + 1 #increment b...
code_fim
easy
{ "lang": "python", "repo": "paratropper/starting", "path": "/DAY1/handOn2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Prithvi-Devaiah/playstation5bot path: /telegramAPI.py import requests as requests import random import credentials url = credentials.telegramURL start_command = '/start' end_command = '/stop' reset_amazonURL_command = '/resetAmazonURL' test_command = '/runTest' add_new_refresher = '/addNewRefre...
code_fim
hard
{ "lang": "python", "repo": "Prithvi-Devaiah/playstation5bot", "path": "/telegramAPI.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return last_update(url)["update_id"] ''' def main(): while True: while get_message_text(last_update(url)) == start_command: update_id = last_update(url)["update_id"] update = last_update(url) # end the script when the user types /stop if ge...
code_fim
hard
{ "lang": "python", "repo": "Prithvi-Devaiah/playstation5bot", "path": "/telegramAPI.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def get_last_message_id(): return last_update(url)["update_id"] ''' def main(): while True: while get_message_text(last_update(url)) == start_command: update_id = last_update(url)["update_id"] update = last_update(url) # end the script when the user ty...
code_fim
hard
{ "lang": "python", "repo": "Prithvi-Devaiah/playstation5bot", "path": "/telegramAPI.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class LogicalSwitchFacade(logical_switch.LogicalSwitch, base_facade.BaseFacade): DEFAULT_EXECUTION_TYPE = constants.ExecutionType.API DEFAULT_IMPLEMENTATION_VERSION = "NSX70" def __init__(self, parent=None, id_=None): super(LogicalSwitchFacade, self).__init...
code_fim
hard
{ "lang": "python", "repo": "Cloudxtreme/MyProject", "path": "/SystemTesting/pylib/vmware/nsx/manager/logical_switch/logical_switch_facade.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cloudxtreme/MyProject path: /SystemTesting/pylib/vmware/nsx/manager/logical_switch/logical_switch_facade.py import vmware.common.base_facade as base_facade import vmware.common.constants as constants import vmware.interfaces.labels as labels import vmware.common.global_config as global_config imp...
code_fim
hard
{ "lang": "python", "repo": "Cloudxtreme/MyProject", "path": "/SystemTesting/pylib/vmware/nsx/manager/logical_switch/logical_switch_facade.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> req_time = time.time() for cfg in self.config_service.config_map[config]: start_time = req_time - cfg[0] c = self.db.query(History) \ .filter(History.access_id == access_id) \ .filter(History.access_at >= start_time) if ...
code_fim
hard
{ "lang": "python", "repo": "cannavit/cap-em", "path": "/app/service/limit_service.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cannavit/cap-em path: /app/service/limit_service.py import time from app.db.base import Session from app.model.history import History from .config_service import ConfigService class LimitService: <|fim_suffix|> req_time = time.time() for cfg in self.config_service.config_map[co...
code_fim
hard
{ "lang": "python", "repo": "cannavit/cap-em", "path": "/app/service/limit_service.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plot_pdp('YearMade') plot_pdp('YearMade', clusters=5) sorted(list(x.columns)) try: feats = ['saleElapsed', 'YearMade'] p = pdp.pdp_interact(m, x, x.columns, feats) pdp.pdp_interact_plot(p, feats) except: print("ignore errors") plot_pdp(['Enclosure_EROPS w AC', 'Enclosure_EROPS', 'Encl...
code_fim
hard
{ "lang": "python", "repo": "yao-eastside/fastai-intro-ml-2020", "path": "/courses/ml1/lesson2-rf_interpretation.py", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|># repo: yao-eastside/fastai-intro-ml-2020 path: /courses/ml1/lesson2-rf_interpretation.py # **Important: This notebook will only work with fastai-0.7.x. Do not try to run any fastai-1.x code from this path in the repository because it will load fastai-0.7.x** # # Random Forest Model interpretation # %l...
code_fim
hard
{ "lang": "python", "repo": "yao-eastside/fastai-intro-ml-2020", "path": "/courses/ml1/lesson2-rf_interpretation.py", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|># repo: duszk/SimplePasswordGenerator path: /passgenerator.py import random chars = 'abcdefghijklnopqrsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' num = int(input('enter number of passwords')) lenght = int(input('enter lenght of passwords')) <|fim_suffix|> for x in range(lenght): pa...
code_fim
easy
{ "lang": "python", "repo": "duszk/SimplePasswordGenerator", "path": "/passgenerator.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for x in range(lenght): password += random.choice(chars) print(password)<|fim_prefix|># repo: duszk/SimplePasswordGenerator path: /passgenerator.py import random chars = 'abcdefghijklnopqrsuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890' <|fim_middle|>num = int(input('enter number of...
code_fim
medium
{ "lang": "python", "repo": "duszk/SimplePasswordGenerator", "path": "/passgenerator.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def getRect(self): return self.rect<|fim_prefix|># repo: Cris2195/Game path: /game/StarShip.py import pygame class Starship(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([60,60]) self.rect = self.image...
code_fim
medium
{ "lang": "python", "repo": "Cris2195/Game", "path": "/game/StarShip.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cris2195/Game path: /game/StarShip.py import pygame class Starship(pygame.sprite.Sprite): def __init__(self): pygame.sprite.Sprite.__init__(self) self.image = pygame.Surface([60,60]) self.rect = self.image.get_rect() self.rect.x = 100 self.rect.y = 2...
code_fim
easy
{ "lang": "python", "repo": "Cris2195/Game", "path": "/game/StarShip.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ite_module_set[:100000], datas_per_page) try: editing_site_modules = paginator.page(page) print('check 1') except EmptyPage: editing_site_modules = paginator.page(paginator.num_pages) rediLevels = [x.redilevel_set.aggregate(Avg('level'))['level__avg'] for x in editing_s...
code_fim
hard
{ "lang": "python", "repo": "james868198/rnaedit", "path": "/web/functions/embed_sites.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: james868198/rnaedit path: /web/functions/embed_sites.py from django.shortcuts import render from ..models import Site from django.core.paginator import Paginator, EmptyPage from copy import deepcopy from django.db.models import Avg def embed_sites(request): search_request_dict = deepcopy(re...
code_fim
hard
{ "lang": "python", "repo": "james868198/rnaedit", "path": "/web/functions/embed_sites.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>length=200) index = models.CharField(max_length=200) num_events = models.IntegerField() filter = models.TextField(max_length = 1000) alert = models.CharField(max_length = 100) command = models.CharField(max_length = 400) runstatus = models.CharField(max_length=100,default='stopped'...
code_fim
medium
{ "lang": "python", "repo": "ngopi37/Elastic-Alert-Rule-engine", "path": "/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ngopi37/Elastic-Alert-Rule-engine path: /models.py from django.db import models from datetime import datetime # Create your models here. class Rule(models.Model): id = models.IntegerField(auto_created=True, primary_key=True)<|fim_suffix|>length=200) index = models.CharField(max_length=20...
code_fim
medium
{ "lang": "python", "repo": "ngopi37/Elastic-Alert-Rule-engine", "path": "/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimozonguo/Project_10 path: /scripts/test_setting.py import allure import pytest class TestSetting: @allure.severity("blocker") @allure.step(title="用于测试“XXX”功能的测试脚本") def test_login1(self): <|fim_suffix|> print(""); assert 1 #默认就是"normal"级别,即相当于:@allure.severity(...
code_fim
hard
{ "lang": "python", "repo": "jimozonguo/Project_10", "path": "/scripts/test_setting.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @allure.severity("trivial") @allure.step(title="用于测试“XXXX”功能的测试脚本") def test_login6(self): print(""); assert 1<|fim_prefix|># repo: jimozonguo/Project_10 path: /scripts/test_setting.py import allure import pytest class TestSetting: @allure.severity("blocker") @allure...
code_fim
hard
{ "lang": "python", "repo": "jimozonguo/Project_10", "path": "/scripts/test_setting.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Pkg.Registry.update() Pkg.add("PandaModels") Pkg.build() Pkg.resolve() logger.info("PandaModels is added to julia packages") try: Main.using("PandaModels") logger.info("using PandaModels in its base mode!") except ImportError: raise ImportError("cannot ...
code_fim
hard
{ "lang": "python", "repo": "e2nIEE/pandapower", "path": "/pandapower/test/opf/test_pandamodels_installation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: e2nIEE/pandapower path: /pandapower/test/opf/test_pandamodels_installation.py # Copyright (c) 2016-2023 by University of Kassel and Fraunhofer Institute for Energy Economics # and Energy System Technology (IEE), Kassel. All rights reserved. import pytest try: from julia.core import Unsuppor...
code_fim
hard
{ "lang": "python", "repo": "e2nIEE/pandapower", "path": "/pandapower/test/opf/test_pandamodels_installation.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if Base.find_package("PandaModels"): # remove PandaModels to reinstall it Pkg.rm("PandaModels") Pkg.resolve() Pkg.Registry.update() Pkg.add("PandaModels") logger.info("installing dev mode is a slow process!") Pkg.resolve() Pkg.develop("PandaModels") # a...
code_fim
hard
{ "lang": "python", "repo": "e2nIEE/pandapower", "path": "/pandapower/test/opf/test_pandamodels_installation.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02901/s824325461.py N, M = map(int, input().split()) inf = int(1e10) dp = [inf] * (1 << N) #1をNだけシフトする 2**B <|fim_suffix|>if dp[(1 << N) - 1] == inf: print(-1) else: print(dp[(1 << N) - 1])<|fim_middle|>#鍵をビットで表す dp[i]は鍵の状態iにできる最小費用を dp[0] = 0 b...
code_fim
hard
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p02901/s824325461.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if dp[(1 << N) - 1] == inf: print(-1) else: print(dp[(1 << N) - 1])<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p02901/s824325461.py N, M = map(int, input().split()) inf = int(1e10) dp = [inf] * (1 << N) #1をNだけシフトする 2**B <|fim_middle|>#鍵をビットで表す dp[i]は鍵の状態iにできる最小費用を dp[0] = 0 b...
code_fim
hard
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p02901/s824325461.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ids_and_exon_lengths = import_genes(gene_annotation) counts = import_count_matrix(count_matrix, selection) merged_data = pd.merge(ids_and_exon_lengths, counts, on="GSVIV") merged_data.drop(columns=["Chromosome", "PAC_ID"], inplace=True) merged_data.set_index("GSVIV", inplace=True) ...
code_fim
medium
{ "lang": "python", "repo": "EdgerLab/Grape_RNA_Seq_Expression_Analysis", "path": "/Scripts/FPKM/process.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> parser.add_argument( "--output_dir", "-o", type=str, default=os.path.join(path_main, "../../../../", "Grape_Data/Results"), help="parent directory to output results", ) args = parser.parse_args() args.genes_input_file = os.path.abspath(args.genes_in...
code_fim
hard
{ "lang": "python", "repo": "EdgerLab/Grape_RNA_Seq_Expression_Analysis", "path": "/Scripts/FPKM/process.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EdgerLab/Grape_RNA_Seq_Expression_Analysis path: /Scripts/FPKM/process.py #!/usr/bin/env python3 """ Calculate gene lengths for each gene from an annotation """ __author__ = "Scott Teresi" import argparse import os import numpy as np import pandas as pd import sys from gene_lengths import i...
code_fim
hard
{ "lang": "python", "repo": "EdgerLab/Grape_RNA_Seq_Expression_Analysis", "path": "/Scripts/FPKM/process.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HoracceFeng/Grid_World_demo path: /env.py # -*- coding: utf-8 -*- # @Author: iori # @Date: 2016-11-17 13:56:19 # @Last Modified by: lei gao # @Last Modified time: 2017-11-01 14:12:27 from __future__ import division import heapq import numpy as np import copy from collections import defaultdi...
code_fim
hard
{ "lang": "python", "repo": "HoracceFeng/Grid_World_demo", "path": "/env.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return np.stack([car_state, job_state, barrier_state],axis=-1) def take_action(self,policy): if policy == 0 and self.car[0] < self.config.screen_height-1: self.car[0] += 1 elif policy == 1 and self.car[0] > 0: self.car[0] -= 1 elif policy == 2 and self.car[1] < self.config.screen_width-1: ...
code_fim
hard
{ "lang": "python", "repo": "HoracceFeng/Grid_World_demo", "path": "/env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.ordering += 1 # get actions self.take_action(policy) reward, count = 0, 0 # get reward if possible if self.grid[self.car[0], self.car[1]]: reward += self.grid[self.car[0], self.car[1]] self.grid[self.car[0], self.car[1]] = 0.0 count += 1 if self.barrier[self.car[0],self.car[1...
code_fim
hard
{ "lang": "python", "repo": "HoracceFeng/Grid_World_demo", "path": "/env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: homey1337/efnpractice path: /model.py import datetime import pytz import web import config db = web.database(dbn='sqlite', db='dp.sqlite') # ================================================================= # datetime def current_time(): return datetime.datetime.now(pytz.utc) def loca...
code_fim
hard
{ "lang": "python", "repo": "homey1337/efnpractice", "path": "/model.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_tx_for_appointment(appointmentid): Q = web.db.SQLQuery P = web.db.SQLParam return db.select('tx', where=Q(['appointmentid=', P(appointmentid), ' or appointmentid is null']), order='app...
code_fim
hard
{ "lang": "python", "repo": "homey1337/efnpractice", "path": "/model.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: uccs-tdoan/django path: /webapp/admin.py from django.contrib import admin from webapp.models import riderride from webapp.mode<|fim_suffix|>ort Document # Register your models here. admin.site.register(ridermaster) admin.site.register(riderride) admin.site.register(Document) admin.site.register(l...
code_fim
medium
{ "lang": "python", "repo": "uccs-tdoan/django", "path": "/webapp/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>register(riderride) admin.site.register(Document) admin.site.register(limitwattsrider)<|fim_prefix|># repo: uccs-tdoan/django path: /webapp/admin.py from django.contrib import admin from webapp.models import riderride from webapp.models import ridermaster from webapp.models import limitwattsrider from we...
code_fim
medium
{ "lang": "python", "repo": "uccs-tdoan/django", "path": "/webapp/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ort Document # Register your models here. admin.site.register(ridermaster) admin.site.register(riderride) admin.site.register(Document) admin.site.register(limitwattsrider)<|fim_prefix|># repo: uccs-tdoan/django path: /webapp/admin.py from django.contrib import admin from webapp.models import riderride f...
code_fim
medium
{ "lang": "python", "repo": "uccs-tdoan/django", "path": "/webapp/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eliandreae/Sizing-hybrid-power-plants-under-round-the-clock-tender-compliance-in-India path: /plots_Stochastic.py import matplotlib.pyplot as plt import pandas as pd import numpy as np # Revenue and cost distribution data11 = pd.read_csv('Results_HPC/Results_Stochastic_yearly_HPC.csv') data22 = p...
code_fim
hard
{ "lang": "python", "repo": "eliandreae/Sizing-hybrid-power-plants-under-round-the-clock-tender-compliance-in-India", "path": "/plots_Stochastic.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x = ['Deterministic', 'Scenario 1', 'Scenario 2'] y1 = np.array([sum(data2['solar']), sum(data1_1['solar']), sum(data1_2['solar'])]) y2 = np.array([sum(data2['wind']), sum(data1_1['wind']), sum(data1_2['wind'])]) y3 = np.array([sum(data2['coal']), sum(data1_1['coal']), sum(data1_2['coal'])]) y4 = np.array...
code_fim
hard
{ "lang": "python", "repo": "eliandreae/Sizing-hybrid-power-plants-under-round-the-clock-tender-compliance-in-India", "path": "/plots_Stochastic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x = ['Deterministic', 'Scenario 1', 'Scenario 2'] y3 = np.array([sum(c1), sum(c2), sum(c3)]) y4 = np.array([sum(o1), sum(o2), sum(o3)]) y5 = np.array([sum(f1), sum(f2), sum(f3)]) y6 = np.array([sum(k1), sum(k2), sum(k3)]) # plot bars in stack manner plt.bar(x, y3, color='midnightblue') plt.bar(x, y4, bot...
code_fim
hard
{ "lang": "python", "repo": "eliandreae/Sizing-hybrid-power-plants-under-round-the-clock-tender-compliance-in-India", "path": "/plots_Stochastic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nathaniel2020/ML path: /KNN/KNN(write-identify).py from numpy import * from os import listdir import operator #将32x32的二进制图像矩阵转换为1x1024的向量 def imgVector(filename): returnVect = zeros((1, 1024)) f = open(filename) for i in range(32): listStr = f.readline() for...
code_fim
medium
{ "lang": "python", "repo": "nathaniel2020/ML", "path": "/KNN/KNN(write-identify).py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> hwlabels = [] #返回指定路径下的文件和文件夹列表。 trainingFileList = listdir('trainingDigits') m = len(trainingFileList) trainingMat = zeros((m,1024)) #将trainingDigits中的二进制图像转换为1x1024的向量,并根据文件名将对应的数字保存到hwlabels中 for i in range(m): fileNameStr = trainingFileList[i] fileSt...
code_fim
medium
{ "lang": "python", "repo": "nathaniel2020/ML", "path": "/KNN/KNN(write-identify).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tema = models.CharField(max_length=255) descripcion = models.CharField(max_length=255) #estudiante = models.ForeignKey(Estudiantes) fecha_inicio = models.DateField() fecha_fin = models.DateField() class TipoPregunta(models.Model): nombre = models.CharField(max_length=255) desc...
code_fim
hard
{ "lang": "python", "repo": "lenincamp/SMSE", "path": "/principal/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lenincamp/SMSE path: /principal/models.py from django.db import models #from django.contrib.auth.models import User class Persona(models.Model): nombres = models.CharField(max_length=255) apellidos = models.CharField(max_length=255) cedula = models.CharField(max_length=255) ...
code_fim
hard
{ "lang": "python", "repo": "lenincamp/SMSE", "path": "/principal/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> progenitores = models.ForeignKey(Progenitores) estudiantes = models.ForeignKey(Estudiantes) sexo = models.CharField(max_length=1) es_representante=models.BooleanField(default=False) es_huerfano=models.BooleanField(default=False) vive_estudiante = models.BooleanField(default=False) ...
code_fim
hard
{ "lang": "python", "repo": "lenincamp/SMSE", "path": "/principal/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>L = [6,7,839,2,0,9,3,87,65,62,3,14,43,27,8] print(*L) print(*selection_sort(L))<|fim_prefix|># repo: gedfalk/sources_and_stuff path: /Algo/4_Grokking/2_selection_sort.py # Сортировка выбором. Сложность О(n^2) def find_smallest(arr): sm = arr[0] ind = 0 for i in range(1, len(arr)): i...
code_fim
medium
{ "lang": "python", "repo": "gedfalk/sources_and_stuff", "path": "/Algo/4_Grokking/2_selection_sort.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gedfalk/sources_and_stuff path: /Algo/4_Grokking/2_selection_sort.py # Сортировка выбором. Сложность О(n^2) def find_smallest(arr): <|fim_suffix|> L = [] for i in range(len(arr)): si = find_smallest(arr) L.append(arr[si]) arr.pop(si) return L L = [6,7,839,2,0,...
code_fim
medium
{ "lang": "python", "repo": "gedfalk/sources_and_stuff", "path": "/Algo/4_Grokking/2_selection_sort.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def selection_sort(arr): L = [] for i in range(len(arr)): si = find_smallest(arr) L.append(arr[si]) arr.pop(si) return L L = [6,7,839,2,0,9,3,87,65,62,3,14,43,27,8] print(*L) print(*selection_sort(L))<|fim_prefix|># repo: gedfalk/sources_and_stuff path: /Algo/4_Grokk...
code_fim
medium
{ "lang": "python", "repo": "gedfalk/sources_and_stuff", "path": "/Algo/4_Grokking/2_selection_sort.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FredrikMeyer/numpoly path: /numpoly/array_function/common_type.py """Return a scalar type which is common to the input arrays.""" import numpy import numpoly from .common import implements @implements(numpy.common_type) def common_type(*arrays): <|fim_suffix|> The return type will always be...
code_fim
medium
{ "lang": "python", "repo": "FredrikMeyer/numpoly", "path": "/numpoly/array_function/common_type.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ arrays = [numpoly.aspolynomial(array) for array in arrays] arrays = [array[array.keys[0]] for array in arrays] return numpy.common_type(*arrays)<|fim_prefix|># repo: FredrikMeyer/numpoly path: /numpoly/array_function/common_type.py """Return a scalar type which is common to the input ...
code_fim
hard
{ "lang": "python", "repo": "FredrikMeyer/numpoly", "path": "/numpoly/array_function/common_type.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ct_lin_rec(3)) print(fact_lin_rec(4)) print(fact_lin_rec(5))<|fim_prefix|># repo: mickeymannella/cse2050f19exam2prac path: /r1.factorial/factlinrec.py def fact_lin_rec(n): if n == 0: return 1 else: return n * fact_lin_rec(n-1) print(fact_lin_rec<|fim_middle|>(0)) print(fact_lin_r...
code_fim
easy
{ "lang": "python", "repo": "mickeymannella/cse2050f19exam2prac", "path": "/r1.factorial/factlinrec.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mickeymannella/cse2050f19exam2prac path: /r1.factorial/factlinrec.py def fact_lin_rec(n): if n == 0: return 1 el<|fim_suffix|>(0)) print(fact_lin_rec(1)) print(fact_lin_rec(2)) print(fact_lin_rec(3)) print(fact_lin_rec(4)) print(fact_lin_rec(5))<|fim_middle|>se: return n *...
code_fim
medium
{ "lang": "python", "repo": "mickeymannella/cse2050f19exam2prac", "path": "/r1.factorial/factlinrec.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>test_start_time = time.time() allresultsLM = pt.pipelines.Experiment([BaseLTR_LM], dataset.get_topics("test"), dataset.get_qrels("test"), ["recip_rank", "ndcg_cut_10","map"], names=["LambdaMART"]) test_end_time...
code_fim
hard
{ "lang": "python", "repo": "YaoM1886/Information_Retrieval_Project", "path": "/IR_project/LambdaMART.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YaoM1886/Information_Retrieval_Project path: /IR_project/LambdaMART.py import numpy as np import pandas as pd import pyterrier as pt import xgboost as xgb import time if not pt.started(): pt.init(mem=20000) dataset = pt.get_dataset("trec-deep-learning-docs") def msmarco_generate(): with pt....
code_fim
hard
{ "lang": "python", "repo": "YaoM1886/Information_Retrieval_Project", "path": "/IR_project/LambdaMART.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Inject cart in context""" return {'cart': get_cart_from_request(request)}<|fim_prefix|># repo: rpip/sendhut-essentials path: /sendhut/cart/context_processors.py """Cart-related context processors.""" from .utils import get_cart_from_request <|fim_middle|> def cart(request):
code_fim
easy
{ "lang": "python", "repo": "rpip/sendhut-essentials", "path": "/sendhut/cart/context_processors.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rpip/sendhut-essentials path: /sendhut/cart/context_processors.py """Cart-related context processors.""" from .utils import get_cart_from_request <|fim_suffix|> """Inject cart in context""" return {'cart': get_cart_from_request(request)}<|fim_middle|>def cart(request):
code_fim
easy
{ "lang": "python", "repo": "rpip/sendhut-essentials", "path": "/sendhut/cart/context_processors.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize( "manifest_type", ["recording_set", "supervision_set", "cut_set", "feature_set"] ) def test_in_memory_writer(manifests, manifest_type): manifest = manifests[manifest_type] with manifest.open_writer(None) as writer: for item in manifest: writer.writ...
code_fim
hard
{ "lang": "python", "repo": "lhotse-speech/lhotse", "path": "/test/test_serialization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with NamedTemporaryFile(suffix=".gz" if compressed else "") as f: if format == "yaml": supervision_set.to_yaml(f.name) restored = supervision_set.from_yaml(f.name) if format == "json": supervision_set.to_json(f.name) restored = supervisio...
code_fim
hard
{ "lang": "python", "repo": "lhotse-speech/lhotse", "path": "/test/test_serialization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lhotse-speech/lhotse path: /test/test_serialization.py CutSet, Features, FeatureSet, MonoCut, MultiCut, Recording, RecordingSet, SupervisionSegment, SupervisionSet, load_manifest, store_manifest, ) from lhotse.lazy import LazyJsonlIterator from lhotse....
code_fim
hard
{ "lang": "python", "repo": "lhotse-speech/lhotse", "path": "/test/test_serialization.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aji-pratama/djfastapi path: /api/admin.py from django.contrib import admin from api.models import Tag, Category, Post @admin.register(Tag) class TagAdmin(admin.ModelAdmin): list_display = ['name'] <|fim_suffix|> @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = [...
code_fim
medium
{ "lang": "python", "repo": "aji-pratama/djfastapi", "path": "/api/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ['name'] @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = ['id', 'title'] list_display_links = ['title']<|fim_prefix|># repo: aji-pratama/djfastapi path: /api/admin.py from django.contrib import admin from api.models import Tag, Category, Post @admin...
code_fim
medium
{ "lang": "python", "repo": "aji-pratama/djfastapi", "path": "/api/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ['name'] @admin.register(Category) class CategoryAdmin(admin.ModelAdmin): list_display = ['name'] @admin.register(Post) class PostAdmin(admin.ModelAdmin): list_display = ['id', 'title'] list_display_links = ['title']<|fim_prefix|># repo: aji-pratama/djfastapi path: /api...
code_fim
easy
{ "lang": "python", "repo": "aji-pratama/djfastapi", "path": "/api/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def evidence(dots): return (scipy.stats.multivariate_normal.logpdf( dots, mean=np.r_[targets[0], 0], cov=cov) - scipy.stats.multivariate_normal.logpdf( dots, mean=np.r_[targets[1], 0], cov=cov)) #%% fig, ax = plt.subplots(figsize=(4, 3)); dots = n...
code_fim
medium
{ "lang": "python", "repo": "sbitzer/BeeMEG", "path": "/make_model_figures.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sbitzer/BeeMEG path: /make_model_figures.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed May 30 15:11:25 2018 @author: bitzer """ import helpers import numpy as np import matplotlib.pyplot as plt import os import scipy.stats <|fim_suffix|>#%% fig, ax = plt.subplots(figsi...
code_fim
hard
{ "lang": "python", "repo": "sbitzer/BeeMEG", "path": "/make_model_figures.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>idxs = wbplt.find_subpaths(x, dx, dims) idx = idxs[i] wbplt.pathplot_position(fig, ax, x[idx[0]:idx[1],:], dims=dims, sgns=sgns, color='b') wbplt.pathplot_arrows(fig, ax, x[idx[0]:idx[1],:], dx[idx[0]:idx[1],:], dims=dims, sgns=sgns, color='b') wbplt.show() # aspect is likely skewed when re...
code_fim
hard
{ "lang": "python", "repo": "PositronicsLab/wild-robot", "path": "/scripts/ex_plot_hilight_subpath.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PositronicsLab/wild-robot path: /scripts/ex_plot_hilight_subpath.py """ James Taylor This example demonstrates plotting path data from raw vicon data with additional highlighting of a particular subpath argument 1 is the path to the vicon data that is to be plotted <|fim_suffix|>dims=(1,2) sgns...
code_fim
hard
{ "lang": "python", "repo": "PositronicsLab/wild-robot", "path": "/scripts/ex_plot_hilight_subpath.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paomianshaokao/Openeyes path: /authen/views/logout.py from django.shortcuts import redirect from django.views import View class logout(View): <|fim_suffix|> request.session.clear() return redirect('/authen/login/')<|fim_middle|> def get(self, request):
code_fim
easy
{ "lang": "python", "repo": "paomianshaokao/Openeyes", "path": "/authen/views/logout.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get(self, request): request.session.clear() return redirect('/authen/login/')<|fim_prefix|># repo: paomianshaokao/Openeyes path: /authen/views/logout.py from django.shortcuts import redirect from django.views import View <|fim_middle|>class logout(View):
code_fim
easy
{ "lang": "python", "repo": "paomianshaokao/Openeyes", "path": "/authen/views/logout.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wmahad/Picha path: /api/migrations/0003_auto_20160218_1114.py # -*- coding: utf-8 -*- # Generated by Django 1.9.2 on 2016-02-18 11:14 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> dependencies = [ ('api', '0002_effectsmodel'), ] ...
code_fim
easy
{ "lang": "python", "repo": "wmahad/Picha", "path": "/api/migrations/0003_auto_20160218_1114.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='effectsmodel', name='effect', field=models.FileField(upload_to=b'effects/%Y/%m/%d'), ), ]<|fim_prefix|># repo: wmahad/Picha path: /api/migrations/0003_auto_20160218_1114.py # -*- coding: utf-8 -*...
code_fim
medium
{ "lang": "python", "repo": "wmahad/Picha", "path": "/api/migrations/0003_auto_20160218_1114.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if c1 >= K: print(1) else: print(ans)<|fim_prefix|># repo: wattaihei/ProgrammingContest path: /AtCoder/ABC-C/106probC.py S = input() K = int(input()) <|fim_middle|>c1 = 0 ans = S[0] for i, s in enumerate(S): if s != '1': ans = s break c1 = i+1
code_fim
medium
{ "lang": "python", "repo": "wattaihei/ProgrammingContest", "path": "/AtCoder/ABC-C/106probC.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wattaihei/ProgrammingContest path: /AtCoder/ABC-C/106probC.py S = input() K = int(input()) <|fim_suffix|>if c1 >= K: print(1) else: print(ans)<|fim_middle|>c1 = 0 ans = S[0] for i, s in enumerate(S): if s != '1': ans = s break c1 = i+1
code_fim
medium
{ "lang": "python", "repo": "wattaihei/ProgrammingContest", "path": "/AtCoder/ABC-C/106probC.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if average_temp[num] < average_coldest: average_coldest = average_temp[num] print('The hottest average was',average_hottest) print('The coldest average was',average_coldest)<|fim_prefix|># repo: brookstawil/LearningPython path: /Notes/8-6-14 ex1.py #8/6/14 #read in pairs of data(Jil...
code_fim
hard
{ "lang": "python", "repo": "brookstawil/LearningPython", "path": "/Notes/8-6-14 ex1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for num in range(1,366): if count_slips[num] > 0: average_temp[num] = tot_temp[num]/count_slips[num] print('The average for day',num,'was',average_temp[num],'for',count_slips[num],'slips of paper') if average_temp[num] > average_hottest: average_hottest = average_t...
code_fim
medium
{ "lang": "python", "repo": "brookstawil/LearningPython", "path": "/Notes/8-6-14 ex1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: brookstawil/LearningPython path: /Notes/8-6-14 ex1.py #8/6/14 #read in pairs of data(Jilian date. temperature), check it for validity #keep reading in until user says stop total = 0.0 counter = 0 tot_temp = [0] * 366 count_slips = [0] * 366 user_date = input('Type in a Julian date or STOP ') ...
code_fim
hard
{ "lang": "python", "repo": "brookstawil/LearningPython", "path": "/Notes/8-6-14 ex1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # if data[i][5] == 'Cat' and data[i][0] == 'Named': # numNamedCats += 1 # if data[i][5] == 'Cat' and data[i][0] == 'NoName': # numUnNamedCats += 1 #percentageNamedDogsAdopted = namedDogsAdopted/numNamedDogs*100 #percentageNamedDogsDied = namedDogsDied/numNamedDogs*100 #percentageNa...
code_fim
hard
{ "lang": "python", "repo": "CZAlmon/School-Programs", "path": "/Python/Data Mining Project for Kaggle.com/ShelterPreProcess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CZAlmon/School-Programs path: /Python/Data Mining Project for Kaggle.com/ShelterPreProcess.py CatsEuthanized = 0 #for i in range(len(dataVectors)): # if data[i][5] == 'Dog' and data[i][3] == 'Adoption' and data[i][9] == 'SolidColor': # SolidColorDogsAdopted += 1 # if data[i][5] ==...
code_fim
hard
{ "lang": "python", "repo": "CZAlmon/School-Programs", "path": "/Python/Data Mining Project for Kaggle.com/ShelterPreProcess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CZAlmon/School-Programs path: /Python/Data Mining Project for Kaggle.com/ShelterPreProcess.py oungDogsTransfered = youngDogsTransfered/numYoungDogs*100 #percentageYoungDogsReturnToOwners = youngDogsReturnedToOwners/numYoungDogs*100 #percentageYoungDogsEuthanized = youngDogsEuthanized/numYoungDogs...
code_fim
hard
{ "lang": "python", "repo": "CZAlmon/School-Programs", "path": "/Python/Data Mining Project for Kaggle.com/ShelterPreProcess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JanithDeSilva/hacktoberfest_2021 path: /main/diffie_helman.py from random import randint if _name_ == '_main_': # prime number P_Num = 23 G = 9 print('Prime number :%d' % (P_Num)) print('Primitive Root :%d' % (G)) # private key a pubA = 4 print('The Private Key...
code_fim
medium
{ "lang": "python", "repo": "JanithDeSilva/hacktoberfest_2021", "path": "/main/diffie_helman.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> y = int(pow(G, pubB, P_Num)) # Secret key A keyA = int(pow(y, pubA, P_Num)) # Secret key B keyB = int(pow(x, pubB, P_Num)) print('Secret key for A: %d' % (keyA)) print('Secret Key for B: %d' % (keyB))<|fim_prefix|># repo: JanithDeSilva/hacktoberfest_2021 path: /main/diffie_...
code_fim
hard
{ "lang": "python", "repo": "JanithDeSilva/hacktoberfest_2021", "path": "/main/diffie_helman.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_example_i(self): self.assertEqual(part1(EXAMPLE, "i"), 65079) def test_example_x(self): self.assertEqual(part1(EXAMPLE, "x"), 123) def test_example_y(self): self.assertEqual(part1(EXAMPLE, "y"), 456) class TestPart2(TestCase): def test_input(self): ...
code_fim
hard
{ "lang": "python", "repo": "N8Brooks/aoc_py", "path": "/tests/year2015/test_day07.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(part1(EXAMPLE, "f"), 492) def test_example_g(self): self.assertEqual(part1(EXAMPLE, "g"), 114) def test_example_h(self): self.assertEqual(part1(EXAMPLE, "h"), 65412) def test_example_i(self): self.assertEqual(part1(EXAMPLE, "i"), 65079) ...
code_fim
medium
{ "lang": "python", "repo": "N8Brooks/aoc_py", "path": "/tests/year2015/test_day07.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: N8Brooks/aoc_py path: /tests/year2015/test_day07.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ https://adventofcode.com/2015/day/7 """ from unittest import TestCase, main from aoc.year2015.day07 import part1, part2 from data.utils import get_input EXAMPLE = """123 -> x 456 -> y x AND...
code_fim
hard
{ "lang": "python", "repo": "N8Brooks/aoc_py", "path": "/tests/year2015/test_day07.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': arr1 = [2,3,1,3,2,4,6,7,9,2,19] arr2 = [2,1,4,3,9,6] ret = Solution().relativeSortArray(arr1, arr2) print(ret)<|fim_prefix|># repo: freesan44/LeetCode path: /LeetCode_1122.py class Solution: def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> Li...
code_fim
hard
{ "lang": "python", "repo": "freesan44/LeetCode", "path": "/LeetCode_1122.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: freesan44/LeetCode path: /LeetCode_1122.py class Solution: def relativeSortArray(self, arr1: List[int], arr2: List[int]) -> List[int]: <|fim_suffix|>if __name__ == '__main__': arr1 = [2,3,1,3,2,4,6,7,9,2,19] arr2 = [2,1,4,3,9,6] ret = Solution().relativeSortArray(arr1, arr2) p...
code_fim
hard
{ "lang": "python", "repo": "freesan44/LeetCode", "path": "/LeetCode_1122.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LarmIg/Algoritmos-Python path: /CAPITULO 5/Exercicio C.py # Construir um programa que apresente a soma dos cem primeir<|fim_suffix|> = 0 while Cont <= 100: Soma = Soma + Cont Cont = Cont + 1 print('Resultado da soma dos numero é {}'.format(Soma))<|fim_middle|>os números naturais (1+2+3+ ....
code_fim
medium
{ "lang": "python", "repo": "LarmIg/Algoritmos-Python", "path": "/CAPITULO 5/Exercicio C.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> + 1 print('Resultado da soma dos numero é {}'.format(Soma))<|fim_prefix|># repo: LarmIg/Algoritmos-Python path: /CAPITULO 5/Exercicio C.py # Construir um programa que apresente a soma dos cem primeir<|fim_middle|>os números naturais (1+2+3+ ... +98+99+100). Cont = 1 Soma = 0 while Cont <= 100: S...
code_fim
medium
{ "lang": "python", "repo": "LarmIg/Algoritmos-Python", "path": "/CAPITULO 5/Exercicio C.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bajpaiNikhil/codeForces path: /CF-B. Queue at the School.py n,m=map(int,input().split()) s=input()[:n] s=list(s) #print(s) d="" while m>0: for j in range(len(s)-1): if (s[j]=='B' and s[<|fim_suffix|> j+=1 m-=1 print(s) for i in range(len(s)): d+=s[i] print(d)<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "bajpaiNikhil/codeForces", "path": "/CF-B. Queue at the School.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>j+1]=='G'): s[j],s[j+1]=s[j+1],s[j] j+=1 j+=1 m-=1 print(s) for i in range(len(s)): d+=s[i] print(d)<|fim_prefix|># repo: bajpaiNikhil/codeForces path: /CF-B. Queue at the School.py n,m=map(int,input().split()) s=input()[:n] s=list(s) #print(s) d=""<|fim_middle...
code_fim
medium
{ "lang": "python", "repo": "bajpaiNikhil/codeForces", "path": "/CF-B. Queue at the School.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> j+=1 m-=1 print(s) for i in range(len(s)): d+=s[i] print(d)<|fim_prefix|># repo: bajpaiNikhil/codeForces path: /CF-B. Queue at the School.py n,m=map(int,input().split()) s=input()[:n] s=list(s) #print(s) d=""<|fim_middle|> while m>0: for j in range(len(s)-1): if (s[j]=='B' and ...
code_fim
medium
{ "lang": "python", "repo": "bajpaiNikhil/codeForces", "path": "/CF-B. Queue at the School.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (abs(self.x_pacman - self.x_entity1) < 1.5 * self.character_size or abs( self.x_pacman - self.x_entity2) < 1.5 * self.character_size): return True else: return False #resets the environment for a new episode def reset_env(self): ...
code_fim
hard
{ "lang": "python", "repo": "a1noack/eeg_data_collection_scripts", "path": "/environment/environment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #recenters pacman on screen def reposition_pacman(self): self.x_pacman = int((self.width / 2) - (self.character_size / 2)) def set_speed_direction(self): # reset pacman self.pacman_image = pygame.transform.scale(pygame.image.load(self.cur_dir+'/environment/images/pacma...
code_fim
hard
{ "lang": "python", "repo": "a1noack/eeg_data_collection_scripts", "path": "/environment/environment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: a1noack/eeg_data_collection_scripts path: /environment/environment.py nt/images/pacman.png'), (self.character_size, self.character_size)) if (self.move_left): self.pacman_image = pygame.transform.flip(self.pacman_image, 1, 0) self.maze = pygame.transform.scale( ...
code_fim
hard
{ "lang": "python", "repo": "a1noack/eeg_data_collection_scripts", "path": "/environment/environment.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class HTMLElementNotFoundException(Exception): def __init__(self, message): super(HTMLElementNotFoundException, self).__init__(message)<|fim_prefix|># repo: tunatone0111/bytecoin path: /microservice/errors.py class StockNotFoundException(Exception): def __init__(self, message): <|fim_midd...
code_fim
hard
{ "lang": "python", "repo": "tunatone0111/bytecoin", "path": "/microservice/errors.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, message): super(DateNotInRangeException, self).__init__(message) class HTMLElementNotFoundException(Exception): def __init__(self, message): super(HTMLElementNotFoundException, self).__init__(message)<|fim_prefix|># repo: tunatone0111/bytecoin path: /microserv...
code_fim
medium
{ "lang": "python", "repo": "tunatone0111/bytecoin", "path": "/microservice/errors.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tunatone0111/bytecoin path: /microservice/errors.py class StockNotFoundException(Exception): def __init__(self, message): <|fim_suffix|> class DateNotInRangeException(Exception): def __init__(self, message): super(DateNotInRangeException, self).__init__(message) class HTMLElemen...
code_fim
medium
{ "lang": "python", "repo": "tunatone0111/bytecoin", "path": "/microservice/errors.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }