text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> except: print("something went wrong") return command def run_lisa(): command = take_command() if 'play' in command: song = command.replace('play','') talk('hey playing' + song) print('playing...'+ song) pywhatkit.playon...
code_fim
hard
{ "lang": "python", "repo": "ridgerunner03/AI_project", "path": "/AAAA.000.000.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>max_sc = max(sc_lst) min_sc = min(sc_lst) sc_lst.remove(max_sc) sc_lst.remove(min_sc) ave_sc = sum(sc_lst) / len(sc_lst) print('去除最高分%d,最低分%d,平均分为%d' % (max_sc, min_sc, ave_sc)) print('end')<|fim_prefix|># repo: KeasonL/CrossinCode_test100 path: /097_ScoreCounting.py # 赛场统分 # 【问题】在编程竞赛中,有10个评委为参赛的选手打分,分数...
code_fim
hard
{ "lang": "python", "repo": "KeasonL/CrossinCode_test100", "path": "/097_ScoreCounting.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KeasonL/CrossinCode_test100 path: /097_ScoreCounting.py # 赛场统分 # 【问题】在编程竞赛中,有10个评委为参赛的选手打分,分数为0 ~ 100分。 # 选手最后得分为:去掉一个最高分和一个最低分后其余8个分数的平均值。请编写一个程序实现。 <|fim_suffix|>max_sc = max(sc_lst) min_sc = min(sc_lst) sc_lst.remove(max_sc) sc_lst.remove(min_sc) ave_sc = sum(sc_lst) / len(sc_lst) print('去除最高...
code_fim
hard
{ "lang": "python", "repo": "KeasonL/CrossinCode_test100", "path": "/097_ScoreCounting.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nikit34/kassa-ios-ui-tests path: /tests/shedule_page/test_001_filters.py from time import sleep import pytest import allure from app.debug_api import DebugAPI from app.check_api import HandlersAPI from locators.movies_details_locators import MoviesDetailsPageLocators from locators.movies_locator...
code_fim
hard
{ "lang": "python", "repo": "nikit34/kassa-ios-ui-tests", "path": "/tests/shedule_page/test_001_filters.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """тапнуть на фичерс, тапнуть на смотреть расписание, найти кнопку отмены, кнопку карты, поле поиска""" with allure.step('MoviesPage'): self.movie_page = MoviesPage(driver) self.movie_page.set_custom_wait(10) self.movie_page.act.click_by_...
code_fim
hard
{ "lang": "python", "repo": "nikit34/kassa-ios-ui-tests", "path": "/tests/shedule_page/test_001_filters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: serenapaneri/final_assignment path: /scripts/user_interface.py #! /usr/bin/env python # import ros stuff import rospy from std_srvs.srv import * #to check if the service is active active_ = False def unable_service(req): """ This function contains the variable declared above that is used to...
code_fim
hard
{ "lang": "python", "repo": "serenapaneri/final_assignment", "path": "/scripts/user_interface.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(): """ The main function allows the user to choose the robot's behavior. If the service is active it call the function getInput that allows the user to make a new choice. If it is not, it check if the selected behavior is the second one and in that case change it with the fourth one. """ ...
code_fim
hard
{ "lang": "python", "repo": "serenapaneri/final_assignment", "path": "/scripts/user_interface.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # reading the previous input prev_input_ = rospy.get_param('/input') input_ = prev_input_ #in order to make the user to choose one of the 5 possible inputs while (prev_input_ == input_) or (input_ > 5 or input_ < 1): if input_ > 5 or input_ < 1: #in the case in which the user make another sel...
code_fim
hard
{ "lang": "python", "repo": "serenapaneri/final_assignment", "path": "/scripts/user_interface.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TTNguyenDev/Thesis-2020 path: /DataProcessing/medical.py import pandas as pd from pandas.io.json import json_normalize import numpy as np import warnings import re warnings.filterwarnings("ignore") data_path = '/Users/trietnguyen/Documents/Thesis/Thesis-2020/References/Crawler/summaryDataJson.js...
code_fim
hard
{ "lang": "python", "repo": "TTNguyenDev/Thesis-2020", "path": "/DataProcessing/medical.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def rmDuplicate(df): df.drop_duplicates(subset ='noSpace', keep = 'first', inplace = True) df.index = range(len(df.index)) def splitMedicine(df): df_temp = df['name'].apply(formatName) new_df = pd.DataFrame([[a, b, c] for a,b,c in df_temp.values], columns=['number',...
code_fim
hard
{ "lang": "python", "repo": "TTNguyenDev/Thesis-2020", "path": "/DataProcessing/medical.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def run(): ''' Read software name on command line and run version selection ''' try: opts, args = getopt.getopt(sys.argv[1:], 'h', ['help']) except getopt.GetoptError as exception: print('Error parsing command line: %s' ...
code_fim
hard
{ "lang": "python", "repo": "c4s4/babel", "path": "/bin/version", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def ask_version(self): ''' Prompt user for software version in the list of installed versions ''' # print version list print('Please choose a version:') index = 1 if self.current_version == 'current': selected = self.SELECTED ...
code_fim
hard
{ "lang": "python", "repo": "c4s4/babel", "path": "/bin/version", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: c4s4/babel path: /bin/version #!/usr/bin/env python # encoding: UTF-8 ''' Script to select current version for a given soft (python, ruby or java). ''' import os import re import sys import glob import getopt # fix input in Python 2 and 3 try: input = raw_input # pylint: disable=redefined...
code_fim
hard
{ "lang": "python", "repo": "c4s4/babel", "path": "/bin/version", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: christianbillp/specialkursus path: /w1a1_test.py import bnn #get #!wget http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz #!wget http://yann.lecun.com/exdb/mnist/t10k-labels-idx1-ubyte.gz #unzip #!gzip -d t10k-images-idx3-ubyte.gz #!gzip -d t10k-labels-idx1-ubyte.gz <|fim_suffix|>print...
code_fim
hard
{ "lang": "python", "repo": "christianbillp/specialkursus", "path": "/w1a1_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print("Testing throughput") result_W1A1 = lfcW1A1_classifier.classify_mnists("/home/xilinx/jupyter_notebooks/bnn/t10k-images-idx3-ubyte")<|fim_prefix|># repo: christianbillp/specialkursus path: /w1a1_test.py import bnn #get #!wget http://yann.lecun.com/exdb/mnist/t10k-images-idx3-ubyte.gz #!wget http://...
code_fim
hard
{ "lang": "python", "repo": "christianbillp/specialkursus", "path": "/w1a1_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> flair_model = FlairModel(model_path="ner", entities_to_keep=["PERSON"]) evaluator = Evaluator(model=flair_model) evaluation_results = evaluator.evaluate_all(small_dataset) scores = evaluator.calculate_score(evaluation_results) assert_model_results_gt(scores, "PERSON", 0)<|fim_prefix|...
code_fim
medium
{ "lang": "python", "repo": "microsoft/presidio-research", "path": "/tests/test_flair_model.py", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/presidio-research path: /tests/test_flair_model.py import sys import pytest from presidio_evaluator.evaluation import Evaluator from tests.conftest import assert_model_results_gt from presidio_evaluator.models.flair_model import FlairModel <|fim_suffix|> flair_model = FlairModel(m...
code_fim
medium
{ "lang": "python", "repo": "microsoft/presidio-research", "path": "/tests/test_flair_model.py", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> flair_model = FlairModel(model_path="ner", entities_to_keep=["PERSON"]) evaluator = Evaluator(model=flair_model) evaluation_results = evaluator.evaluate_all(small_dataset) scores = evaluator.calculate_score(evaluation_results) assert_model_results_gt(scores, "PERSON", 0)<|fim_prefix|>...
code_fim
medium
{ "lang": "python", "repo": "microsoft/presidio-research", "path": "/tests/test_flair_model.py", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/Dockerfile path: /qimen_server/waybill_jd.py # coding: utf-8 import logging import uuid import json import xmltodict import bottle from bottle import HTTPError from bottle.ext import sqlalchemy from database import Base, engine from database import JdWaybillSendResp, JdWaybillApplyResp ...
code_fim
hard
{ "lang": "python", "repo": "cash2one/Dockerfile", "path": "/qimen_server/waybill_jd.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> query = bottle.request.query jd_rsp = db.query(JdWaybillSendResp).filter_by(wms_order_code=query.get('wms_order_code')).first() if jd_rsp: # return entities return jd_rsp.body return HTTPError(404, None) def jd_get_response_normal(): code = str(uuid.uuid4()).split('-'...
code_fim
hard
{ "lang": "python", "repo": "cash2one/Dockerfile", "path": "/qimen_server/waybill_jd.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Beatrizpjunq/Learning_python path: /texte COHPIAH.py # -*- coding: utf-8 -*- """ Created on Sat Jul 18 20:24:53 2020 @author: filip """ import re texto = "Muito além, nos confins inexplorados da região mais brega da Borda Ocidental desta Galáxia, há um pequeno sol amarelo e esquecido....
code_fim
hard
{ "lang": "python", "repo": "Beatrizpjunq/Learning_python", "path": "/texte COHPIAH.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def tam_medio (list_palavras): # Traço linguístico 1 palavras = lista_palavras(texto) i = 0 soma_palavras = 0 while i < len(palavras): x = palavras[i] soma_palavras = soma_palavras + len(x) i +=1 tam = soma_palavras/len(palavras) return tam def t...
code_fim
hard
{ "lang": "python", "repo": "Beatrizpjunq/Learning_python", "path": "/texte COHPIAH.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> retval = add_new_topic(request.json, ALL_DBS) return jsonify({'return_code': retval}) @app.route('/api/1.0/<string:api_call>', methods = ['POST']) def generic_api_call(api_call): if not request.json: abort(400) param1 = request.json.get('param1', 'no param 1') param2 = request...
code_fim
hard
{ "lang": "python", "repo": "jillh510/video_story_arcs", "path": "/webserver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LHYAha/flask_demo path: /app.py #-*- coding = utf-8-*- #@Time : 2020/6/26 11:02 #@Author :Ella #@File :app.py #@Software : PyCharm import time import datetime from flask import Flask,render_template,request #render_template渲染模板 app = Flask(__name__) #初始化的对象 #路由解析,通过用户访问的路径,匹配想要的函数 @app.route...
code_fim
medium
{ "lang": "python", "repo": "LHYAha/flask_demo", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': result = request.form return render_template("test/result.html",result = result) if __name__ == '__main__': app.run(debug=True)<|fim_prefix|># repo: LHYAha/flask_demo path: /app.py #-*- coding = utf-8-*- #@Time : 2020/6/26 11:02 #@Author :Ella #@File ...
code_fim
hard
{ "lang": "python", "repo": "LHYAha/flask_demo", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '''This step generates a PDS-style requirements file''' def execute(self): token = self.getToken() if not token: _logger.info('🤷‍♀️ No GitHub administrative token; cannot generate requirements') return argv = [ 'requirement-report', ...
code_fim
hard
{ "lang": "python", "repo": "nutjob4life/roundup-action", "path": "/src/pds/roundup/step.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> else: logger.info("Nothing to report") ph.save_products(products) logger.info("Configuration saved") else: print("Exec this file as the main entrypoint! -> python3 init.py")<|fim_prefix|># repo: jpradass/AmazonSpider path: /init.py from helper.logger_helper import Log from he...
code_fim
medium
{ "lang": "python", "repo": "jpradass/AmazonSpider", "path": "/init.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ph.save_products(products) logger.info("Configuration saved") else: print("Exec this file as the main entrypoint! -> python3 init.py")<|fim_prefix|># repo: jpradass/AmazonSpider path: /init.py from helper.logger_helper import Log from helper.mail_helper import MailHelper import spider.spider ...
code_fim
medium
{ "lang": "python", "repo": "jpradass/AmazonSpider", "path": "/init.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpradass/AmazonSpider path: /init.py from helper.logger_helper import Log from helper.mail_helper import MailHelper import spider.spider as spider from configuration.configuration_handler import Configuration from configuration.products_handler import ProductsHandler if __name__ == "__main__": ...
code_fim
medium
{ "lang": "python", "repo": "jpradass/AmazonSpider", "path": "/init.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenHumans/openhumans-seeq path: /openhumans_seeq/migrations/0001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.10.4 on 2016-12-19 15:25 from __future__ import unicode_literals <|fim_suffix|> class Migration(migrations.Migration): initial = True dependencies = [ ] ...
code_fim
medium
{ "lang": "python", "repo": "OpenHumans/openhumans-seeq", "path": "/openhumans_seeq/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuanyunyy/insight_project path: /test_Spark.py def test(d_iter): from cqlengine import columns from cqlengine.models import Model from cqlengine.query import ModelQuerySet from cqlengine import connection from cqlengine.management import sync_table ...
code_fim
hard
{ "lang": "python", "repo": "yuanyunyy/insight_project", "path": "/test_Spark.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> link_id = columns.Text(primary_key=True) title = columns.Text() permalink = columns.Text() subreddit = columns.Text() subreddit_id = columns.Text() selftext = columns.Text() created = columns.In...
code_fim
hard
{ "lang": "python", "repo": "yuanyunyy/insight_project", "path": "/test_Spark.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>3]) * 3 yuki[i], enemy[(i+1)%3] = max(0, yuki[i]-enemy[(i+1)%3]), max(0, enemy[(i+1)%3]-yuki[i]) for i in range(3): ans += min(yuki[i], enemy[i]) print(ans)<|fim_prefix|># repo: knuu/competitive-programming path: /yukicoder/yuki161.py yuki = list(map(int, input().split())) S = input() enemy = [S...
code_fim
medium
{ "lang": "python", "repo": "knuu/competitive-programming", "path": "/yukicoder/yuki161.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rhdurham/Automated-containerized-bioinformatics-workflows path: /server/main.py import tornado.ioloop import tornado.web import json import utils class BaseHandler(tornado.web.RequestHandler): def set_default_headers(self): self.set_header("Access-Control-Allow-Origin", "*") ...
code_fim
hard
{ "lang": "python", "repo": "rhdurham/Automated-containerized-bioinformatics-workflows", "path": "/server/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class SubmitHandler(BaseHandler): def post(self): data = tornado.escape.json_decode(self.request.body) print(data) folderPath = str(data['id']) utils.mkdir(folderPath) self.write('testing') def make_app(): return tornado.web.Application([ (r"/packag...
code_fim
hard
{ "lang": "python", "repo": "rhdurham/Automated-containerized-bioinformatics-workflows", "path": "/server/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for package in packages: name = packages[package]["name"] version = packages[package]["version"] try: if version not in condaPackages[name]["versions"]: condaPackages[name]["versions"].append(version) except: ...
code_fim
medium
{ "lang": "python", "repo": "rhdurham/Automated-containerized-bioinformatics-workflows", "path": "/server/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: withJackson/NovelWebsite path: /scrapy/topdb/topdb/spiders/novels.py # -*- coding: utf-8 -*- import scrapy import os from topdb.items import BiqugeItem class NovelsSpider(scrapy.Spider): name = 'novels' allowed_domains = ['xbiquge.la'] start_urls = ['http://www.xbiquge.la/xiaoshuo...
code_fim
hard
{ "lang": "python", "repo": "withJackson/NovelWebsite", "path": "/scrapy/topdb/topdb/spiders/novels.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (not os.path.exists(newname)): os.makedirs(newname) if(not os.path.exists(newname+'/'+ str(i) + ".txt")): yield scrapy.Request(url, meta={'chaptername':chaptername,'tag':classname,'name':name,'author':author,'index':i}, callback=self.detail_parse...
code_fim
hard
{ "lang": "python", "repo": "withJackson/NovelWebsite", "path": "/scrapy/topdb/topdb/spiders/novels.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>[i-1]*A[i]),A[i])) Min.append(min(min(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) tmax=Max[0] for i in range(0,size): if Max[i]>tmax: tmax=Max[i] return tmax<|fim_prefix|># repo: talentlei/leetcode path: /python/151-160/Maximum Product Subarray.py ...
code_fim
hard
{ "lang": "python", "repo": "talentlei/leetcode", "path": "/python/151-160/Maximum Product Subarray.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: talentlei/leetcode path: /python/151-160/Maximum Product Subarray.py def maxProduct(self, A): size= len(A) if size==1: return A[0] Max=<|fim_suffix|>[i-1]*A[i]),A[i])) Min.append(min(min(Max[i-1]*A[i],Min[i-1]*A[i]),A[i])) tmax=Max[0] ...
code_fim
hard
{ "lang": "python", "repo": "talentlei/leetcode", "path": "/python/151-160/Maximum Product Subarray.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(0,size): if Max[i]>tmax: tmax=Max[i] return tmax<|fim_prefix|># repo: talentlei/leetcode path: /python/151-160/Maximum Product Subarray.py def maxProduct(self, A): size= len(A) if size==1: return A[0] Max=[...
code_fim
hard
{ "lang": "python", "repo": "talentlei/leetcode", "path": "/python/151-160/Maximum Product Subarray.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamesilloyd/IP_Festo_Fetch.ai path: /MESA_Models/main.py from mesa.visualization.modules import CanvasGrid from mesa.visualization.ModularVisualization import ModularServer from mesa.visualization.modules import ChartModule from mesa.batchrunner import BatchRunner from agentPortrayal import agent...
code_fim
hard
{ "lang": "python", "repo": "jamesilloyd/IP_Festo_Fetch.ai", "path": "/MESA_Models/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> server = ModularServer(MASArchitecture, [grid, chart, chart2, chart3, chart4, averageMessagesSentChart, ...
code_fim
hard
{ "lang": "python", "repo": "jamesilloyd/IP_Festo_Fetch.ai", "path": "/MESA_Models/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 'Average successful satisfaction score':metrics.averageSuccessfulSatisfactionScore, 'Average satisfaction score':metrics.averageSatisfactionScore, '% Cheap orders with cheap machines':metrics.cheapO...
code_fim
hard
{ "lang": "python", "repo": "jamesilloyd/IP_Festo_Fetch.ai", "path": "/MESA_Models/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EuKudryashova/interrupt path: /test.py import mock def exc(): print 'here should raise' <|fim_suffix|> def test_recursion(): global exc exc = mock.Mock(side_effect = [StandardError, StandardError, mock.DEFAULT]) recursion() test_recursion()<|fim_middle|>def recursion(): try...
code_fim
medium
{ "lang": "python", "repo": "EuKudryashova/interrupt", "path": "/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_recursion(): global exc exc = mock.Mock(side_effect = [StandardError, StandardError, mock.DEFAULT]) recursion() test_recursion()<|fim_prefix|># repo: EuKudryashova/interrupt path: /test.py import mock def exc(): print 'here should raise' <|fim_middle|>def recursion(): try...
code_fim
medium
{ "lang": "python", "repo": "EuKudryashova/interrupt", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def test_recursion(): global exc exc = mock.Mock(side_effect = [StandardError, StandardError, mock.DEFAULT]) recursion() test_recursion()<|fim_prefix|># repo: EuKudryashova/interrupt path: /test.py import mock def exc(): print 'here should raise' def recursion(): <|fim_middle|> try:...
code_fim
medium
{ "lang": "python", "repo": "EuKudryashova/interrupt", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Customer', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', models.DateTimeField(verbose_name=...
code_fim
hard
{ "lang": "python", "repo": "SamuelDauzon/Improllow-up", "path": "/customers/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ] operations = [ migrations.CreateModel( name='Customer', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('created', models.DateTimeField(verbose_name...
code_fim
hard
{ "lang": "python", "repo": "SamuelDauzon/Improllow-up", "path": "/customers/migrations/0001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SamuelDauzon/Improllow-up path: /customers/migrations/0001_initial.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations <|fim_suffix|> operations = [ migrations.CreateModel( name='Customer', fields=[ ...
code_fim
hard
{ "lang": "python", "repo": "SamuelDauzon/Improllow-up", "path": "/customers/migrations/0001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Barsom/my-first-blog path: /home/migrations/0011_auto_20170512_2248.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2017-05-12 20:48 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> dependencies...
code_fim
medium
{ "lang": "python", "repo": "Barsom/my-first-blog", "path": "/home/migrations/0011_auto_20170512_2248.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='classroom', name='subject5teacher', field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, related_name='+', to='home.Teacher', verbose_name='Chemistry'), ), ]<|f...
code_fim
medium
{ "lang": "python", "repo": "Barsom/my-first-blog", "path": "/home/migrations/0011_auto_20170512_2248.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> yolo.getObject(frame, labelWant="", drawBox=True, bold=1, textsize=0.6, bcolor=(0,0,255), tcolor=(255,255,255)) print ("Object counts:", yolo.objCounts) cv2.imshow("Frame", imutils.resize(frame, width=850)) if(video_out!=""): out.write(frame) k = cv2.wa...
code_fim
hard
{ "lang": "python", "repo": "cflin-cjcu/mytools", "path": "/yolo/tutorial_pydarknet.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cflin-cjcu/mytools path: /yolo/tutorial_pydarknet.py from yoloPydarknet import pydarknetYOLO import cv2 import imutils import time yolo = pydarknetYOLO(obdata="../darknet/cfg/coco.data", weights="yolov3.weights", cfg="../darknet/cfg/yolov3.cfg") video_out = "yolo_output.avi" <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "cflin-cjcu/mytools", "path": "/yolo/tutorial_pydarknet.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeuralEnsemble/python-neo path: /neo/test/iotest/test_exampleio.py """ Tests of neo.io.exampleio """ import pathlib import unittest from neo.io.exampleio import ExampleIO # , HAVE_SCIPY from neo.test.iotest.common_io_test import BaseTestIO from neo.test.iotest.tools import get_test_file_full_p...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/test/iotest/test_exampleio.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_read_block(self): r = ExampleIO(filename=None) bl = r.read_block(lazy=True) #assert len(bl.list_units) == 3 #assert len(bl.channel_indexes) == 1 + 1 # signals grouped + units grouped def test_read_segment_with_time_slice(self): r = ExampleIO(filen...
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/test/iotest/test_exampleio.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert spikes_full.size > spikes_slice.size assert np.all(spikes_slice >= t_start) assert np.all(spikes_slice <= t_stop) assert spikes_slice.t_start == t_start assert spikes_slice.t_stop == t_stop assert event_full.size > event_slice.size assert np....
code_fim
hard
{ "lang": "python", "repo": "NeuralEnsemble/python-neo", "path": "/neo/test/iotest/test_exampleio.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: iddoberger/python3_exceptions path: /exceptions_tree.py from graphviz import Digraph dot = Digraph() dot.edge("BaseException", "SystemExit") dot.edge("BaseException", "KeyboardInterrupt") dot.edge("BaseException", "GeneratorExit") dot.edge("BaseException", "Exception") dot.edge("Exception", "St...
code_fim
hard
{ "lang": "python", "repo": "iddoberger/python3_exceptions", "path": "/exceptions_tree.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e("ConnectionError", "ConnectionAbortedError") dot.edge("ConnectionError", "ConnectionRefusedError") dot.edge("ConnectionError", "ConnectionResetError") dot.edge("OSError", "FileExistsError") dot.edge("OSError", "FileNotFoundError") dot.edge("OSError", "InterruptedError") dot.edge("OSError", "IsADirectory...
code_fim
hard
{ "lang": "python", "repo": "iddoberger/python3_exceptions", "path": "/exceptions_tree.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input_items = ['orgoccupancycount', 'occupancycount'], factor = 2, output_items = ['adjusted_orgoccupancycount', 'adjusted_occupancycount'] ) df = fn.execute_local_test(db=db, db_schema=db_schema, generate_days=1,to_csv=True) print(df)<|fim_prefix|># repo: prasanthgelli/analytics...
code_fim
hard
{ "lang": "python", "repo": "prasanthgelli/analytics_service", "path": "/scripts/local_test_of_function.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prasanthgelli/analytics_service path: /scripts/local_test_of_function.py import datetime as dt import json import pandas as pd import numpy as np from sqlalchemy import Column, Integer, String, Float, DateTime, Boolean, func from iotfunctions.base import BaseTransformer from iotfunctions.metadata...
code_fim
hard
{ "lang": "python", "repo": "prasanthgelli/analytics_service", "path": "/scripts/local_test_of_function.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from custom.multiplybyfactor import MultiplyByFactor fn = MultiplyByFactor( input_items = ['orgoccupancycount', 'occupancycount'], factor = 2, output_items = ['adjusted_orgoccupancycount', 'adjusted_occupancycount'] ) df = fn.execute_local_test(db=db, db_schema=db_schema, generat...
code_fim
medium
{ "lang": "python", "repo": "prasanthgelli/analytics_service", "path": "/scripts/local_test_of_function.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jakecerwin/I3 path: /parse_stream.py from kafka import KafkaConsumer import csv users = set() # returns string of title given a ConsumerRecord def parse_cr(cr): binary = cr.value string = binary.decode('utf-8') # [time, user id, GET request] return string.split(',') # returns ...
code_fim
hard
{ "lang": "python", "repo": "jakecerwin/I3", "path": "/parse_stream.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else: popularity[title] = 1 dates.add(date) return popularity def gather_titles(): consumer = KafkaConsumer( 'movielog', bootstrap_servers=['localhost:9092'], auto_offset_reset='earliest', group_id='jcerwin-new', e...
code_fim
hard
{ "lang": "python", "repo": "jakecerwin/I3", "path": "/parse_stream.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PulakMajumdar81/Daily-DSA-prep path: /reversePolishNotation.py class Solution: def evalRPN(self, tokens: List[str]) -> int: def operation(op1,op2,op): <|fim_suffix|> stack = [] for char in tokens: if char in ["+", "-", "*", "/"]: op2 = ...
code_fim
hard
{ "lang": "python", "repo": "PulakMajumdar81/Daily-DSA-prep", "path": "/reversePolishNotation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stack = [] for char in tokens: if char in ["+", "-", "*", "/"]: op2 = stack.pop() op1 = stack.pop() res = operation(op1,op2,char) stack.append(int(res)) else: stack.append(int(ch...
code_fim
hard
{ "lang": "python", "repo": "PulakMajumdar81/Daily-DSA-prep", "path": "/reversePolishNotation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (not numpy.isnan(result[1])) and result[1] < 10000: rmean = result[1] else: rmean = 0.0 if (not numpy.isnan(result[2])) and result[1] < 10000: rmedian = result[2] else: rmedian = 0.0 tc_means.append(rmean) tc_medians.append(rmedian) ofi...
code_fim
hard
{ "lang": "python", "repo": "Ada520/Topic-Distance-and-Coherence", "path": "/coh_wn_random.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>tc = WordNetEvaluator() tc_means = [] tc_medians = [] words_list = [] ofilemean = open(dname + "/"+tcmethod+"_mean_rand_"+str(word_count)+".txt", "w") ofilemedian = open(dname + "/"+tcmethod+"_median_rand_"+str(word_count)+".txt", "w") if ic: if dname == "reuters_LDA": src_ic = wn.ic(reuter...
code_fim
hard
{ "lang": "python", "repo": "Ada520/Topic-Distance-and-Coherence", "path": "/coh_wn_random.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JayjeetAtGithub/spack path: /var/spack/repos/builtin/packages/r-dt/package.py # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package im...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/r-dt/package.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Data objects in R can be rendered as HTML tables using the JavaScript library 'DataTables' (typically via R Markdown or Shiny). The 'DataTables' library has been included in this R package. The package name 'DT' is an abbreviation of 'DataTables'.""" cran = "DT" version("0.23", s...
code_fim
medium
{ "lang": "python", "repo": "JayjeetAtGithub/spack", "path": "/var/spack/repos/builtin/packages/r-dt/package.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure/azure-cli path: /src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/gallery_application/version/_show.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/gallery_application/version/_show.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def url(self): return self.client.format_url( "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Compute/galleries/{galleryName}/applications/{galleryApplicationName}/versions/{galleryApplicationVersionName}", ...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/gallery_application/version/_show.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cls._schema_on_200 = AAZObjectType() _schema_on_200 = cls._schema_on_200 _schema_on_200.id = AAZStrType( flags={"read_only": True}, ) _schema_on_200.location = AAZStrType( flags={"required": True}, ) ...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/vm/aaz/latest/sig/gallery_application/version/_show.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> moduleRef = f"{bRep}{org}/{repo}{relative}" if moduleRef in self.seen: return True if org is None or repo is None: relativeBare = relative.removeprefix("/") repoLocation = relativeBare mLocations.append(relativeBare) (com...
code_fim
hard
{ "lang": "python", "repo": "annotation/text-fabric", "path": "/tf/advanced/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: annotation/text-fabric path: /tf/advanced/data.py from ..core.helpers import itemize from ..core.files import backendRep, expandDir, prefixSlash, normpath from .helpers import splitModRef from .repo import checkoutRepo from .links import provenanceLink # GET DATA FOR MAIN SOURCE AND ALL MODULES...
code_fim
hard
{ "lang": "python", "repo": "annotation/text-fabric", "path": "/tf/advanced/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> seen.add(moduleRef) if isBase: app.repoLocation = repoLocation info = {} for item in ( ("doi", None), ("corpus", f"{org}/{repo}{relative}"), ): (key, default) = item info[key] = ( getattr(a...
code_fim
hard
{ "lang": "python", "repo": "annotation/text-fabric", "path": "/tf/advanced/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> diffusion_flux, field, prefactor, ): # define kernel support for kernel diffusion_flux_pyst_mpi_kernel_2d.kernel_support = ( gen_diffusion_flux_pyst_mpi_kernel_2d.kernel_support ) # define variable for use later ghost_size = g...
code_fim
hard
{ "lang": "python", "repo": "fankiat/sopht-mpi", "path": "/sopht_mpi/numeric/eulerian_grid_ops/stencil_ops_2d/diffusion_flux_mpi_2d.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fankiat/sopht-mpi path: /sopht_mpi/numeric/eulerian_grid_ops/stencil_ops_2d/diffusion_flux_mpi_2d.py """MPI-supported kernels for computing diffusion flux in 2D.""" from sopht.numeric.eulerian_grid_ops.stencil_ops_2d import ( gen_diffusion_flux_pyst_kernel_2d, gen_set_fixed_val_pyst_kerne...
code_fim
hard
{ "lang": "python", "repo": "fankiat/sopht-mpi", "path": "/sopht_mpi/numeric/eulerian_grid_ops/stencil_ops_2d/diffusion_flux_mpi_2d.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.options=forcebalance.parser.gen_opts_defaults.copy() self.options.update({ 'root': os.getcwd() + '/test/files', 'penalty_additive': 0.01, 'jobtype': 'NEWTON', 'forcefield': ['cc-pvdz-overlap-original.gbs']}) os.ch...
code_fim
hard
{ "lang": "python", "repo": "yudongqiu/forcebalance", "path": "/src/tests/test_objective.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yudongqiu/forcebalance path: /src/tests/test_objective.py from __future__ import absolute_import from builtins import str from builtins import object import unittest import sys, os, re import forcebalance import abc import numpy from __init__ import ForceBalanceTestCase class TestImplemented(For...
code_fim
hard
{ "lang": "python", "repo": "yudongqiu/forcebalance", "path": "/src/tests/test_objective.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^doc_u/', schema_view), url(r'^', include('o.urls', )), url(r'^api/', include('restapi.urls', namespace='res')), ]<|fim_prefix|># repo: cucy/2017 path: /django rest api 示例6 高级封装 view set/zrddjangol/zrddjangol/urls.py from django.con...
code_fim
medium
{ "lang": "python", "repo": "cucy/2017", "path": "/django rest api 示例6 高级封装 view set/zrddjangol/zrddjangol/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cucy/2017 path: /django rest api 示例6 高级封装 view set/zrddjangol/zrddjangol/urls.py from django.conf.urls import url, include from django.contrib import admin <|fim_suffix|>urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^doc_u/', schema_view), url(r'^', include('o.urls', )), ...
code_fim
medium
{ "lang": "python", "repo": "cucy/2017", "path": "/django rest api 示例6 高级封装 view set/zrddjangol/zrddjangol/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> training_set_inputs = array( [ [normalized_set['input1'][0], normalized_set['input2'][0], normalized_set['input3'][0]], [normalized_set['input1'][1], normalized_set['input2'][1], normalized_set['input3'][1]], [normalized_set['input1'][2], normalized_set['inp...
code_fim
hard
{ "lang": "python", "repo": "careywadawi/ANN-AI", "path": "/neural_network.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: careywadawi/ANN-AI path: /neural_network.py from numpy import exp, array, dot from read import normalized class NeuralNetwork(): def __init__(self, layer1, layer2): self.layer1 = layer1 self.layer2 = layer2 def __sigmoid(self, x): return 1 / (1 + exp(-x)) d...
code_fim
hard
{ "lang": "python", "repo": "careywadawi/ANN-AI", "path": "/neural_network.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> layer2 = array([[0.5, 0.1]]).T neural_network = NeuralNetwork(layer1, layer2) neural_network.print_weights() training_set_inputs = array( [ [normalized_set['input1'][0], normalized_set['input2'][0], normalized_set['input3'][0]], [normalized_set['input1'][...
code_fim
hard
{ "lang": "python", "repo": "careywadawi/ANN-AI", "path": "/neural_network.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def createHypenEmbed(word): ''' Handle outlier language with hyphen ''' word_whole = re.sub('-', '', word) if word_whole in word_dict: return [word_dict[word_whole]] else: # [TODO] should the hyphenated word be # split into two words or kept as an ...
code_fim
hard
{ "lang": "python", "repo": "catli/seinfeld-attention", "path": "/seq2seq/process_data.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: catli/seinfeld-attention path: /seq2seq/process_data.py ''' Create a dictionary of fasttext embedding, stored locally fasttext import. This will hopefully make it easier to load and train data. This will also be used to store the Steps to clean scripts (codify): 1) ...
code_fim
hard
{ "lang": "python", "repo": "catli/seinfeld-attention", "path": "/seq2seq/process_data.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def hello_http(request): request_args = request.args #'words', 'lang-from', 'lang-to', 'by', 'reverse' if request_args and 'words' in request_args: words = json.loads(request_args['words']) if isinstance(words, list) and len(words) > 0: target = request_args.get('...
code_fim
hard
{ "lang": "python", "repo": "littealeaf28/flashcard-abc", "path": "/python/src/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #'words', 'lang-from', 'lang-to', 'by', 'reverse' if request_args and 'words' in request_args: words = json.loads(request_args['words']) if isinstance(words, list) and len(words) > 0: target = request_args.get('target', 'es') by_str = request_args.get('by',...
code_fim
medium
{ "lang": "python", "repo": "littealeaf28/flashcard-abc", "path": "/python/src/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: littealeaf28/flashcard-abc path: /python/src/main.py from flask import escape import pandas as pd import json import requests with open('result.csv', newline='') as f: df = pd.read_csv(f) def get_level_diff(word, only_common=False): if only_common: word_df = df[(df['word']==word...
code_fim
medium
{ "lang": "python", "repo": "littealeaf28/flashcard-abc", "path": "/python/src/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='N_lostandfound', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('date', models.DateTimeField(auto_now_add=True)), (...
code_fim
hard
{ "lang": "python", "repo": "onthir/warhawks", "path": "/notification/migrations/0003_n_lostandfound.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: onthir/warhawks path: /notification/migrations/0003_n_lostandfound.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2018-06-07 12:30 from __future__ import unicode_literals from django.conf import settings from django.db import migrations, models import django.db.models.deletion <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "onthir/warhawks", "path": "/notification/migrations/0003_n_lostandfound.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: monntauk/proyecto path: /Entrega3/MiProyecto/core/forms.py from django import forms from django.forms import ModelForm from .models import Noticia <|fim_suffix|> class Meta: model = Noticia fields = ['idNoticia','resumen','titulo','categoria']<|fim_middle|>class NoticiaForm(Mo...
code_fim
easy
{ "lang": "python", "repo": "monntauk/proyecto", "path": "/Entrega3/MiProyecto/core/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> model = Noticia fields = ['idNoticia','resumen','titulo','categoria']<|fim_prefix|># repo: monntauk/proyecto path: /Entrega3/MiProyecto/core/forms.py from django import forms from django.forms import ModelForm from .models import Noticia class NoticiaForm(ModelForm): <|fim_middle|> cl...
code_fim
easy
{ "lang": "python", "repo": "monntauk/proyecto", "path": "/Entrega3/MiProyecto/core/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def productExceptSelf(self, nums: List[int]) -> List[int]: output = [] prod = 1 # First generate the products to the left of the current element for num in nums: output.append(prod) prod *= num prod = 1 # Now, generate and multip...
code_fim
medium
{ "lang": "python", "repo": "abhijitdey/coding-practice", "path": "/facebook/arrays_and_strings/14_product_of_array_except_self.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhijitdey/coding-practice path: /facebook/arrays_and_strings/14_product_of_array_except_self.py from typing import List """ 1. Generate an array containing the products of all elements to the left of current element 2. Similarly, start from the last element and generate an array containing the ...
code_fim
medium
{ "lang": "python", "repo": "abhijitdey/coding-practice", "path": "/facebook/arrays_and_strings/14_product_of_array_except_self.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> prod = 1 # Now, generate and multiply the product to the right of current element for k in range(len(nums) - 1, -1, -1): output[k] = output[k] * prod prod *= nums[k] return output<|fim_prefix|># repo: abhijitdey/coding-practice path: /facebook/arra...
code_fim
hard
{ "lang": "python", "repo": "abhijitdey/coding-practice", "path": "/facebook/arrays_and_strings/14_product_of_array_except_self.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vanderson-henrique/trybe-exercises path: /COMPUTER-SCIENCE/BLOCO_39/39_3/conteudo/exercicio1.py ''' Exercício 1: Estenda a classe Stack , que escrevemos durante as explicações do conteúdo, adicionando uma nova função chamada min_value() que irá retornar o menor valor inteiro presente na pilha. ''...
code_fim
hard
{ "lang": "python", "repo": "vanderson-henrique/trybe-exercises", "path": "/COMPUTER-SCIENCE/BLOCO_39/39_3/conteudo/exercicio1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> content_stack = Other_Operations_Stack() content_stack.push(1) content_stack.push(-2) content_stack.push(3) print(content_stack.min_value()) # saída: -2<|fim_prefix|># repo: vanderson-henrique/trybe-exercises path: /COMPUTER-SCIENCE/BLOCO_39/39_3/conteudo/exercicio1.py ''' Exercício 1: Estenda a classe...
code_fim
medium
{ "lang": "python", "repo": "vanderson-henrique/trybe-exercises", "path": "/COMPUTER-SCIENCE/BLOCO_39/39_3/conteudo/exercicio1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoOkuma/torch-em path: /experiments/mito-em/prepare_train_data.py import os import z5py from shutil import copytree, copyfile ROOT = '/g/kreshuk/pape/Work/data/mito_em/data' SCRATCH = '/scratch/pape/mito_em/data' def create_file(out_path, ref_path): os.makedirs(out_path, exist_ok=True) ...
code_fim
hard
{ "lang": "python", "repo": "JoOkuma/torch-em", "path": "/experiments/mito-em/prepare_train_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }