text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: gluo7777/MyTools path: /cli/scripts/client.py from cli.scripts.config import Properties import requests class Client: TIMEOUT = 'timeout' DEFAULT_TIMEOUT = 10 def __init__(self, props: Properties): super().__init__() self.props = props self.base = 'http://l...
code_fim
hard
{ "lang": "python", "repo": "gluo7777/MyTools", "path": "/cli/scripts/client.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PMEAL/porespy path: /porespy/filters/__init__.py r""" Collection of functions for altering images based on structural properties ########################################################################## This module contains a variety of functions for altering images based on the structural cha...
code_fim
medium
{ "lang": "python", "repo": "PMEAL/porespy", "path": "/porespy/filters/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.. autosummary:: :template: mybase.rst :toctree: generated/ filters.apply_chords filters.apply_chords_3D filters.apply_padded filters.chunked_func filters.distance_transform_lin filters.fftmorphology filters.fill_blind_pores filters.find_disconnected_voxels filte...
code_fim
medium
{ "lang": "python", "repo": "PMEAL/porespy", "path": "/porespy/filters/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>eukaryotes = eukaryotes.iloc[1:201,:] mammals = mammals.iloc[1:201,:] pp = pd.merge(mammals, eukaryotes, on=["gene", "protein2"], how="outer") pp.fillna(0, inplace=True) pp["PP"] = pp.apply(lambda x: max(x["PP_eukaryotes"], x["PP_mammals"]), axis=1) mecp2_links = pd.merge(mecp2_links, pp[["gene", "protein...
code_fim
hard
{ "lang": "python", "repo": "GuIrene/MECP2_phylogeny", "path": "/string_overlap_analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuIrene/MECP2_phylogeny path: /string_overlap_analysis.py import gzip import numpy as np import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import upsetplot #%% data_dir = "/Users/ireneu/berman_lab/Rett/revisions/string_data/" #load data with gzip.open(data_dir+"9606.prote...
code_fim
hard
{ "lang": "python", "repo": "GuIrene/MECP2_phylogeny", "path": "/string_overlap_analysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#%% eukaryotes.columns = ["gene", "PP_eukaryotes", "protein2"] mammals.columns = ["gene", "PP_mammals", "protein2"] eukaryotes = eukaryotes.iloc[1:201,:] mammals = mammals.iloc[1:201,:] pp = pd.merge(mammals, eukaryotes, on=["gene", "protein2"], how="outer") pp.fillna(0, inplace=True) pp["PP"] = pp.apply...
code_fim
hard
{ "lang": "python", "repo": "GuIrene/MECP2_phylogeny", "path": "/string_overlap_analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> y = j*10 + yyy*10 yy = y+10 tagg = str(x) + "-" + str(y) if self.clipboard[i][j] == 1: if self.shapeCells == "square": self.canvas.create_rectangle(x+1, y+1, xx-1, yy-1, ...
code_fim
hard
{ "lang": "python", "repo": "touatily/Game-of-Life-Visualizer", "path": "/window.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: touatily/Game-of-Life-Visualizer path: /window.py rd is None: self.escape(e) return x, y = e.x-e.x % 10, e.y-e.y % 10 x = min(max(0, x), self.canvas.winfo_width()) y = min(max(0, y), self.canvas.winfo_height()) xxx = x // 10 yyy = y...
code_fim
hard
{ "lang": "python", "repo": "touatily/Game-of-Life-Visualizer", "path": "/window.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def saveZonePS(self, e): x, y = e.x - e.x % 10, e.y - e.y % 10 x = min(max(0, x), self.canvas.winfo_width()) y = min(max(0, y), self.canvas.winfo_height()) w, h = abs(self.x-x), abs(self.y-y) x, y = min(self.x, x), min(self.y, y) self.escape(e) ...
code_fim
hard
{ "lang": "python", "repo": "touatily/Game-of-Life-Visualizer", "path": "/window.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': for extension in extensions: bot.load_extension(extension) bot.run(TOKEN)<|fim_prefix|># repo: Vincentqchen/yeeb path: /src/bot.py import sys sys.path.append("../discord.py/") import discord from discord.ext import commands with open("../res/token.txt", "r") a...
code_fim
medium
{ "lang": "python", "repo": "Vincentqchen/yeeb", "path": "/src/bot.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vincentqchen/yeeb path: /src/bot.py import sys sys.path.append("../discord.py/") import discord from discord.ext import commands <|fim_suffix|>if __name__ == '__main__': for extension in extensions: bot.load_extension(extension) bot.run(TOKEN)<|fim_middle|> with open("../res/toke...
code_fim
medium
{ "lang": "python", "repo": "Vincentqchen/yeeb", "path": "/src/bot.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: takabayashi/determined path: /harness/determined/pytorch/_pytorch_trial.py ing.") elif self.n_gpus > 1: check.eq( self.hvd_config.aggregation_frequency, 1, "Please enable `optimized_parallel` to use aggregation " ...
code_fim
hard
{ "lang": "python", "repo": "takabayashi/determined", "path": "/harness/determined/pytorch/_pytorch_trial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: takabayashi/determined path: /harness/determined/pytorch/_pytorch_trial.py hTrialController needs an PyTorchTrial") self.trial = cast(PyTorchTrial, trial_inst) self._check_evaluate_implementation() self.model = self.trial.build_model() # Validation loader will be...
code_fim
hard
{ "lang": "python", "repo": "takabayashi/determined", "path": "/harness/determined/pytorch/_pytorch_trial.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return True @staticmethod def supports_averaging_training_metrics() -> bool: return True def _set_data_loaders(self) -> None: skip_batches = (self.env.first_step() - 1) * self.batches_per_step nreplicas = hvd.size() if self.hvd_config.use else 1 rank ...
code_fim
hard
{ "lang": "python", "repo": "takabayashi/determined", "path": "/harness/determined/pytorch/_pytorch_trial.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: l-vo/photos-picker path: /photospicker/picker/abstract_picker.py from abc import ABCMeta, abstractmethod from photospicker.event.scan_progress_event import ScanProgressEvent from zope import event from photospicker.exception.picker_exception import PickerException import os import fnmatch import ...
code_fim
hard
{ "lang": "python", "repo": "l-vo/photos-picker", "path": "/photospicker/picker/abstract_picker.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def scan(self): """Scan the given path for building picked file paths list""" picker_photos = self._order_picked(self._scan()) self._picked_file_paths = [ picker_photo.filepath for picker_photo in picker_photos ] def _order_picked(self, picked): ...
code_fim
hard
{ "lang": "python", "repo": "l-vo/photos-picker", "path": "/photospicker/picker/abstract_picker.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dst = int(self.data['d'], 2) self.put(src1 + src2, dst) class Instruction_EB(CR_Instruction): opcode = '10' func4 = '1001' name = 'EB' def extra_constraints(self, data, bitstream): if data['d'] != '00000': raise ParseError('Expected dst to be 0') ...
code_fim
hard
{ "lang": "python", "repo": "angr/angr-platforms", "path": "/angr_platforms/risc_v/instrs_riscv/cr_instr.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: angr/angr-platforms path: /angr_platforms/risc_v/instrs_riscv/cr_instr.py # pylint: disable=W0613,R0201,W0221,W0223 from .instruction_patterns import CR_Instruction from pyvex.lifting.util import Type, ParseError class Instruction_CJR(CR_Instruction): opcode = '10' func4 = '1000' nam...
code_fim
hard
{ "lang": "python", "repo": "angr/angr-platforms", "path": "/angr_platforms/risc_v/instrs_riscv/cr_instr.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: obijywk/grilops path: /examples/outflight_entertainment.py """Solver for the sudoku variant in Outflight Entertainment. Based on "Outflight Entertainment" from the Puzzlehunt CMU Spring 2020 hunt. https://puzzlehunt.club.cc.cmu.edu/puzzle/11030/ """ from z3 import Distinct, Implies import gril...
code_fim
hard
{ "lang": "python", "repo": "obijywk/grilops", "path": "/examples/outflight_entertainment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rc = grilops.regions.RegionConstrainer(lattice, sg.solver) for y, x in lattice.points: sg.solver.add( rc.region_id_grid[(y, x)] == cage_label_to_region_id[cages[y][x]]) # Within each region, a parent cell must have a greater value than a child # cell, so that the values increase as yo...
code_fim
hard
{ "lang": "python", "repo": "obijywk/grilops", "path": "/examples/outflight_entertainment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>L = np.array([[2 if i == j else (-1 if (i == j - 1 or i == j + 1) else 0) for j in range(10)] for i in range(10)]) print(L) print("\nQuestion 5\n") T = np.array([[1 if ((i + j) % 2 == 0) else 0 for j in range(10)] for i in range(10)]) print(T)<|fim_prefix|># repo: emilienlemaire/DL2MI_TP path: /Math2...
code_fim
hard
{ "lang": "python", "repo": "emilienlemaire/DL2MI_TP", "path": "/Math208_Python/TP2/TP2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emilienlemaire/DL2MI_TP path: /Math208_Python/TP2/TP2.py import numpy as np np.array([1, 2]) # Exercice 2.3 print("Question 1 \n") A, x = np.array([[1, 2, 3], [4, 5, 6]]), np.array([1, 2, 3]) print(A.shape, x.shape) print(A.size, x.size) print(A.ndim, x.ndim) print(A.dtype, x.dtype) print(A....
code_fim
hard
{ "lang": "python", "repo": "emilienlemaire/DL2MI_TP", "path": "/Math208_Python/TP2/TP2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#"+" operator print("calculating 'hi' + 'hi' = ", "hi" + "hi") print("calculating 3.0 + 3.0 = ", 3.0+3.0) print("calculating (1+2j) + (2+3j) = ", (1+2j) + (2+3j)) print() print("calculating 3.0 - 3.0 = ", 3.0-3.0) print("calculating (1-2j) - (2-3j) = ", (1-2j) - (2-3j)) print() print("calculating 3.0 / ...
code_fim
medium
{ "lang": "python", "repo": "pbarton666/virtual_classroom", "path": "/dkr-py310/docker-student-portal-310/course_files/begin_advanced/solution_python1_chapter02_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pbarton666/virtual_classroom path: /dkr-py310/docker-student-portal-310/course_files/begin_advanced/solution_python1_chapter02_operations.py #solution_python1_chapter02_operations.py """A solution to Chapter 2""" #help on the modulo operator (help() already prints help(int.__mod__) #how many f...
code_fim
medium
{ "lang": "python", "repo": "pbarton666/virtual_classroom", "path": "/dkr-py310/docker-student-portal-310/course_files/begin_advanced/solution_python1_chapter02_operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Note the use of \ below. This allows line continuation. summary= "So your name is " + name + ", " \ "you are a " + sign + ", " \ "and you like to drink " + fav_bev+ ". " \ "Right? " answer= input(summary) print("You said " + answer + ". Awesome!")<|fim_prefix|># repo: pbarton666/virtual_classr...
code_fim
hard
{ "lang": "python", "repo": "pbarton666/virtual_classroom", "path": "/dkr-py310/docker-student-portal-310/course_files/begin_advanced/solution_python1_chapter02_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print(type(header)) global headers global idnum idnum+=1 header.id=idnum #print(header.name) if isfactor(header.factor): nheader=iffactor(header.factor) header.addfchild(nheader) visitfactor(nheader) headers.append(nheader) # 进入并执行新建的节点 ...
code_fim
hard
{ "lang": "python", "repo": "FeiWANG-SJTU/DNAcompiler", "path": "/d_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #print(type(header)) global headers global idnum idnum+=1 header.id=idnum #print('header.factor',header.factor) if isterm(header.term): nheader=ifterm(header.term) header.addtchild(nheader) visitterm(nheader) headers.append(nheader) # 进入并执行新建...
code_fim
hard
{ "lang": "python", "repo": "FeiWANG-SJTU/DNAcompiler", "path": "/d_parser.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FeiWANG-SJTU/DNAcompiler path: /d_parser.py #function : construct syntax tree from tokens # input: token list # output: syntaxtree # by OL Jan.7, 2016 import d_ast1 headers=[] idnum=0 #build the corresponding node 建立对应的节点 def ifif(tokens):#for an if expr, create if node .如果是if语句,则创建if节点 #prin...
code_fim
hard
{ "lang": "python", "repo": "FeiWANG-SJTU/DNAcompiler", "path": "/d_parser.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#java -jar tika-server-1.22.jar --port 8001 #to start the server on port 8001 #'http://localhost:8001' origin server code fs = os.listdir('pdfs/') #list files in specified directory in a list root = 'pdfs/' fs = [f for f in fs if os.path.join(root, f) and (str(f).endswith('.pdf') or str(f).e...
code_fim
medium
{ "lang": "python", "repo": "phynicz/Pylucene-Search-Engine", "path": "/extract.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>root = 'pdfs/' fs = [f for f in fs if os.path.join(root, f) and (str(f).endswith('.pdf') or str(f).endswith('.docx') or str(f).endswith('.pptx') or str(f).endswith('.doc') or str(f).endswith('.html') )] #using list comprehension to iterate through pdf and docx files start = datetime.now() for f in fs:...
code_fim
medium
{ "lang": "python", "repo": "phynicz/Pylucene-Search-Engine", "path": "/extract.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: phynicz/Pylucene-Search-Engine path: /extract.py #!/usr/bin/env python import os import tika import shutil import time from tika import parser tika.TikaClientOnly = True from datetime import datetime headers = { 'X-Tika-PDFextractInlineImages': 'true', } <|fim_suffix|>fs = [f for f in fs if os....
code_fim
hard
{ "lang": "python", "repo": "phynicz/Pylucene-Search-Engine", "path": "/extract.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>LOOPS = 2 with open(sys.argv[1]) as reader: records = avro_reader(reader) SCHEMA = records.schema RECORDS = list(records) buf = BytesIO() m = 0 n = 0 start = time() for _ in repeat(None, LOOPS): for record in RECORDS: dump(buf, record, SCHEMA) m += buf.tell() n += 1 buf.seek(0) i...
code_fim
medium
{ "lang": "python", "repo": "mtth/avsc", "path": "/etc/benchmarks/avro-serialization-implementations/scripts/encode/python-fastavro.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mtth/avsc path: /etc/benchmarks/avro-serialization-implementations/scripts/encode/python-fastavro.py #!/usr/bin/env python2.7 # encoding: utf-8 """Fastavro.""" from io import BytesIO from itertools import repeat from time import time from fastavro import dump, load, acquaint_schema, reader as a...
code_fim
medium
{ "lang": "python", "repo": "mtth/avsc", "path": "/etc/benchmarks/avro-serialization-implementations/scripts/encode/python-fastavro.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>logger.error("error inner lib") # logging.info("error inner lib") logging.critical("error inner lib") # logging.debug("error inner lib") # logger = logging.getLogger(__name__)<|fim_prefix|># repo: Sean10/Algorithm_code path: /logger/logger_module/s_logger.py #!/usr/bin/env python # -*- coding: utf-8 -*- ...
code_fim
hard
{ "lang": "python", "repo": "Sean10/Algorithm_code", "path": "/logger/logger_module/s_logger.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sean10/Algorithm_code path: /logger/logger_module/s_logger.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2019-10-13 21:46 # @Author : sean10 # @Site : # @File : s_logger.py # @Software: PyCharm <|fim_suffix|>logger.error("error inner lib") # logging.info("error inner lib"...
code_fim
hard
{ "lang": "python", "repo": "Sean10/Algorithm_code", "path": "/logger/logger_module/s_logger.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Good Creation itr_resp = admin_client.create( itr_uri, name='test_iterable', attributes={'test1': 'foo'}, min_val=100, max_val=200, increment=1, ) itr = get_result(itr_resp) itr_obj_url = site.detail_uri('iterable', id=itr['id']) ass...
code_fim
hard
{ "lang": "python", "repo": "dirtyonekanobi/nsot", "path": "/tests/api_tests/test_iterables.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dirtyonekanobi/nsot path: /tests/api_tests/test_iterables.py # -*- coding: utf-8 -*- from __future__ import unicode_literals import pytest # Allow everything in there to access the DB pytestmark = pytest.mark.django_db import copy from django.core.urlresolvers import reverse import json import...
code_fim
medium
{ "lang": "python", "repo": "dirtyonekanobi/nsot", "path": "/tests/api_tests/test_iterables.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/libcloud path: /libcloud/test/dns/test_luadns.py # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file t...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/test/dns/test_luadns.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _v1_zones_11_records_LIST_RECORDS_SUCCESS(self, method, url, body, headers): body = self.fixtures.load("records_list.json") return httplib.OK, body, {}, httplib.responses[httplib.OK] def _v1_zones_31_records_31_GET_RECORD_RECORD_DOES_NOT_EXIST(self, method, url, body, headers...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/test/dns/test_luadns.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _v1_zones_EMPTY_ZONES_LIST(self, method, url, body, headers): body = self.fixtures.load("empty_zones_list.json") return httplib.OK, body, {}, httplib.responses[httplib.OK] def _v1_zones_13_ZONE_DOES_NOT_EXIST(self, method, url, body, headers): body = self.fixtures.loa...
code_fim
hard
{ "lang": "python", "repo": "apache/libcloud", "path": "/libcloud/test/dns/test_luadns.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print(ct) strain_names.close() fasta_file_fixed.close() fasta_file.close()<|fim_prefix|># repo: dunhamlab/SUL1_natural_variants path: /generate_fasta_references/rename_fasta.py # adds strain name to fasta files fasta_file = open("../SUL1_CDS.fasta","r") fasta_file_fixed = open("../SUL1_ext_full_CDS.fast...
code_fim
hard
{ "lang": "python", "repo": "dunhamlab/SUL1_natural_variants", "path": "/generate_fasta_references/rename_fasta.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dunhamlab/SUL1_natural_variants path: /generate_fasta_references/rename_fasta.py # adds strain name to fasta files fasta_file = open("../SUL1_CDS.fasta","r") fasta_file_fixed = open("../SUL1_ext_full_CDS.fasta","w+") <|fim_suffix|>names = [] for line in strain_names: line = line.strip() names...
code_fim
medium
{ "lang": "python", "repo": "dunhamlab/SUL1_natural_variants", "path": "/generate_fasta_references/rename_fasta.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Sources: {retrieved} Answer: """ def __init__(self, search_client: SearchClient, openai_deployment: str, sourcepage_field: str, content_field: str): self.search_client = search_client self.openai_deployment = openai_deployment self.sourcepage_field = sourcepage_field ...
code_fim
hard
{ "lang": "python", "repo": "uipathsmartbridge/uipath", "path": "/app/backend/approaches/retrievethenread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: uipathsmartbridge/uipath path: /app/backend/approaches/retrievethenread.py import openai from approaches.approach import Approach from azure.search.documents import SearchClient from azure.search.documents.models import QueryType from text import nonewlines from typing import Any class Retrieve...
code_fim
hard
{ "lang": "python", "repo": "uipathsmartbridge/uipath", "path": "/app/backend/approaches/retrievethenread.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, search_client: SearchClient, openai_deployment: str, sourcepage_field: str, content_field: str): self.search_client = search_client self.openai_deployment = openai_deployment self.sourcepage_field = sourcepage_field self.content_field = content_field ...
code_fim
hard
{ "lang": "python", "repo": "uipathsmartbridge/uipath", "path": "/app/backend/approaches/retrievethenread.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train(self): self._setting() self.iter = -1 best_s = 100 for epoch in self.iter_counter.training_epochs(): if self.iter > self.opt.total_step: break for i, data_i in enumerate(self.train_loader): self.iter = ...
code_fim
hard
{ "lang": "python", "repo": "FloatButterfly/SPM", "path": "/train_spm_codec.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FloatButterfly/SPM path: /train_spm_codec.py """ Copyright (C) 2019 NVIDIA Corporation. All rights reserved. Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode). """ import sys import torch from torch.utils.data import DataLoader # from torch...
code_fim
hard
{ "lang": "python", "repo": "FloatButterfly/SPM", "path": "/train_spm_codec.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _init_loaders(self): super(WithTest, self)._init_loaders() test_dataset = TrainPairedData(self.opt.test_dataroot, self.opt) self.test_loader = DataLoader( dataset=test_dataset, batch_size=self.opt.batchSize, sampler=self.data_sampler(test...
code_fim
hard
{ "lang": "python", "repo": "FloatButterfly/SPM", "path": "/train_spm_codec.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.initGypting(mType) if self.exception: return "ERROR" encodedString = "" for n in range(0,len(self.message)): if eD == "egyptIt": index = self.charactersArray.index(self.message[n]) encodedString = encodedString + ...
code_fim
hard
{ "lang": "python", "repo": "marzukr/Egyptinator", "path": "/egyptC0re.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marzukr/Egyptinator path: /egyptC0re.py import collections,sys,hashlib class Processor: charactersArray = [] codeCharactersArray = [] exception = False def __init__(self, key, message): self.key = key self.message = message def repeatable_random(self, seed)...
code_fim
hard
{ "lang": "python", "repo": "marzukr/Egyptinator", "path": "/egyptC0re.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> board.set_cell_by_indexes(1, 0, "First") board.set_cell_by_indexes(2, 0, "Second") board.set_cell_by_indexes(3, 0, "Third") board.set_cell_by_indexes(4, 0, "Fourth") for row in range(1, 5): for col in range(1, 4): if row != col: ...
code_fim
hard
{ "lang": "python", "repo": "OlegBaskov/language-learning", "path": "/tests/test_dashboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: OlegBaskov/language-learning path: /tests/test_dashboard.py import unittest from src.dash_board.textdashboard import TextFileDashboard, TextFileDashboardComponent from src.pipeline.pipelinetree import get_component conf = { "component": "dash-board", "type": "static", "instance-nam...
code_fim
hard
{ "lang": "python", "repo": "OlegBaskov/language-learning", "path": "/tests/test_dashboard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.assertEqual(should_be, board.get_text()) def test_component(self): board = get_component("dash-board", conf["parameters"]) self.assertTrue(True, True) def test_less_headers(self): board = get_component("dash-board", less_headers["parameters"]) self.as...
code_fim
hard
{ "lang": "python", "repo": "OlegBaskov/language-learning", "path": "/tests/test_dashboard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: filename_queue: A tensorflow queue of filename locations. max_quantized_value: the maximum of the quantized value. min_quantized_value: the minimum of the quantized value. Returns: A tuple of video indexes, video features, labels, and padding data. """ reader...
code_fim
hard
{ "lang": "python", "repo": "chintak/youtube-8m", "path": "/readers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, num_classes=4716, feature_sizes=[1024], feature_names=["inc3"], max_frames=300): """Construct a YT8MFrameFeatureReader. Args: num_classes: a positive integer for the number of classes. feature_sizes: posi...
code_fim
hard
{ "lang": "python", "repo": "chintak/youtube-8m", "path": "/readers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chintak/youtube-8m path: /readers.py TIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Provides readers configured for different datasets.""" import tensorflow as tf import numpy as np import u...
code_fim
hard
{ "lang": "python", "repo": "chintak/youtube-8m", "path": "/readers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Boris-Barboris/PySubs path: /game/CameraController.py # Copyright Alexander Baranin 2016 import math import sys import sfml from sfml.system import Vector2 from sfml.window import Keyboard from engine.Reloadable import reloadable _import_modules = ( ('EngineCore', 'engine.EngineCore'),...
code_fim
hard
{ "lang": "python", "repo": "Boris-Barboris/PySubs", "path": "/game/CameraController.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def do_zoom(self, camera, zoom_delta): scale_shift = zoom_delta * (1.0 + camera.scale * 10.0) camera.scale -= scale_shift camera.scale = max(0.05, camera.scale) camera.scale = min(10.0, camera.scale) return scale_shift def handle_click(self, event, wnd): ...
code_fim
hard
{ "lang": "python", "repo": "Boris-Barboris/PySubs", "path": "/game/CameraController.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dt = min(EngineCore.frame_time, 0.1) camera = WorldComposer.composer.camera if Keyboard.is_key_pressed(Keyboard.RIGHT): camera.position += Vector2(KEY_PAN_SPEED, 0.0) * camera.scale * dt if Keyboard.is_key_pressed(Keyboard.UP): camera.position += Vec...
code_fim
hard
{ "lang": "python", "repo": "Boris-Barboris/PySubs", "path": "/game/CameraController.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: HesslerY/loewner path: /main/PythonTools/LoewnerRun.py phi = delta # Decrease end point if final_phi = pi if final_phi == pi: final_phi = final_phi - delta # Discretise the interval from start_phi to final_phi discr_pi = linspace(start_phi,final_phi,s...
code_fim
hard
{ "lang": "python", "repo": "HesslerY/loewner", "path": "/main/PythonTools/LoewnerRun.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Convert the results to a 2D array results_array = column_stack((self.exact_time_sol, self.exact_driving_arr)) # Create a filename for the dat file filename = EXACT_INVERSE_DATA_OUTPUT + self.short_properties_string + DATA_EXT # Save the array...
code_fim
hard
{ "lang": "python", "repo": "HesslerY/loewner", "path": "/main/PythonTools/LoewnerRun.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HesslerY/loewner path: /main/PythonTools/LoewnerRun.py exit() # Import the compiled Inverse Loewner module InverseLoewner = import_module(self.inverse_module_name) # Declare empty arrays for the time and driving function values self.driving_arr = empt...
code_fim
hard
{ "lang": "python", "repo": "HesslerY/loewner", "path": "/main/PythonTools/LoewnerRun.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @register_module_fixer([nn.InstanceNorm1d, nn.InstanceNorm2d, nn.InstanceNorm3d]) def fix(module: INSTANCENORM) -> INSTANCENORM: if len(validate(module)) == 0: return module # else new_module = clone_module(module) new_module.track_running_stats = False return new_module<|fim_...
code_fim
hard
{ "lang": "python", "repo": "pytorch/opacus", "path": "/opacus/validators/instance_norm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pytorch/opacus path: /opacus/validators/instance_norm.py #!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of th...
code_fim
hard
{ "lang": "python", "repo": "pytorch/opacus", "path": "/opacus/validators/instance_norm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return ( [ IllegalModuleConfigurationError( "We do not support tracking running stats with differential privacy. " "To support it, we would have to add a DP mechanism for these statistics too, " "which would incur a privacy cost for l...
code_fim
hard
{ "lang": "python", "repo": "pytorch/opacus", "path": "/opacus/validators/instance_norm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> input_dir = os.path.abspath(os.path.join(testcase_path, 'sensor')) config['uri_to_local'] = {'redfish.dmtf.org/schemas/v1': input_dir} config['local_to_uri'] = { input_dir : 'redfish.dmtf.org/schemas/v1'} docGen = DocGenerator([ input_dir ], '/dev/null', config) output = docGen.gener...
code_fim
hard
{ "lang": "python", "repo": "DMTF/Redfish-Tools", "path": "/doc-generator/tests/test_combine_multiple_refs.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@patch('urllib.request') # so we don't make HTTP requests. NB: samples should not call for outside resources. def test_combine_at_3_html(mockRequest): """ Threshold is set at 3. This is a likely choice; our example is a sextuple of references. This test exercises HTML output. """ conf...
code_fim
hard
{ "lang": "python", "repo": "DMTF/Redfish-Tools", "path": "/doc-generator/tests/test_combine_multiple_refs.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DMTF/Redfish-Tools path: /doc-generator/tests/test_combine_multiple_refs.py # Copyright Notice: # Copyright 2020 Distributed Management Task Force, Inc. All rights reserved. # License: BSD 3-Clause License. For full text see link: https://github.com/DMTF/Redfish-Tools/blob/main/LICENSE.md """ Fi...
code_fim
hard
{ "lang": "python", "repo": "DMTF/Redfish-Tools", "path": "/doc-generator/tests/test_combine_multiple_refs.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> 2) sentences.append(text) labels = np.ravel(labels) return sentences, labels<|fim_prefix|># repo: cyzhangAThit/shalo path: /utils/parse_data.py import numpy as np import os def get_data_from_file_polarity(fname): labels, sentences = [], [] with open(fname, 'rb') as f: ...
code_fim
medium
{ "lang": "python", "repo": "cyzhangAThit/shalo", "path": "/utils/parse_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cyzhangAThit/shalo path: /utils/parse_data.py import numpy as np import os def get_data_from_file_polarity(fname): labels, sentences = []<|fim_suffix|>().split(' ', 1) text = text.split(' ') labels.append((int(label) + 1) / 2) sentences.append(text) la...
code_fim
medium
{ "lang": "python", "repo": "cyzhangAThit/shalo", "path": "/utils/parse_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: orijtech/orijpython path: /archomp/v1/__init__.py import requests # Archomp implements a client to coordinate with the archive # compressor API provided by orijtech.com. It takes in key value pairs # describing URLs , and then compresses them together into a zip # and streams back the .zip body....
code_fim
hard
{ "lang": "python", "repo": "orijtech/orijpython", "path": "/archomp/v1/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> req = {'files': vettedOptions} res = requests.post(self.__BaseURL, json=req, headers=header, stream=True) if res.status_code != 200: return None, Error(res.text) return res.iter_content(chunk_size=1024 * 256), None def replaceItemOfIndex(itemsList, value, index): """ The goal h...
code_fim
hard
{ "lang": "python", "repo": "orijtech/orijpython", "path": "/archomp/v1/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "subcategory", "line_item", "year", ["amount", "float"] ]) main.aggregate(keys=["year", "category"], measures=["amount"]) main.field_map(keep_fiel...
code_fim
hard
{ "lang": "python", "repo": "lordnynex/CLEANUP", "path": "/FORKS/Python/brewery/tree/examples/aggregate_remote_csv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lordnynex/CLEANUP path: /FORKS/Python/brewery/tree/examples/aggregate_remote_csv.py """ Data Brewery Example Aggregate a remote CSV file. """ import brewery main = brewery.create_builder() main.csv_source("https://raw.github.com/Stiivi/cubes/master/examples/hello_world/dat<|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "lordnynex/CLEANUP", "path": "/FORKS/Python/brewery/tree/examples/aggregate_remote_csv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dulichan/iot-ref-arch path: /python-agent/agent/custom/publishers/TemperaturePublisher.py ''' Copyright (c) 2005-2011, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. WSO2 Inc. licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file exce...
code_fim
medium
{ "lang": "python", "repo": "dulichan/iot-ref-arch", "path": "/python-agent/agent/custom/publishers/TemperaturePublisher.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): ''' Main task of the Process. This is used to read perform some device operations to collect data ''' humidity, temperature = get_dht_temp() if humidity is not None and temperature is not None: input = { ...
code_fim
hard
{ "lang": "python", "repo": "dulichan/iot-ref-arch", "path": "/python-agent/agent/custom/publishers/TemperaturePublisher.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tempFile = open("/sys/class/thermal/thermal_zone0/temp") cpu_temp = tempFile.read() tempFile.close() return float(cpu_temp) / 1000 # Uncomment the next line if you want the temp in Fahrenheit # return float(1.8*cpu_temp)+32 def get_gpu_temp(self): ...
code_fim
hard
{ "lang": "python", "repo": "dulichan/iot-ref-arch", "path": "/python-agent/agent/custom/publishers/TemperaturePublisher.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def imprime(): for i in lista: print(i) while True: lista.clear() escolha = input('Qual filme deseja pesquisar? (S para sair): ') if escolha.lower() == 's': print('Saindo do script...') break busca(escolha) imprime_esc = input('Deseja imprimir a lista? (Y...
code_fim
medium
{ "lang": "python", "repo": "dafonse/python-scripts", "path": "/buscaFilme/buscaFilme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while True: lista.clear() escolha = input('Qual filme deseja pesquisar? (S para sair): ') if escolha.lower() == 's': print('Saindo do script...') break busca(escolha) imprime_esc = input('Deseja imprimir a lista? (Y/N): ') if imprime_esc.lower() == 'y': imp...
code_fim
medium
{ "lang": "python", "repo": "dafonse/python-scripts", "path": "/buscaFilme/buscaFilme.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dafonse/python-scripts path: /buscaFilme/buscaFilme.py import requests import json api_key = "APIKEY" lista = [] def busca(buscar): ''' É um método, pois não tem retorno e só modifica a lista[] ''' page = 1 seq = 1 print('Buscando...') while True: req = requ...
code_fim
medium
{ "lang": "python", "repo": "dafonse/python-scripts", "path": "/buscaFilme/buscaFilme.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rileyhales/geomatics path: /publication_data/sample_data/geotiff_sample_data.py import os import glob import geomatics path_to_save_gtiffs = os.path.join(o<|fim_suffix|>oin(os.path.dirname(__file__), 'netcdf_data', '*.nc4')) var = 'Tair_f_inst' geomatics.convert.to_gtiffs(netcdf_files, var, save...
code_fim
medium
{ "lang": "python", "repo": "rileyhales/geomatics", "path": "/publication_data/sample_data/geotiff_sample_data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>geomatics.convert.to_gtiffs(netcdf_files, var, save_dir=path_to_save_gtiffs)<|fim_prefix|># repo: rileyhales/geomatics path: /publication_data/sample_data/geotiff_sample_data.py import os import glob import geomatics path_to_save_gtiffs = os.path.join(o<|fim_middle|>s.path.dirname(__file__), 'geotiff_da...
code_fim
medium
{ "lang": "python", "repo": "rileyhales/geomatics", "path": "/publication_data/sample_data/geotiff_sample_data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('ledger', '0069_multi_eon_matching_tokens_populate'), ] operations = [ migrations.CreateModel( name='TOSConfig', fields=[ ('id', models.AutoField(auto_created=True, primary_key=Tr...
code_fim
hard
{ "lang": "python", "repo": "xiaobai900/nocust-hub", "path": "/operator_api/tos/migrations/001_initial.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaobai900/nocust-hub path: /operator_api/tos/migrations/001_initial.py # -*- coding: utf-8 -*- # Generated by Django 1.11.20 on 2019-10-23 11:15 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import django.utils.timezone class...
code_fim
hard
{ "lang": "python", "repo": "xiaobai900/nocust-hub", "path": "/operator_api/tos/migrations/001_initial.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Lucas-Irvine/Particle-Cloud-Framework path: /examples/particle/aws/ecs/use_ecs_service/example_ecs_service.py from pcf.particle.aws.ecs.ecs_cluster import ECSCluster from pcf.particle.aws.ecs.ecs_task_definition import ECSTaskDefinition from pcf.particle.aws.ecs.ecs_service import ECSService fro...
code_fim
hard
{ "lang": "python", "repo": "Lucas-Irvine/Particle-Cloud-Framework", "path": "/examples/particle/aws/ecs/use_ecs_service/example_ecs_service.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pcf = PCF([]) pcf.add_particles(( ecs_cluster, ecs_service, ecs_task_def, )) pcf.link_particles(pcf.particles) pcf.apply(sync=True, cascade=True) # example start ecs_cluster.set_desired_state(State.running) ecs_task_def.set_desired_state(State.running) ecs_service.set_desired_state(State.runn...
code_fim
hard
{ "lang": "python", "repo": "Lucas-Irvine/Particle-Cloud-Framework", "path": "/examples/particle/aws/ecs/use_ecs_service/example_ecs_service.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #if lineno > 100000: # break years = sorted(years) entities = sorted(entities) print("Calculating diffs...") sys.stdout.flush() diffs = [] for prev_year in range(min(years),2020): for entity_type,entity_id in entities: prev_count = counts[ (prev_year,entity_type,entity_id) ] next_co...
code_fim
medium
{ "lang": "python", "repo": "personx000/corona-ml", "path": "/topic-surging-analysis/calcYearDiffs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: personx000/corona-ml path: /topic-surging-analysis/calcYearDiffs.py import argparse from collections import Counter import sys import json if __name__ == '__main__': parser = argparse.ArgumentParser('Calculate the year-on-year differences in entity mention counts') parser.add_argument('--count...
code_fim
hard
{ "lang": "python", "repo": "personx000/corona-ml", "path": "/topic-surging-analysis/calcYearDiffs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("Saving...") sys.stdout.flush() with open(args.outFile,'w') as f: for diff_data in diffs[:10000]: f.write( "\t".join(map(str,diff_data)) + "\n" ) print("Done") sys.stdout.flush()<|fim_prefix|># repo: personx000/corona-ml path: /topic-surging-analysis/calcYearDiffs.py import argparse fro...
code_fim
hard
{ "lang": "python", "repo": "personx000/corona-ml", "path": "/topic-surging-analysis/calcYearDiffs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PeterZs/reflectance-filtering path: /training/train_with_barrista.py #!/usr/bin/env python # MIT License # # Copyright (c) 2017 Thomas Nestmeyer # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software")...
code_fim
hard
{ "lang": "python", "repo": "PeterZs/reflectance-filtering", "path": "/training/train_with_barrista.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Create the folder base_dir (if not existing yet) and in it, create all subdirectories in create_dir. """ mkdir_p(base_dir) for d in create_dirs: mkdir_p(os.path.join(base_dir, d)) def _vis_square(data, padsize=1, padval=0): """Inspired by the caffe ipython notebook on fil...
code_fim
hard
{ "lang": "python", "repo": "PeterZs/reflectance-filtering", "path": "/training/train_with_barrista.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ariel98po/SC101_Assignment path: /SC101_Assignment2_葉思佟/breakoutgraphics.py """ stanCode Breakout Project Adapted from Eric Roberts's Breakout by Sonja Johnson-Yu, Kylie Jue, Nick Bowman, and Jerry Liao YOUR DESCRIPTION HERE """ from campy.graphics.gwindow import GWindow from campy.graphics.gob...
code_fim
hard
{ "lang": "python", "repo": "ariel98po/SC101_Assignment", "path": "/SC101_Assignment2_葉思佟/breakoutgraphics.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.ball.x + self.ball.width >= self.window.width or self.ball.x <= 0: self.__dx = -self.__dx if self.ball.y <= 0: self.__dy = -self.__dy def mouse_start(self, event): global lives x_start = (self.window.width - self.ball.width) / 2 ...
code_fim
hard
{ "lang": "python", "repo": "ariel98po/SC101_Assignment", "path": "/SC101_Assignment2_葉思佟/breakoutgraphics.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DarkShadow4/Python path: /olimpiada/ejercicios/random/estrella de la muerte.py def generar_hangar(): """Funcion para generar el hangar tal y como aparecera siempre como minimo""" ubicaciones = [] ubicaciones.append("T") for i in range(9): ubicaciones.append("o") ubicaciones.append("T") ...
code_fim
hard
{ "lang": "python", "repo": "DarkShadow4/Python", "path": "/olimpiada/ejercicios/random/estrella de la muerte.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while torretas_adicionales < 0 or torretas_adicionales > 4: torretas_adicionales = input("Numero de torretas adicionales: ") ubicacion_anterior = 0 while torretas_adicionales > 0: if ubicacion_anterior is not 8: ubicacion = input("Ubicacion: ") if ubicacion%2 == 0: if ubicacion > ubic...
code_fim
medium
{ "lang": "python", "repo": "DarkShadow4/Python", "path": "/olimpiada/ejercicios/random/estrella de la muerte.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Funcion no terminada, simplemente muestra algo si hay el maximo o no hay torretas adicionales""" torretas_adicionales = ubicaciones.count("t") # obtengo cuantas t (torretas adicionales) hay en ubicaciones if torretas_adicionales == 0: print "Posicion: 5" if torretas_adicionales == 4: print "Pos...
code_fim
hard
{ "lang": "python", "repo": "DarkShadow4/Python", "path": "/olimpiada/ejercicios/random/estrella de la muerte.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chlien/MFIR-AP path: /run.py "tns" : tns, "fns" : fns} return data_dict def combine_all_metrics(all_metrics_dict_list): result = {} sum_dict = {} sum_keys = ["ATTA", "APT", "precision", "recall", "accuracy", ...
code_fim
hard
{ "lang": "python", "repo": "chlien/MFIR-AP", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> table {{ border-collapse: collapse; border: 2px solid rgb(200,200,200); letter-spacing: 1px; font-size: 0.8rem; }} td, th {{ border: 1px soli...
code_fim
hard
{ "lang": "python", "repo": "chlien/MFIR-AP", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> summary_dict = {} summary_dict["epochs"] = model_dict["epochs"] summary_dict["batch_size"] = model_dict["batch_size"] summary_dict["train_size"] = model_dict["train_set_ratio"] summary_dict["loss_function"] = model_dict["loss_function"] summary_dict["frames"] = model_dict["frames"]...
code_fim
hard
{ "lang": "python", "repo": "chlien/MFIR-AP", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: y_pred, np.array of int (test_samples) """ # TODO: Implement predict # Hint: some of the code of the compute_loss_and_gradients # can be reused pred = np.zeros(X.shape[0], np.int) to_relu = self.input_layer.forward(X) to_ou...
code_fim
hard
{ "lang": "python", "repo": "temur-kh/dlcourse_ai", "path": "/assignments/assignment2/model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }