text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> input_ = self.history.get_workflow_input() for values in input_.values(): for k,v in values.items(): if 'decider_spec' in k: return floto.specs.DeciderSpec.from_json(v)<|fim_prefix|># repo: diogoaurelio/floto path: /floto/decider/dynamic_dec...
code_fim
medium
{ "lang": "python", "repo": "diogoaurelio/floto", "path": "/floto/decider/dynamic_decider.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scbedd/azure-sdk-for-python path: /sdk/agrifood/azure-agrifood-farming/azure/agrifood/farming/aio/operations/_attachments_operations.py farmer. :param farmer_id: ID of the associated farmer. :type farmer_id: str :param resource_ids: Resource Ids of the resource. ...
code_fim
hard
{ "lang": "python", "repo": "scbedd/azure-sdk-for-python", "path": "/sdk/agrifood/azure-agrifood-farming/azure/agrifood/farming/aio/operations/_attachments_operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> delete.metadata = {'url': '/farmers/{farmerId}/attachments/{attachmentId}'} # type: ignore async def download( self, farmer_id: str, attachment_id: str, **kwargs: Any ) -> IO: """Downloads and returns attachment as response for the given input filePath...
code_fim
hard
{ "lang": "python", "repo": "scbedd/azure-sdk-for-python", "path": "/sdk/agrifood/azure-agrifood-farming/azure/agrifood/farming/aio/operations/_attachments_operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> t.add([Note(0, (1, 4)), Note(1, (1, 4)), Note(-1, (1, 4))]) assert list(t) == [ (Signature(0, 1), Note(0, (1, 4))), (Signature(1, 4), Note(-1, (1, 4))), (Signature(1, 4), Note(0, (1, 4))), (Signature(1, 4), Note(1, (1, 4))), ] t.add(Note(42, (8, 1)), (13, 1...
code_fim
hard
{ "lang": "python", "repo": "Aozhi/melodia", "path": "/tests/melodia/core/test_track.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aozhi/melodia path: /tests/melodia/core/test_track.py import random import pytest from melodia.core import Track, Signature, Note def random_track(): track = Track(signature=(random.randint(0, 100), 16)) for _ in range(random.randint(100, 300)): note = Note(random.randint(-10...
code_fim
hard
{ "lang": "python", "repo": "Aozhi/melodia", "path": "/tests/melodia/core/test_track.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MLDL/uninas path: /uninas/optimization/estimators/net.py """ common estimator (metric) utils to rank different networks (architecture subsets of a super network) """ import torch from uninas.methods.abstract import AbstractMethod from uninas.models.networks.uninas.search import SearchUninasNetwo...
code_fim
hard
{ "lang": "python", "repo": "MLDL/uninas", "path": "/uninas/optimization/estimators/net.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @Register.hpo_estimator(requires_trainer=True, requires_method=True) class NetValueEstimator(AbstractNetEstimator): """ An Estimator for a value returned by forward passes (loss, accuracy, ...) """ def __init__(self, *args_, **kwargs_): # can set self.net_kwargs to account for pa...
code_fim
hard
{ "lang": "python", "repo": "MLDL/uninas", "path": "/uninas/optimization/estimators/net.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: coolsnake/JupyterNotebook path: /new_algs/Graph+algorithms/Dijkstra's+algorithm/digraph.py from math import inf from terminaltables import AsciiTable from timeit import default_timer as timer # This method takes in the node set, the set of predecesors to each node, and # their distance to each n...
code_fim
hard
{ "lang": "python", "repo": "coolsnake/JupyterNotebook", "path": "/new_algs/Graph+algorithms/Dijkstra's+algorithm/digraph.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> start = timer() # initializing the 2D distance matrix node_list = list(self.node_set) dis_matrix = [] for row_index in range(len(node_list)): temp_row = [] for column_index in range(len(node_list)): tail = node_list[row_index...
code_fim
hard
{ "lang": "python", "repo": "coolsnake/JupyterNotebook", "path": "/new_algs/Graph+algorithms/Dijkstra's+algorithm/digraph.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> hl = len(haystack) nl = len(needle) if nl == 0: return 0 for i in range(hl-nl+1): if haystack[i] == needle[0]: for i2 in range(0,nl): if needle[i2] != haystack[i+i2]: break ...
code_fim
hard
{ "lang": "python", "repo": "we1are1adc/leetcodeRecord", "path": "/28.实现-str-str.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: we1are1adc/leetcodeRecord path: /28.实现-str-str.py # # @lc app=leetcode.cn id=28 lang=python3 # # [28] 实现 strStr() # <|fim_suffix|> hl = len(haystack) nl = len(needle) if nl == 0: return 0 for i in range(hl-nl+1): if haystack[i] == needle[0]:...
code_fim
hard
{ "lang": "python", "repo": "we1are1adc/leetcodeRecord", "path": "/28.实现-str-str.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: idapython/src path: /tools/inject_pydoc.py node.findall("enumvalue") if get_enums else None if brief_node is None and \ detailed_node is None and \ enum_nodes is None: return None plist = [] for pnode in node.findall("param"): ...
code_fim
hard
{ "lang": "python", "repo": "idapython/src", "path": "/tools/inject_pydoc.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> visitor = pydoc_visitor_t(self.classes, self.functions, self.variables) for pydoc in pydocs: try: log_verb("swig_pydoc_collector_t: parsing clob %s" % pydoc) tree = ast.parse(pydoc) except Exception as ex: message = e...
code_fim
hard
{ "lang": "python", "repo": "idapython/src", "path": "/tools/inject_pydoc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not indent and parse_prototypes: for re in (self.RE_PROTO1, self.RE_PROTO2): m = re.match(line) if m: self.parts = m.groups() return self.PAT_PROTO return self.PAT_TEXT def _rest_after_colon(self, ...
code_fim
hard
{ "lang": "python", "repo": "idapython/src", "path": "/tools/inject_pydoc.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ktp-forked-repos/py-algorithms path: /py_algorithms/data_structures/tree_node.py from typing import Any class TreeNode: __slots__ = '_left', '_right', '_element' <|fim_suffix|> return "#<{} e={} left={} right={}>" \ .format(self.__class__.__name__, self.element, self.lef...
code_fim
hard
{ "lang": "python", "repo": "ktp-forked-repos/py-algorithms", "path": "/py_algorithms/data_structures/tree_node.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_left(self, node: 'TreeNode') -> 'TreeNode': self._left = node return self @property def right(self) -> 'TreeNode': return self._right def set_right(self, node: 'TreeNode') -> 'TreeNode': self._right = node return self @property def...
code_fim
medium
{ "lang": "python", "repo": "ktp-forked-repos/py-algorithms", "path": "/py_algorithms/data_structures/tree_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def right(self) -> 'TreeNode': return self._right def set_right(self, node: 'TreeNode') -> 'TreeNode': self._right = node return self @property def element(self) -> Any: return self._element def __repr__(self): return "#<{} e={} ...
code_fim
medium
{ "lang": "python", "repo": "ktp-forked-repos/py-algorithms", "path": "/py_algorithms/data_structures/tree_node.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JIAWea/rxbpn path: /rxbpn/observer/bufferobserver.py import threading from typing import Optional from rx.core import typing from rxbp.acknowledgement.ack import Ack from rxbp.acknowledgement.acksubject import AckSubject from rxbp.acknowledgement.continueack import ContinueAck, continue_ack from...
code_fim
hard
{ "lang": "python", "repo": "JIAWea/rxbpn", "path": "/rxbpn/observer/bufferobserver.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> next_raw_state = RawBufferedStates.OnErrorOrDownStreamStopped() with self.lock: prev_state = self.state self.state = next_raw_state prev_meas_state = prev_state.get_measured_state(has_elements=False) if not isinstance(prev_meas_state, BufferedStat...
code_fim
hard
{ "lang": "python", "repo": "JIAWea/rxbpn", "path": "/rxbpn/observer/bufferobserver.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiji-online/neptune-cli path: /neptune/internal/common/utils/paths.py # # Copyright (c) 2016, deepsense.io # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:...
code_fim
medium
{ "lang": "python", "repo": "jiji-online/neptune-cli", "path": "/neptune/internal/common/utils/paths.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> abs_path = os.path.abspath(path) norm_abs_path = normalize_path(abs_path) return norm_abs_path def make_path(dst, verbose=False): mkpath(dst, verbose=verbose) return dst<|fim_prefix|># repo: jiji-online/neptune-cli path: /neptune/internal/common/utils/paths.py # # Copyright (c) 2016...
code_fim
medium
{ "lang": "python", "repo": "jiji-online/neptune-cli", "path": "/neptune/internal/common/utils/paths.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return str(Path(p).resolve()) def getcwd(): return resolve(os.getcwd()) def join_paths(path, *paths): joined_path = os.path.join(path, *paths) norm_joined_path = normalize_path(joined_path) return norm_joined_path def absolute_path(path): abs_path = os.path.abspath(path) ...
code_fim
hard
{ "lang": "python", "repo": "jiji-online/neptune-cli", "path": "/neptune/internal/common/utils/paths.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # save model, just in case if rank == 0: model_ref.save('temp') return model, optimizer, scheduler, writer if __name__ == "__main__": """ some test's """ # torch.cuda.empty_cache() tnz = torch.empty(3, 15).random_(0, 4) print(tnz)<|fim_prefix|># repo: muska...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan486/pubtrends-review", "path": "/pysrc/review/train/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # loss loss = criter( draft_logprobs, target_ids, ) # backward grad_norm = backward_step(loss, optimizer, model, optimizer.clip_value, amp_enabled=cfg.amp_enabled) grad_norm = 0 if (math.isinf(grad_norm) or math.isnan(grad_norm)) els...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan486/pubtrends-review", "path": "/pysrc/review/train/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muskanmahajan486/pubtrends-review path: /pysrc/review/train/train.py import math import torch import torch.distributed as distrib import torch.nn as nn from torch.optim.optimizer import Optimizer from tqdm import tqdm import pysrc.review.config as cfg from pysrc.review.utils import get_enc_lr, ...
code_fim
hard
{ "lang": "python", "repo": "muskanmahajan486/pubtrends-review", "path": "/pysrc/review/train/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NeverLeft/DjangoAXF path: /App/migrations/0005_auto_20180526_1052.py # -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-05-26 10:52 from __future__ import unicode_literals from django.db import migrations <|fim_suffix|> dependencies = [ ('App', '0004_foodtype'), ] ...
code_fim
easy
{ "lang": "python", "repo": "NeverLeft/DjangoAXF", "path": "/App/migrations/0005_auto_20180526_1052.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RenameField( model_name='foodtype', old_name='chiletypenames', new_name='childypenames', ), ]<|fim_prefix|># repo: NeverLeft/DjangoAXF path: /App/migrations/0005_auto_20180526_1052.py # -*- coding: utf-8 -*- # Generated...
code_fim
medium
{ "lang": "python", "repo": "NeverLeft/DjangoAXF", "path": "/App/migrations/0005_auto_20180526_1052.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('App', '0004_foodtype'), ] operations = [ migrations.RenameField( model_name='foodtype', old_name='chiletypenames', new_name='childypenames', ), ]<|fim_prefix|># repo: NeverLeft/DjangoAXF path: /App/migrations/...
code_fim
easy
{ "lang": "python", "repo": "NeverLeft/DjangoAXF", "path": "/App/migrations/0005_auto_20180526_1052.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class Transformation(object): def __init__(self, is_gray, k_90_rotate): self.gray = is_gray self.k_90_rotate = k_90_rotate def __call__(self, x): res_x = x if self.gray: if x.shape[2] == 1: pass # input is gray elif x.shape[2...
code_fim
hard
{ "lang": "python", "repo": "wogong/pt-tiae", "path": "/transformations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wogong/pt-tiae path: /transformations.py import abc import itertools import numpy as np from keras.preprocessing.image import apply_affine_transform from scipy.ndimage.interpolation import rotate as rt import keras.backend as K class AbstractTransformer(abc.ABC): def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "wogong/pt-tiae", "path": "/transformations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for line in self.lines_fast: f = line.lstrip().split() if (len(f) < 2): continue if (f[1] == 'PtfmFile' and self.ptfm_file == None): self.ptfm_file = f[0][1:-1] if (f[1] == 'TwrFile' and self.twr_file == None): ...
code_fim
hard
{ "lang": "python", "repo": "xiaoyao79/AeroelasticSE", "path": "/src/AeroelasticSE/runFAST.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Write the new platform file Parameters self.lines_ptfm are the unmodified lines of the platform file fstDict may contain location of WAMITFile, also may contain "PlatformDir" to change angle of platform """ if self.ptfm_file == None: return...
code_fim
hard
{ "lang": "python", "repo": "xiaoyao79/AeroelasticSE", "path": "/src/AeroelasticSE/runFAST.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaoyao79/AeroelasticSE path: /src/AeroelasticSE/runFAST.py one: hdr, out = self.parseFASTout(directory) if (out == None): fname = self.runname + '.out' sys.stderr.write("output param %s does not exist in %s\n" % (paramname, fname)) ...
code_fim
hard
{ "lang": "python", "repo": "xiaoyao79/AeroelasticSE", "path": "/src/AeroelasticSE/runFAST.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>for object in object_class: pre = [] rec = [] for item in th: print("class: %d"%object) print("th: %f"%item) full_one(item,object) pre_path = prefix + '/' + 'pre_' + str(object) + '.npy' rec_path = prefix + '/' + 'rec_' + str(object) + '.npy' np.save(pre_p...
code_fim
hard
{ "lang": "python", "repo": "Spritea/pytorch-semseg-fp16-one-titan", "path": "/get_score/full_para_multiclass.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def full_one(th,object): running_metrics_val.reset() pool=ThreadPool(26) pool.starmap(backbone,zip(range(len(Tensor_Str)),itertools.repeat(th),itertools.repeat(object))) pool.close() pool.join() acc, cls_pre, cls_rec, cls_f1, cls_iu, hist = running_metrics_val.get_scores() pr...
code_fim
hard
{ "lang": "python", "repo": "Spritea/pytorch-semseg-fp16-one-titan", "path": "/get_score/full_para_multiclass.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Spritea/pytorch-semseg-fp16-one-titan path: /get_score/full_para_multiclass.py import cv2 as cv from get_score import util import numpy as np import time from pathlib import Path import natsort from get_score.metrics_my import runningScore from tqdm import tqdm from multiprocessing.dummy import ...
code_fim
hard
{ "lang": "python", "repo": "Spritea/pytorch-semseg-fp16-one-titan", "path": "/get_score/full_para_multiclass.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nphard001/ADL-Final path: /fashion_retrieval/__init__.py from fashion_retrieval import ranker from fashion_retriev<|fim_suffix|> from fashion_retrieval import model from fashion_retrieval import sim_user from fashion_retrieval import train_rl<|fim_middle|>al import syn_user from fashion_retrieval...
code_fim
easy
{ "lang": "python", "repo": "nphard001/ADL-Final", "path": "/fashion_retrieval/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from fashion_retrieval import model from fashion_retrieval import sim_user from fashion_retrieval import train_rl<|fim_prefix|># repo: nphard001/ADL-Final path: /fashion_retrieval/__init__.py from fashion_retrieval import ranker from fashion_retriev<|fim_middle|>al import syn_user from fashion_retrieval...
code_fim
easy
{ "lang": "python", "repo": "nphard001/ADL-Final", "path": "/fashion_retrieval/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>al import sim_user from fashion_retrieval import train_rl<|fim_prefix|># repo: nphard001/ADL-Final path: /fashion_retrieval/__init__.py from fashion_retrieval import ranker from fashion_retriev<|fim_middle|>al import syn_user from fashion_retrieval import train_sl from fashion_retrieval import model from...
code_fim
medium
{ "lang": "python", "repo": "nphard001/ADL-Final", "path": "/fashion_retrieval/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jlmasson/taller7-bootstrap path: /docs/recetas/css/arena.py n = int(input("Ingrese número de filas: ")) c = input("Ingrese caracter: ") for i in range(1, n+1): for j in range(1, n+1): if i == 1 or i == n: print(<|fim_suffix|>i and j < n + 1 - i: print(c, end="") else: print(" ", en...
code_fim
medium
{ "lang": "python", "repo": "jlmasson/taller7-bootstrap", "path": "/docs/recetas/css/arena.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>i and j < n + 1 - i: print(c, end="") else: print(" ", end="") print()<|fim_prefix|># repo: jlmasson/taller7-bootstrap path: /docs/recetas/css/arena.py n = int(input("Ingrese número de filas: ")) c = input("Ingrese caracter: ") fo<|fim_middle|>r i in range(1, n+1): for j in range(1, n+1): if...
code_fim
medium
{ "lang": "python", "repo": "jlmasson/taller7-bootstrap", "path": "/docs/recetas/css/arena.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if current_user.is_merchant(): return redirect(url_for('merchant.index')) elif current_user.is_admin(): return redirect(url_for('admin.index')) elif current_user.is_vendor(): return redirect(url_for('vendor.index')) else: return redirect(url_for('account.lo...
code_fim
easy
{ "lang": "python", "repo": "msgpo/reading-terminal-market", "path": "/app/main/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: msgpo/reading-terminal-market path: /app/main/views.py from flask import redirect, url_for from . import main from flask.ext.login import current_user <|fim_suffix|> if current_user.is_merchant(): return redirect(url_for('merchant.index')) elif current_user.is_admin(): ret...
code_fim
easy
{ "lang": "python", "repo": "msgpo/reading-terminal-market", "path": "/app/main/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> W = np.asarray( np.random.uniform( low=-4.*np.sqrt(6. / (n_in + n_out)), high=4.*np.sqrt(6. / (n_in + n_out)), size=(n_in, n_out) ), dtype=theano.config.floatX ) return W def init_norm(n_in, n_out): W = np.asarray(np.random.randn(n_in, n_out)*0.1, dtype=theano.config.floatX) return...
code_fim
hard
{ "lang": "python", "repo": "miradel51/biLSTM-theano", "path": "/src/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: miradel51/biLSTM-theano path: /src/utils.py import theano import numpy as np def init_ortho(size): return np.concatenate( [ ortho_matrix( size ), ortho_matrix( size ), ortho_matrix( size ), ortho_matrix( size ), ], axis=1).astype(theano.config.floatX) def init_uniform(n_in, ...
code_fim
medium
{ "lang": "python", "repo": "miradel51/biLSTM-theano", "path": "/src/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return False if __name__ == '__main__': nums = [0] k = 0 print check_sub_array_sum(nums, k)<|fim_prefix|># repo: tonylixu/devops path: /algorithm/523-continuous-subarray-sum/solution2.py def check_sub_array_sum(nums, k): # Key is reminder, value is index dmap = {0:-1} total = ...
code_fim
medium
{ "lang": "python", "repo": "tonylixu/devops", "path": "/algorithm/523-continuous-subarray-sum/solution2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tonylixu/devops path: /algorithm/523-continuous-subarray-sum/solution2.py def check_sub_array_sum(nums, k): # Key is reminder, value is index dmap = {0:-1} total = 0 <|fim_suffix|> return False if __name__ == '__main__': nums = [0] k = 0 print check_sub_array_sum(nums...
code_fim
hard
{ "lang": "python", "repo": "tonylixu/devops", "path": "/algorithm/523-continuous-subarray-sum/solution2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: NULLCT/LOMC path: /src/data/970.py import sys sys.setrecursionlimit(10**8) from typing import NamedTuple from operator import itemgetter, attrgetter from collections import defaultdict, deque, Counter from itertools import combinations, combinations_with_replacement, permutations import heapq im...
code_fim
medium
{ "lang": "python", "repo": "NULLCT/LOMC", "path": "/src/data/970.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> seen = [False] * N score = [-1] * N score[0] = 0 stack = [0] while stack: v = stack.pop() seen[v] = True for u in Edge[v]: if seen[u]: continue score[u] = score[v] + 1 stack.append(u) for _ in range(Q): ...
code_fim
hard
{ "lang": "python", "repo": "NULLCT/LOMC", "path": "/src/data/970.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>freeSpace = TOTAL_SIZE - root.folderSize() neededClearance = NEEDED_FREE - freeSpace foldersBySize = sorted(allFolders, key=lambda x : x.folderSize()) for f in foldersBySize: if f.folderSize() >= neededClearance: print("Folder to delete and size:", f.name, f.folderSize()) break # def example_...
code_fim
hard
{ "lang": "python", "repo": "microsoft/Reactors", "path": "/coding-languages-frameworks/code-garden-advent-of-code-2022/day7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>root = Folder("/") workingDir = root allFolders = [root] for line in data[1:]: if line.startswith("$"): # is a command if line.startswith("$ cd"): destination = line.split(" ")[2] if destination == "..": workingDir = workingDir.parent ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/Reactors", "path": "/coding-languages-frameworks/code-garden-advent-of-code-2022/day7.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: microsoft/Reactors path: /coding-languages-frameworks/code-garden-advent-of-code-2022/day7.py data = [x.strip() for x in open("day7-example.txt").readlines()] class Folder: def __init__(self, name, parent=None): self.name = name self.subfolders = {} self.files = {} ...
code_fim
hard
{ "lang": "python", "repo": "microsoft/Reactors", "path": "/coding-languages-frameworks/code-garden-advent-of-code-2022/day7.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#IMPORTING SequenceMatcher FROM difflib from difflib import SequenceMatcher #CALCULATING OVERALL SIMILARITY SCORE score = SequenceMatcher(None, concat1, concat2) #OUTPUT print("Similarity of the two given files is:") print(score.ratio())<|fim_prefix|># repo: Tomnearly30/CS590-CLS-project path...
code_fim
hard
{ "lang": "python", "repo": "Tomnearly30/CS590-CLS-project", "path": "/compare.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Tomnearly30/CS590-CLS-project path: /compare.py #-----sequenceCompare----- #This is used to find the similarity percentage of two fasta files #ACCEPTING INPUT FILES import sys file1 = sys.argv[1] file2 = sys.argv[2] #OPENING FIRST FILE AND EXCLUDING LABELS with open(file1) as f: fa...
code_fim
medium
{ "lang": "python", "repo": "Tomnearly30/CS590-CLS-project", "path": "/compare.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#OPENING SECOND FILE AND EXCLUDING LABELS with open(file2) as f: fasta2 = f.readlines() i=0 while i < len(fasta2): if fasta2[i].find(">hsa") > -1: fasta2.pop(i) i=i+1 #REMOVING SPACES AND CONCATENATING SECOND FILE fasta2 = [x.strip() for x in fasta2] concat2 = "".join(fasta2)...
code_fim
medium
{ "lang": "python", "repo": "Tomnearly30/CS590-CLS-project", "path": "/compare.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('测试 chip') get_similar_tokens('chip', 3, glove) print('测试 china') get_similar_tokens('china', 3, glove) print('求类比词,比如 man vs women 等于 son vs daughter') def get_analogy(token_a, token_b, token_c, embed): vecs = [embed.vectors[embed.stoi[t]] for t in [token_a, token_b, token_c]] x = vecs[1...
code_fim
hard
{ "lang": "python", "repo": "ZixuanKe/deep-learning-note", "path": "/d2l/50_similar_words.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZixuanKe/deep-learning-note path: /d2l/50_similar_words.py import torch import torchtext.vocab as vocab print('查看已支持的预训练模型') print(vocab.pretrained_aliases.keys()) print('下载 glove.6B.50d,比较大 800m,会下载全部 glove,但其实我们要的是 100m') # 下载地址 http://nlp.stanford.edu/data/glove.6B.zip glove = vocab.GloVe(na...
code_fim
hard
{ "lang": "python", "repo": "ZixuanKe/deep-learning-note", "path": "/d2l/50_similar_words.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: smly/nips17_adversarial_attack path: /defense/defense_xgb.py # -*- coding: utf-8 -*- import sys import re from collections import Counter import numpy as np import pandas as pd import torch from torch.autograd import Variable from torchvision.models.densenet import densenet121 import torch.nn.fu...
code_fim
hard
{ "lang": "python", "repo": "smly/nips17_adversarial_attack", "path": "/defense/defense_xgb.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return f(input_, self.params) def _predict_top5(model_i, probs, num_inst, num_classes, st_idx): probs = F.softmax(probs) probs = probs.data.cpu().numpy().reshape( (num_inst, num_classes)) topk_preds = [] topk_probs = [] for k in range(5): top1_preds = probs.a...
code_fim
hard
{ "lang": "python", "repo": "smly/nips17_adversarial_attack", "path": "/defense/defense_xgb.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yehengchen/Object-Detection-and-Tracking path: /OneStage/yolo/tools/video2frame.py import cv2 image_folder = './mask_face' video_name = './cut_test.m4v' vc = <|fim_suffix|>else: rval=False while rval: rval,frame=vc.read() cv2.imwrite('./mask_face/IMG_'+str(c)+'.jpg',frame) c=c+1...
code_fim
medium
{ "lang": "python", "repo": "yehengchen/Object-Detection-and-Tracking", "path": "/OneStage/yolo/tools/video2frame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mask_face/IMG_'+str(c)+'.jpg',frame) c=c+1 cv2.waitKey(1) vc.release()<|fim_prefix|># repo: yehengchen/Object-Detection-and-Tracking path: /OneStage/yolo/tools/video2frame.py import cv2 image_folder = './mask_face' video_name = './cut_test.m4v' vc = <|fim_middle|>cv2.VideoCapture(video_name) c ...
code_fim
medium
{ "lang": "python", "repo": "yehengchen/Object-Detection-and-Tracking", "path": "/OneStage/yolo/tools/video2frame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Query API search_result = CargoTimeSeries().search( # We're only interested in movements into China filter_destinations=china, # We're looking at daily imports timeseries_frequency="day", # We want 'b' for barrels here timeseries_unit="b", ...
code_fim
medium
{ "lang": "python", "repo": "amirvortexa/python-sdk", "path": "/docs/examples/5_chinese_daily_imports.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Find Crude/Condensates ID crude_condensates = [ p.id for p in Products().search(term="Crude/Condensates").to_list() if p.name == "Crude/Condensates" ] # Query API search_result = CargoTimeSeries().search( # We're only interested in movements into Chin...
code_fim
medium
{ "lang": "python", "repo": "amirvortexa/python-sdk", "path": "/docs/examples/5_chinese_daily_imports.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: amirvortexa/python-sdk path: /docs/examples/5_chinese_daily_imports.py """ Let's retrieve the daily sum of Chinese Crude/Condensate imports, over the last year. The below script returns: | | key | value | count | |----:|:-------------------------|---------:|-------...
code_fim
hard
{ "lang": "python", "repo": "amirvortexa/python-sdk", "path": "/docs/examples/5_chinese_daily_imports.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # calculate surface energy and mass balance sp.surface_physics.surface_energy_and_mass_balance(state,par,bnd,t,y) # write output for last year if y == nyears-1: y1['tsurf'][:,t] = state.tsurf y1['alb'][:,t] = state.alb y1['swnet'][:,t] =...
code_fim
hard
{ "lang": "python", "repo": "mkrapp/semic", "path": "/f2py/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># populate validation data y2['tsurf'] = vali[:,0:nx].T y2['alb'] = vali[:,nx:2*nx].T y2['swnet'] = vali[:,2*nx:3*nx].T y2['smb'] = vali[:,3*nx:4*nx].T y2['melt'] = vali[:,4*nx:5*nx].T y2['acc'] = vali[:,5*nx:6*nx].T y2['shf'] = vali[:,6*nx:7*nx].T y2['lhf'] = vali[:,7*nx:].T # loop nyears ove...
code_fim
hard
{ "lang": "python", "repo": "mkrapp/semic", "path": "/f2py/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mkrapp/semic path: /f2py/test.py import numpy as np import matplotlib.pyplot as plt import SurfacePhysics as sp # read data pre = 'transect' forc = np.loadtxt('../example/data/'+pre+'_input.txt') vali = np.loadtxt('../example/data/'+pre+'_output.txt') var_names = ['tsurf', 'alb', 'swnet', 'smb',...
code_fim
hard
{ "lang": "python", "repo": "mkrapp/semic", "path": "/f2py/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hanlsin/udacity_PFwithPy path: /inheritance/inheritance.py class Parent(): """ This is a parent class to learn how to use inheritance of classes""" def __init__(self, last_name, eye_color): <|fim_suffix|> print("Last Name: " + self.last_name) print("Eye Color: " + self.eye...
code_fim
medium
{ "lang": "python", "repo": "hanlsin/udacity_PFwithPy", "path": "/inheritance/inheritance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>billy_cyrus.show_info() miley_cyrus = Child("Cyrus", "Blue", 3) print(miley_cyrus.last_name) print(miley_cyrus.number_of_toys) miley_cyrus.show_info()<|fim_prefix|># repo: hanlsin/udacity_PFwithPy path: /inheritance/inheritance.py class Parent(): """ This is a parent class to learn how to use inher...
code_fim
hard
{ "lang": "python", "repo": "hanlsin/udacity_PFwithPy", "path": "/inheritance/inheritance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: martindurant/gcsfs path: /gcsfs/__init__.py from ._version import get_versions <|fim_suffix|>__all__ = ["GCSFileSystem", "GCSMap"]<|fim_middle|>__version__ = get_versions()["version"] del get_versions from .core import GCSFileSystem from .mapping import GCSMap
code_fim
medium
{ "lang": "python", "repo": "martindurant/gcsfs", "path": "/gcsfs/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>__all__ = ["GCSFileSystem", "GCSMap"]<|fim_prefix|># repo: martindurant/gcsfs path: /gcsfs/__init__.py from ._version import get_versions <|fim_middle|>__version__ = get_versions()["version"] del get_versions from .core import GCSFileSystem from .mapping import GCSMap
code_fim
medium
{ "lang": "python", "repo": "martindurant/gcsfs", "path": "/gcsfs/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='category', name='description', field=models.TextField(verbose_name='Description'), ), ]<|fim_prefix|># repo: joeig/memodrop path: /categories/migrations/0008_auto_20180331_1348.py # -*- coding: u...
code_fim
medium
{ "lang": "python", "repo": "joeig/memodrop", "path": "/categories/migrations/0008_auto_20180331_1348.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: joeig/memodrop path: /categories/migrations/0008_auto_20180331_1348.py # -*- coding: utf-8 -*- # Generated by Django 1.11.10 on 2018-03-31 13:48 from __future__ import unicode_literals from django.db import migrations, models <|fim_suffix|> dependencies = [ ('categories', '0007_aut...
code_fim
easy
{ "lang": "python", "repo": "joeig/memodrop", "path": "/categories/migrations/0008_auto_20180331_1348.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('categories', '0007_auto_20180318_2307'), ] operations = [ migrations.AlterField( model_name='category', name='description', field=models.TextField(verbose_name='Description'), ), ]<|fim_prefix|># repo: joeig/m...
code_fim
medium
{ "lang": "python", "repo": "joeig/memodrop", "path": "/categories/migrations/0008_auto_20180331_1348.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns += patterns('', url(r'^admin/', include(admin.site.urls)), url(r'^accounts/', include('allauth.urls')), ) urlpatterns = += patterns('', url(r'^$', 'appmodel_site.views.showcase', name='showcase'), url(r'demo$', TemplateView.as_view(template_name="static/info/demo.html")), )<|f...
code_fim
medium
{ "lang": "python", "repo": "paulocheque/python-django-bootstrap", "path": "/toolbox/management/commands/appmodel/urls.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: paulocheque/python-django-bootstrap path: /toolbox/management/commands/appmodel/urls.py from django.conf.urls import patterns, include, url from django.contrib import admin from django.views.generic import TemplateView from tastypie.api import Api <|fim_suffix|>v1_api = Api(api_name='v1') v1_ap...
code_fim
medium
{ "lang": "python", "repo": "paulocheque/python-django-bootstrap", "path": "/toolbox/management/commands/appmodel/urls.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Send the Experiment Description to the Main node and start the Experiment. :param experiment_description: Dict. Experiment Description that will be sent to the Main node. :param wait_for_results: If ``False`` - client will only send an Experiment Description and r...
code_fim
hard
{ "lang": "python", "repo": "ITS-Zah/BRISE2", "path": "/benchmark/shared_tools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def chown_files_in_dir(directory): for root, dirs, files in os.walk(directory): for f in files: os.chown(os.path.abspath(os.path.join(root, f)), int(os.environ['host_uid']), int(os.environ['host_gid'])) break # do not traverse recursively def check...
code_fim
hard
{ "lang": "python", "repo": "ITS-Zah/BRISE2", "path": "/benchmark/shared_tools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ITS-Zah/BRISE2 path: /benchmark/shared_tools.py import sys import pickle import random import requests import datetime import socketio # high-level transport protocol import logging import socket # low-level (3-4th levels of OSI model), binding IP and port import json import time import re impor...
code_fim
hard
{ "lang": "python", "repo": "ITS-Zah/BRISE2", "path": "/benchmark/shared_tools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: GuyRoosevelt/Minecraft-Dungeons-The-Awakening path: /enemies.py class Enemy: def __init__(self): raise NotImplementedError("Do not create raw Enemy objects.") def __str__(self): return self.name def is_alive(self): return self.hp > 0 class Vindicat...
code_fim
medium
{ "lang": "python", "repo": "GuyRoosevelt/Minecraft-Dungeons-The-Awakening", "path": "/enemies.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class RedstoneGolem(Enemy): def __init__(self): self.name = "Redstone Golem" self.hp = 150 self.damage = 7 class TrainingDummy(Enemy): def __init__(self): self.name = "Training Dummy" self.hp = float('inf') self.damage = 0<|fim_prefix|># repo: GuyR...
code_fim
hard
{ "lang": "python", "repo": "GuyRoosevelt/Minecraft-Dungeons-The-Awakening", "path": "/enemies.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: adobe-type-tools/opentype-svg path: /tests/shared_utils_test.py # Copyright 2018 Adobe. All rights reserved. import os import shutil import sys import tempfile import unittest from io import StringIO from opentypesvg import utils as shared_utils class SharedUtilsTest(unittest.TestCase): ...
code_fim
hard
{ "lang": "python", "repo": "adobe-type-tools/opentype-svg", "path": "/tests/shared_utils_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.reset_stream(stream) shared_utils.final_message(2) self.assertEqual(stream.getvalue().strip(), '2 SVG files saved.') def test_create_folder(self): folder_path = 'new_folder' shared_utils.create_folder(folder_path) self.assertTrue(os.path.isdir(fold...
code_fim
hard
{ "lang": "python", "repo": "adobe-type-tools/opentype-svg", "path": "/tests/shared_utils_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def verbosePref(self): """Return setting of owner's verbosePref at level specified in its PreferenceEntry.level :param level: :return: """ # If the level of the object is below the Preference level, # recursively calls base (super) class...
code_fim
hard
{ "lang": "python", "repo": "PrincetonUniversity/PsyNeuLink", "path": "/psyneulink/core/globals/preferences/basepreferenceset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @verbosePref.setter def verbosePref(self, setting): """Assign setting to owner's verbosePref :param setting: :return: """ self.set_preference(candidate_info=setting, pref_ivar_name=VERBOSE_PREF) @property def paramValidationPref(self): """Re...
code_fim
hard
{ "lang": "python", "repo": "PrincetonUniversity/PsyNeuLink", "path": "/psyneulink/core/globals/preferences/basepreferenceset.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PrincetonUniversity/PsyNeuLink path: /psyneulink/core/globals/preferences/basepreferenceset.py referencesDict = { PREFERENCE_SET_NAME: TYPE_DEFAULT_PREFERENCES, VERBOSE_PREF: PreferenceEntry(False, PreferenceLevel.TYPE), PARAM_VALIDATION_PREF: PreferenceEntry(True, PreferenceLevel.TYP...
code_fim
hard
{ "lang": "python", "repo": "PrincetonUniversity/PsyNeuLink", "path": "/psyneulink/core/globals/preferences/basepreferenceset.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> driver.click_xpath(hamburger) driver.wait_for_xpath_to_appear(dashboard)<|fim_prefix|># repo: skyportal/skyportal path: /skyportal/tests/frontend/test_frontpage.py def test_foldable_sidebar(driver): driver.get('/') dashboard = '//p[contains(text(),"Dashboard")]' sidebar_text = driver....
code_fim
medium
{ "lang": "python", "repo": "skyportal/skyportal", "path": "/skyportal/tests/frontend/test_frontpage.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: skyportal/skyportal path: /skyportal/tests/frontend/test_frontpage.py def test_foldable_sidebar(driver): driver.get('/') dashboard = '//p[contains(text(),"Dashboard")]' sidebar_text = driver.wait_for_xpath(dashboard) assert sidebar_text.is_displayed() <|fim_suffix|> driver.cli...
code_fim
medium
{ "lang": "python", "repo": "skyportal/skyportal", "path": "/skyportal/tests/frontend/test_frontpage.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: aihill/google-landmarks path: /prepare_train_data.py #!/usr/bin/python3.6 """ Parses data, builds train/dev datasets, bakes data into big files. """ from typing import * import os from shutil import copyfile import numpy as np, pandas as pd # type: ignore from tqdm import tqdm ...
code_fim
hard
{ "lang": "python", "repo": "aihill/google-landmarks", "path": "/prepare_train_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # print("copy '%s' to '%s'" % (src, dst)) os.makedirs(directory, exist_ok=True) try: copyfile(src, dst, follow_symlinks=True) except FileNotFoundError: pass<|fim_prefix|># repo: aihill/google-landmarks path: /prepare_train_data.py #!/usr/bin/python...
code_fim
hard
{ "lang": "python", "repo": "aihill/google-landmarks", "path": "/prepare_train_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def dict_to_list(cls, deductions): deductions_list = [] for deduction in deductions: deductions_list.append({"payee": deduction, "points": deductions[deduction]}) return deductions_list transactions = UserTransactions() class TransactionsException...
code_fim
hard
{ "lang": "python", "repo": "utkarshban/take-home-test", "path": "/src/user_transactions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: utkarshban/take-home-test path: /src/user_transactions.py import heapq from collections import defaultdict class UserTransactions: def __init__(self): self.transactions_heap = [] self.payer_points = defaultdict(int) self.total_user_points = 0 def add_transaction(s...
code_fim
hard
{ "lang": "python", "repo": "utkarshban/take-home-test", "path": "/src/user_transactions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> listofnumbers = [0,1,2,3,4,5,6,7,8,9,10,11,12] userinput = int(input("give me a number between 0,12")) numgreat = 0 numequal = 0 numsmall = 0 for element in listofnumbers: if(element > userinput): numgreat+=1 elif(element == userinput): num...
code_fim
hard
{ "lang": "python", "repo": "cs-fullstack-2019-spring/python-arraycollections-cw-tdude0175", "path": "/array_cw1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> nicknamelist ={"Jonathan":"John", "Michael":"Mike", "William":"Bill", "Robert":"Rob"} for x in nicknamelist: print(f"{x} {nicknamelist[x]}") print(nicknamelist["William"]) # Create an array of 5 numbers. Using a loop, print the elements in the array reverse ord...
code_fim
hard
{ "lang": "python", "repo": "cs-fullstack-2019-spring/python-arraycollections-cw-tdude0175", "path": "/array_cw1.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cs-fullstack-2019-spring/python-arraycollections-cw-tdude0175 path: /array_cw1.py def main(): # problem1() # problem2() # problem3() # problem4() problem5() # Create a function with the variable below. After you create the variable do the instructions below that. # # arrayFo...
code_fim
hard
{ "lang": "python", "repo": "cs-fullstack-2019-spring/python-arraycollections-cw-tdude0175", "path": "/array_cw1.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>['m2'] == 5. metrics = metrics.reset() metrics = metrics.update(m1=1., m2=1.) assert metrics['m1'] == 1. assert metrics['m2'] == 1. metrics = metrics.reset() with pytest.raises(ZeroDivisionError): metrics['m1']<|fim_prefix|># repo: n2cholas/htn-ml-productivity-workshop pat...
code_fim
medium
{ "lang": "python", "repo": "n2cholas/htn-ml-productivity-workshop", "path": "/src/tests/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: n2cholas/htn-ml-productivity-workshop path: /src/tests/test_utils.py import pytest from utils import MetricsGroup def test_metrics_group(): metrics = MetricsGroup('m1', 'm2') met<|fim_suffix|>assert metrics['m2'] == 1. metrics = metrics.reset() with pytest.raises(ZeroDivisionEr...
code_fim
hard
{ "lang": "python", "repo": "n2cholas/htn-ml-productivity-workshop", "path": "/src/tests/test_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>assert metrics['m2'] == 1. metrics = metrics.reset() with pytest.raises(ZeroDivisionError): metrics['m1']<|fim_prefix|># repo: n2cholas/htn-ml-productivity-workshop path: /src/tests/test_utils.py import pytest from utils import MetricsGroup def test_metrics_group(): metrics = Metri...
code_fim
hard
{ "lang": "python", "repo": "n2cholas/htn-ml-productivity-workshop", "path": "/src/tests/test_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mofhu/algorithm-workbook path: /chap3/run.py from sys import argv import os script, source = argv <|fim_suffix|>subprocess.run(["clang", source, '-Wall', '-o', source[:-3]+'o']) # clang -o if source[:-3]+'in' in os.listdir(): print(script, source, "<", source[:-3] + 'in') subprocess.r...
code_fim
easy
{ "lang": "python", "repo": "mofhu/algorithm-workbook", "path": "/chap3/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if source[:-3]+'in' in os.listdir(): print(script, source, "<", source[:-3] + 'in') subprocess.run(["./"+ source[:-3]+'o'], stdin=open(source[:-3]+'in')) # delete .cpp and add .in else: print(script, source) subprocess.run(["./"+ source[:-3]+'o'])<|fim_prefix|># repo: m...
code_fim
medium
{ "lang": "python", "repo": "mofhu/algorithm-workbook", "path": "/chap3/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }