text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: hscspring/The-DataStructure-and-Algorithms path: /LeetCode/103-Binary-Tree-Zigzag-Level-Order-Traversal/Binary-Tree-Zigzag-Level-Order-Traversal.py # Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self....
code_fim
hard
{ "lang": "python", "repo": "hscspring/The-DataStructure-and-Algorithms", "path": "/LeetCode/103-Binary-Tree-Zigzag-Level-Order-Traversal/Binary-Tree-Zigzag-Level-Order-Traversal.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>: 226, ' r ': 227, ' ra': 228, ' ri': 229, ' ss': 230, ' st': 231, ' ta': 232, ' te': 233, ' tr': 234, ' ub': 235, ' un': 236, ' vi': 237, ' vo': 238, 'a f': 239, 'a i': 240, 'a l': 241, 'a m': 242, 'a o': 243, 'a r': 244, 'ach': 245, 'aci': 246, 'act': 247, 'ad ': 248, 'afa': 249, ...
code_fim
hard
{ "lang": "python", "repo": "benzhang13/microblog", "path": "/venv/lib/python3.7/site-packages/guess_language/data/models/pt_pt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: benzhang13/microblog path: /venv/lib/python3.7/site-packages/guess_language/data/models/pt_pt.py # -*- coding: utf-8 -*- model = { 'equ': 0, 'ent': 1, 'que': 2, 'qui': 3, 'gui': 4, 'uen': 5, ' li': 6, 'ngu': 7, 'qu ': 8, 'uid': 9, ' co': 10, ' ve': 11, 'de ': 12, 'gue': 13, 'ida': ...
code_fim
hard
{ "lang": "python", "repo": "benzhang13/microblog", "path": "/venv/lib/python3.7/site-packages/guess_language/data/models/pt_pt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _events = dict() def __new__(cls, *args, **kwargs): inst = super(BaseTasks, cls).__new__(cls) for task in dir(cls): if not task.startswith('_'): name = task.replace('_', ':') inst._events[name] = getattr(cls, task) return inst ...
code_fim
hard
{ "lang": "python", "repo": "peekwez/rock", "path": "/rock/svc.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass def _setup_tasks(self, tasks, max_workers=2): self._queue = multiprocessing.Queue() self._consumers = [ Consumer(tasks, self._queue, self._log) for k in range(max_workers) ] def _start_consumers(self): for w in self._consumers:...
code_fim
hard
{ "lang": "python", "repo": "peekwez/rock", "path": "/rock/svc.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: peekwez/rock path: /rock/svc.py import sys import platform import signal import functools import inspect import collections import multiprocessing import subprocess from . import utils, mdp, sas, msg, repo RequestParser = collections.namedtuple( 'RequestParser', ('method', 'args') ) GIT_I...
code_fim
hard
{ "lang": "python", "repo": "peekwez/rock", "path": "/rock/svc.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: manala/ansible-roles path: /tests/unit/plugins/modules/test_php_extension.py from __future__ import (absolute_import, division, print_function) __metaclass__ = type from ansible.module_utils.basic import AnsibleModule from ansible_collections.manala.roles.tests.unit.compat import mock from ansib...
code_fim
hard
{ "lang": "python", "repo": "manala/ansible-roles", "path": "/tests/unit/plugins/modules/test_php_extension.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_enabled(self): set_module_args(dict( name='module_foo', enabled=True, )) def run_phpquery_side_effect(module, args): return { '-V': (0, '1.2\n3.4', ''), # Get versions '-v 1.2 ...
code_fim
hard
{ "lang": "python", "repo": "manala/ansible-roles", "path": "/tests/unit/plugins/modules/test_php_extension.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: facebookresearch/Kats path: /kats/tests/utils/test_datapartition.py # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List, NamedTuple, ...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/Kats", "path": "/kats/tests/utils/test_datapartition.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>RAW_STDP_RES: List[List[TrainTestData]] = [ [TrainTestData(train=TS[:5], test=TS[7:])], [ TrainTestData( train={0: TimeSeriesData(), 1: TimeSeriesData()}, test={0: TS, 1: TS} ) ], [TrainTestData(train=[TimeSeriesData(), TimeSeriesData()], test=[TS[7:], TS[7:]])]...
code_fim
hard
{ "lang": "python", "repo": "facebookresearch/Kats", "path": "/kats/tests/utils/test_datapartition.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ganeshghimire1986/watershed_workflow path: /workflow/hilev.py impler geometries. This is work in progress. .. note: Pruning is only possible for reaches which include an 'area' property. Currently this only includes NHDPlus hydrography. Returns ------- ...
code_fim
hard
{ "lang": "python", "repo": "ganeshghimire1986/watershed_workflow", "path": "/workflow/hilev.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ganeshghimire1986/watershed_workflow path: /workflow/hilev.py c, len(huc), out_crs, digits) logging.info(f"... found {len(hu_shapes)}") assert(len(hu_shapes) == 1) return out_crs, hu_shapes[0] def get_hucs(source, huc, level, out_crs=None, digits=None): """Get shape objects for ...
code_fim
hard
{ "lang": "python", "repo": "ganeshghimire1986/watershed_workflow", "path": "/workflow/hilev.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> refine_funcs = [] if refine_max_area != None: refine_funcs.append(workflow.triangulation.refine_from_max_area(refine_max_area)) if refine_distance != None: refine_funcs.append(workflow.triangulation.refine_from_river_distance(*refine_distance, rivers)) if refine_max_edge_le...
code_fim
hard
{ "lang": "python", "repo": "ganeshghimire1986/watershed_workflow", "path": "/workflow/hilev.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fagan2888/CSCI699ml4know path: /hw1/classifier/base.py """ Define base classifier that all subclass must follow """ import utils.conlleval as conlleval from utils.data_converter import append_column, data_to_output class BaseClassifier(object): def fit(self, train_sentences, val_sentences,...
code_fim
medium
{ "lang": "python", "repo": "fagan2888/CSCI699ml4know", "path": "/hw1/classifier/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> y_pred = self.predict(sentences) new_sents = append_column(sentences, y_pred) precision, recall, f1_score = conlleval.my_evaluate(data_to_output(new_sents)) return precision, recall, f1_score def predict(self, sentences): raise NotImplementedError def save...
code_fim
hard
{ "lang": "python", "repo": "fagan2888/CSCI699ml4know", "path": "/hw1/classifier/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.parametrize("doc", documents) def test_graph_size(doc): fdoc = Forcy(doc) assert len(fdoc.graph.nodes) == len(doc) assert len(fdoc.graph.edges) == (len(doc) - 1) @pytest.mark.parametrize("prog", ["dot", "twopi", "fdp", "sfdp"]) @pytest.mark.parametrize("doc", documents) def tes...
code_fim
medium
{ "lang": "python", "repo": "koaning/forcy", "path": "/tests/test_graph_creation.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: koaning/forcy path: /tests/test_graph_creation.py import pathlib import pytest from forcy import Forcy from spacy.tokens import Doc from spacy.vocab import Vocab documents = [Doc(Vocab()).from_disk(p) for p in pathlib.Path("tests/docs").glob("*")] <|fim_suffix|> fdoc = Forcy(doc) asse...
code_fim
medium
{ "lang": "python", "repo": "koaning/forcy", "path": "/tests/test_graph_creation.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class HTCondorError(CondorpyBaseException): pass<|fim_prefix|># repo: ajkerr0/htpython path: /htpython/exceptions.py class CondorpyBaseException(Exception): pass <|fim_middle|>class NoExecutable(CondorpyBaseException): pass
code_fim
easy
{ "lang": "python", "repo": "ajkerr0/htpython", "path": "/htpython/exceptions.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ajkerr0/htpython path: /htpython/exceptions.py class CondorpyBaseException(Exception): <|fim_suffix|> pass class HTCondorError(CondorpyBaseException): pass<|fim_middle|> pass class NoExecutable(CondorpyBaseException):
code_fim
easy
{ "lang": "python", "repo": "ajkerr0/htpython", "path": "/htpython/exceptions.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AllenInstitute/bmtk path: /bmtk/tests/builder/test_node_set.py import pytest from bmtk.builder.node_set import NodeSet from bmtk.builder.node import Node from bmtk.builder.id_generator import IDGenerator def test_node_set(): generator = IDGenerator() node_set = NodeSet(N=100, ...
code_fim
medium
{ "lang": "python", "repo": "AllenInstitute/bmtk", "path": "/bmtk/tests/builder/test_node_set.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def test_node(): node_set1 = NodeSet(N=100, node_params={'param1': range(100)}, node_type_properties={'prop1': 'prop1', 'node_type_id': 1}) nodes = node_set1.build(IDGenerator()) node_1 = nodes[0] assert(node_1.node_id == 0) assert(node_1...
code_fim
hard
{ "lang": "python", "repo": "AllenInstitute/bmtk", "path": "/bmtk/tests/builder/test_node_set.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if message.endswith("?"): if self.observation: return "It has maybe something to do with " + self.observation["image"] else: return "I dont know" return "I do not understand" def __predict_move_action(self, message: str) -> str:...
code_fim
hard
{ "lang": "python", "repo": "rafiberlin/sose21-pm-language-and-vision-g1", "path": "/avatar/game_avatar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(observation) # for debugging actions = dict() if observation["image"]: self.__update_observation(observation) if observation["message"]: self.__update_actions(actions, observation["message"]) return actions def __update_observatio...
code_fim
hard
{ "lang": "python", "repo": "rafiberlin/sose21-pm-language-and-vision-g1", "path": "/avatar/game_avatar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rafiberlin/sose21-pm-language-and-vision-g1 path: /avatar/game_avatar.py """ Avatar action routines """ DIRECTION_TO_WORD = { "n": "north", "e": "east", "w": "west", "s": "south" } def direction_to_word(direction: str): if direction in DIRECTION_TO_WORD: return ...
code_fim
hard
{ "lang": "python", "repo": "rafiberlin/sose21-pm-language-and-vision-g1", "path": "/avatar/game_avatar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Text Cleaning text = unidecode.unidecode(text.lower().strip()) token = toknizer.tokenize(text) return " ".join( ["".join([self.char_encrypt(l) if l.isalpha() else l for l in word]) for word in token if word n...
code_fim
hard
{ "lang": "python", "repo": "JeanneGasser/basic_cypting", "path": "/crypting_rot13.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return " ".join( ["".join([self.char_encrypt(l) if l.isalpha() else l for l in word]) for word in token if word not in punctuation]) #User interface print("Lancement du programme...") print("Si vous souhaitez décrypter un texte, entr...
code_fim
medium
{ "lang": "python", "repo": "JeanneGasser/basic_cypting", "path": "/crypting_rot13.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JeanneGasser/basic_cypting path: /crypting_rot13.py # -*- coding: utf-8 -*- """ Created on Wed Oct 3 16:33:40 2018 @author: jeann """ print("import packages") from nltk import RegexpTokenizer toknizer = RegexpTokenizer(r'''\w'|\w+|[^\w\s]''') from string import punctuation import unid...
code_fim
hard
{ "lang": "python", "repo": "JeanneGasser/basic_cypting", "path": "/crypting_rot13.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if hptoo: self.currentStats = dict(self.stats) else: self.currentStats = dict(self.stats, HP=self.currentStats['HP']) class Battle: def __init__(self, party1, party2, master, AI=True): self.player1 = party1 self.player2 = party2 self.ma...
code_fim
hard
{ "lang": "python", "repo": "pyroy/Pykemon", "path": "/pokepy/pokemon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyroy/Pykemon path: /pokepy/pokemon.py ##################################### #/---------------------------------\# #| pokemon.py v3.4 by Roy Prins |# #| |# #| requires (in same folder): |# #| - m_db.py |# #| ...
code_fim
hard
{ "lang": "python", "repo": "pyroy/Pykemon", "path": "/pokepy/pokemon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not self.battlestart: print('no.') else: if self.player1chosen and self.player2chosen: if self.pok1.cSPD > self.pok2.cSPD: self.player1action[0](*self.player1action[1]) if not self.check_endbattle(): ...
code_fim
hard
{ "lang": "python", "repo": "pyroy/Pykemon", "path": "/pokepy/pokemon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1120161891/SyzScope path: /syzscope/interface/vm/state.py import os import angr from pwn import * from .kernel import Kernel from .monitor import Monitor class VMState: ADDRESS = 1 INITIAL = 0 KERNEL_BASE = 0 def __init__(self, linux, gdb_port, arch, log_suffix="", proj_path=No...
code_fim
hard
{ "lang": "python", "repo": "1120161891/SyzScope", "path": "/syzscope/interface/vm/state.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def back_to_kasan_ret(self): if self.__check_initialization(): return if len(self.kasan_addr[1]) > 0: self.gdb.del_breakpoint() for each in self.kasan_addr[1]: self.gdb.set_breakpoint(each) self.gdb.resume() def back_to_c...
code_fim
hard
{ "lang": "python", "repo": "1120161891/SyzScope", "path": "/syzscope/interface/vm/state.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhangwang0537/LeetCode-Notebook path: /source/Clarification/Array/253.会议室Ⅱ.py # 给定一个会议时间安排的数组,每个会议时间都会包括开始和结束的时间 [[s1,e1],[s2,e2],...] (si < ei),为避免会议冲突,同时要考虑充分利用会议室资源,请你计算至少需要多少间会议室,才能满足这些会议安排。 # # 示例 1: # # 输入: [[0, 30],[5, 10],[15, 20]] # 输出: 2 # 示例 2: # # 输入: [[7,10],[2,4]] # 输出: 1 ...
code_fim
medium
{ "lang": "python", "repo": "zhangwang0537/LeetCode-Notebook", "path": "/source/Clarification/Array/253.会议室Ⅱ.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # if there is no meeting to schedule then no room needs to be allocated. if not intervals: return 0 # The heap initialization free_rooms = [] # 用数组实现堆。。? # Sort the meetings in increasing order of their start time. intervals.sort(key = l...
code_fim
medium
{ "lang": "python", "repo": "zhangwang0537/LeetCode-Notebook", "path": "/source/Clarification/Array/253.会议室Ⅱ.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :return: responseStr: JSON response string from Vault API call """ headers = {'Authorization': sessionId,'Content-Type': 'application/json','Accept': 'application/json'} responseStr = requests.put(url, params=params, json=body, headers=headers) response = json.loads(responseStr.content...
code_fim
hard
{ "lang": "python", "repo": "veeva/vsdk-spark-external-aws-sample", "path": "/aws-lambda-samples/vsdkSparkSampleProcessMessage/vault_rest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: veeva/vsdk-spark-external-aws-sample path: /aws-lambda-samples/vsdkSparkSampleProcessMessage/vault_rest.py import json from botocore.vendored import requests # # Global constants # VAULT_REST_API_SUCCESS = 'SUCCESS' VAULT_REST_API_FAILURE = 'FAILURE' VAULT_REST_API_BURST_BREACH = 'BURST_BREACH' ...
code_fim
hard
{ "lang": "python", "repo": "veeva/vsdk-spark-external-aws-sample", "path": "/aws-lambda-samples/vsdkSparkSampleProcessMessage/vault_rest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if y_max < np.max(rad): y_max=np.max(rad) plt.ylim([0,y_max*1.1]) plt.xlabel('distance into pore (z axis $\AA$)') plt.ylabel('pore radius $\AA$') plt.plot(z,rad,label=legend[i]) plt.legend() #plt.savefig('test.pdf') plt.title('Comparison Between Flooded Structure and...
code_fim
hard
{ "lang": "python", "repo": "Miro-Astore/mdanalysis_scripts", "path": "/graph_hole.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Miro-Astore/mdanalysis_scripts path: /graph_hole.py import MDAnalysis as mda import re import matplotlib.pyplot as plt import numpy as np #data=np.loadtxt('../lastframe.sph',dtype=str) #rad=np.array(data[:,-1],dtype=float) #print (rad) #z=np.array(data[:,8],dtype=float)[rad<12] #rad=rad[rad<1...
code_fim
hard
{ "lang": "python", "repo": "Miro-Astore/mdanalysis_scripts", "path": "/graph_hole.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> plt.xlabel('distance into pore (z axis $\AA$)') plt.ylabel('pore radius $\AA$') plt.plot(z,rad,label=legend[i]) plt.legend() #plt.savefig('test.pdf') plt.title('Comparison Between Flooded Structure and Cryo EM Structure') plt.show()<|fim_prefix|># repo: Miro-Astore/mdanalysis_scripts pa...
code_fim
medium
{ "lang": "python", "repo": "Miro-Astore/mdanalysis_scripts", "path": "/graph_hole.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/edit-user', methods=['GET', 'POST']) def edit_user(): if request.method == 'POST': id = request.form['user_id'] first_name = request.form['first_name'] last_name = request.form['last_name'] old_first_name = request.form['old_first_name'] old_...
code_fim
hard
{ "lang": "python", "repo": "shreyasbapat/realtime_face_identification", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shreyasbapat/realtime_face_identification path: /app.py import os import cv2 import sys import time import shutil import imutils import argparse import threading import datetime from face_id import FaceIdentifier from imutils.video import VideoStream from flask_sqlalchemy import SQLAlc...
code_fim
hard
{ "lang": "python", "repo": "shreyasbapat/realtime_face_identification", "path": "/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # grab global references to the video stream, output frame, and # lock variables global vs, outputFrame, detection_result, lock if vs == False: print("[ERROR] There was some problem opening camera video stream") sys.exit(1) face_id = FaceIdentifier() # ...
code_fim
hard
{ "lang": "python", "repo": "shreyasbapat/realtime_face_identification", "path": "/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jameshensman/VFF path: /experiments/increasing_dim/Exp_2/gen_data.py import numpy as np import gpflow from config import * def prodkern(dim): return gpflow.kernels.Prod([gpflow.kernels.Matern32(1, active_dims=[i], lengthscales=lengthscale) for i in range(dim)...
code_fim
hard
{ "lang": "python", "repo": "jameshensman/VFF", "path": "/experiments/increasing_dim/Exp_2/gen_data.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> np.savez('data/data_dim{}_rep{}.npz'.format(dim, r), Xtrain=Xtrain, Xtest=Xtest, Ytrain=Ytrain, Ytest=Ytest)<|fim_prefix|># repo: jameshensman/VFF path: /experiments/increasing_dim/Exp_2/gen_data.py import numpy as np import gpflow from config import * def prodkern(dim): re...
code_fim
hard
{ "lang": "python", "repo": "jameshensman/VFF", "path": "/experiments/increasing_dim/Exp_2/gen_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>np.random.seed(0) for dim in dimensions: k = prodkern(dim) + gpflow.kernels.White(1, variance=noise_var) for r in range(repeats): print('gen_data: dimension{} repeat{}'.format(dim,r)) X = np.random.rand(num_train + num_test, dim) K = k.compute_K_symm(X) L = np.linal...
code_fim
medium
{ "lang": "python", "repo": "jameshensman/VFF", "path": "/experiments/increasing_dim/Exp_2/gen_data.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlockett42/spreadsheet-historygraph-cavorite path: /spreadsheet/accounts/managers.py # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals, print_function from django.contrib.auth.models import BaseUserManager class UserManager(BaseUserManager): <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "mlockett42/spreadsheet-historygraph-cavorite", "path": "/spreadsheet/accounts/managers.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def create_superuser(self, email, password, **extra_fields): """Creates and saves a user with ``is_superuser`` set to ``True```.""" return self.create_user(email, password, is_staff=True, is_superuser=True, **extra_fields)<|fim_prefix|># repo: mlockett42...
code_fim
medium
{ "lang": "python", "repo": "mlockett42/spreadsheet-historygraph-cavorite", "path": "/spreadsheet/accounts/managers.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: BenJamesbabala/AlwaysBeDreaming-DFCIL path: /dataloaders/utils.py import os import os.path import hashlib import errno from torchvision import transforms dataset_stats = { 'CIFAR10' : {'mean': (0.49139967861519607, 0.48215840839460783, 0.44653091444546567), 'std' : (0.247032...
code_fim
hard
{ "lang": "python", "repo": "BenJamesbabala/AlwaysBeDreaming-DFCIL", "path": "/dataloaders/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not os.path.isfile(fpath): return False md5o = hashlib.md5() with open(fpath, 'rb') as f: # read in 1MB chunks for chunk in iter(lambda: f.read(1024 * 1024), b''): md5o.update(chunk) md5c = md5o.hexdigest() if md5c != md5: return False ...
code_fim
hard
{ "lang": "python", "repo": "BenJamesbabala/AlwaysBeDreaming-DFCIL", "path": "/dataloaders/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: psu1/Mask-RCNN path: /models/fpn.py ''' FPN Graph ''' import torch.nn as nn import torch.nn.functional as F from tools.py_utils import SamePad2d class TopDownLayer(nn.Module): def __init__(self, in_channels, out_channels): super(TopDownLayer, self).__init__() self.conv1 = n...
code_fim
hard
{ "lang": "python", "repo": "psu1/Mask-RCNN", "path": "/models/fpn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> y = F.upsample(y, scale_factor=2) x = self.conv1(x) return self.conv2(self.padding2(x+y)) class FPN(nn.Module): def __init__(self, C1, C2, C3, C4, C5, out_channels): super(FPN, self).__init__() self.out_channels = out_channels self.C1 = C1 self....
code_fim
medium
{ "lang": "python", "repo": "psu1/Mask-RCNN", "path": "/models/fpn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> access_token = create_access_token(identity=username) refresh_token = create_refresh_token(identity=username) current_user = get_jwt_identity() mesg = { 'message': 'Logged in as {}'.format(current_user), 'access_token': access_token, 'refresh_token': refresh_token ...
code_fim
hard
{ "lang": "python", "repo": "danuluma/andela-project", "path": "/app/api/v1/auth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danuluma/andela-project path: /app/api/v1/auth.py from flask_restful import Resource, reqparse from flask import Flask, jsonify, request from flask_jwt_extended import ( jwt_required, create_access_token, jwt_refresh_token_required, create_refresh_token, get_jwt_identity, ) users =...
code_fim
hard
{ "lang": "python", "repo": "danuluma/andela-project", "path": "/app/api/v1/auth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrexodia/yamlpp path: /yamlpp/__main__.py import ruamel.yaml import sys original_write_comment = None already_written = set() def hook_write_comment(emitter, comment, pre=False): global already_written, original_write_comment if comment.value.isspace(): # whitespace-only co...
code_fim
hard
{ "lang": "python", "repo": "mrexodia/yamlpp", "path": "/yamlpp/__main__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: with open(sys.argv[1], "rb") as infile: in_yml = infile.read() if len(sys.argv) > 2: with open(sys.argv[2], "wb") as outfile: yamlpp(in_yml, outfile) else: yamlpp(in_yml, sys.stdout) except IOError as e: ...
code_fim
hard
{ "lang": "python", "repo": "mrexodia/yamlpp", "path": "/yamlpp/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) > 2: with open(sys.argv[2], "wb") as outfile: yamlpp(in_yml, outfile) else: yamlpp(in_yml, sys.stdout) except IOError as e: print(e) sys.exit(1) if __name__ == "__main__": main()<|fim_prefix|># re...
code_fim
hard
{ "lang": "python", "repo": "mrexodia/yamlpp", "path": "/yamlpp/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ujjwal-gupta/data-problems path: /bonus/prerequisites.py from collections import OrderedDict class TaskExecutor: def __init__(self, relation_path, task_id_path): self.relation_path = relation_path self.task_id_path = task_id_path self.task_dependencies = self.__get_...
code_fim
hard
{ "lang": "python", "repo": "ujjwal-gupta/data-problems", "path": "/bonus/prerequisites.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return task_dependencies @staticmethod def __get_start_goal_task(question_path): """ Extracts starting tasks as a Set and goal task from question file """ start = None goal = None with open(question_path) as question: for line in quest...
code_fim
hard
{ "lang": "python", "repo": "ujjwal-gupta/data-problems", "path": "/bonus/prerequisites.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return start, goal def __visit_task_nodes(self, curr_node, start_nodes): """ Depth first recursive visit of dependency DAG with a direct return if no dependencies or node is a starting task :param curr_node: current node in recursion :param start_nodes: starti...
code_fim
hard
{ "lang": "python", "repo": "ujjwal-gupta/data-problems", "path": "/bonus/prerequisites.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>f(O) :- csv_read_row(user_input,R,O), R \= end_of_file, !, process(R,RR), csv_write_stream(user_output, [RR], []), f(O). f(_). main(_Argv) :- prompt(_, ''), csv_options(O,[]), f(O).<|fim_prefix|># repo: tkilias/script-languages path: /emulator/script5.py #input_column: a,string,VARCHAR(100),100,None,N...
code_fim
easy
{ "lang": "python", "repo": "tkilias/script-languages", "path": "/emulator/script5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>main(_Argv) :- prompt(_, ''), csv_options(O,[]), f(O).<|fim_prefix|># repo: tkilias/script-languages path: /emulator/script5.py #input_column: a,string,VARCHAR(100),100,None,None #input_column: b,string,VARCHAR(100),100,None,None #input_type: SET <|fim_middle|>#output_column: b,string,VARCHAR(100),100,N...
code_fim
hard
{ "lang": "python", "repo": "tkilias/script-languages", "path": "/emulator/script5.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tkilias/script-languages path: /emulator/script5.py #input_column: a,string,VARCHAR(100),100,None,None #input_column: b,string,VARCHAR(100),100,None,None #input_type: SET <|fim_suffix|> process(row(A,B),row(A)). f(O) :- csv_read_row(user_input,R,O), R \= end_of_file, !, process(R,RR), csv_write...
code_fim
medium
{ "lang": "python", "repo": "tkilias/script-languages", "path": "/emulator/script5.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anglixjtu/MeshCNN_ path: /src/options/load_options.py def load_model_opt(path, opt=None): if not opt: opt = type('Opt', (object,), {})() load_list = {'arch': str, 'fc_n': int, 'input_nc': int, 'mode': str, 'ncf': list, 'neigbs': int, 'ninput_edges...
code_fim
hard
{ "lang": "python", "repo": "anglixjtu/MeshCNN_", "path": "/src/options/load_options.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> setattr(opt, name, [int(x) for x in value]) else: value = load_list[name](value) setattr(opt, name, value) return opt<|fim_prefix|># repo: anglixjtu/MeshCNN_ path: /src/options/load_options.py def load_model_opt(path, opt=None): i...
code_fim
hard
{ "lang": "python", "repo": "anglixjtu/MeshCNN_", "path": "/src/options/load_options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Unable to translate the specified address @param address address which failed to be translated @param write true if memory operation was a write vs. read @return true if fault was handled """ ... @overload def wait(self) -> None: ... ...
code_fim
hard
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/pcode/memstate/MemoryFaultHandler.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kohnakagawa/ghidra_scripts path: /ghidra9.2.1_pyi/ghidra/pcode/memstate/MemoryFaultHandler.pyi from typing import List import ghidra.program.model.address import java.lang class MemoryFaultHandler(object): def equals(self, __a0: object) -> bool: ... <|fim_suffix|> def uninitial...
code_fim
medium
{ "lang": "python", "repo": "kohnakagawa/ghidra_scripts", "path": "/ghidra9.2.1_pyi/ghidra/pcode/memstate/MemoryFaultHandler.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # call 'func' several times, so that memory consumption # stabilizes: for j in range(loops[0]): for k in range(loops[1]): func() gc.collect(); gc.collect(); gc.collect() bytes = wss() # call 'func' several times, recording the dif...
code_fim
hard
{ "lang": "python", "repo": "JoaoSevergnini/metalpy", "path": "/virt/Lib/site-packages/comtypes/test/find_memleak.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoaoSevergnini/metalpy path: /virt/Lib/site-packages/comtypes/test/find_memleak.py from __future__ import print_function import unittest, gc from ctypes import * from ctypes.wintypes import * ################################################################ class PROCESS_MEMORY_COUNTERS(Structur...
code_fim
hard
{ "lang": "python", "repo": "JoaoSevergnini/metalpy", "path": "/virt/Lib/site-packages/comtypes/test/find_memleak.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tavuong/aidem path: /app_qingyuan/Difference/dct-vuong.py # VUONG-DCT.py # Frame Work für DCT Bilder # Status: Entwicklung # Berechen DCT eines Bilders aus JPEG mit OPencv # Der Vorgang wird analyse # Die Spektrum wird als Jpeg-Bilde rerzeugt! # Die Matrix des Spektrum wird: # - direckt in der Re...
code_fim
hard
{ "lang": "python", "repo": "tavuong/aidem", "path": "/app_qingyuan/Difference/dct-vuong.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('*************** Reconstruierte Bild berechnen ****************') imgIDCT = idct_2d(imgDCT) # zu jpg schreiben # cv2.imwrite(config.imageReconstruct, idct_img) imgIDCT = imgWRITE(config.imageReconstruct,imgIDCT,1) print('*************** Spectrum aus Reconst_Berechnen zum Test **************...
code_fim
hard
{ "lang": "python", "repo": "tavuong/aidem", "path": "/app_qingyuan/Difference/dct-vuong.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert test_item.currency_iso_code == '0826' assert test_item.constant_symbol == '0055000000' assert test_item.name == u'ALBATROS MEDIA A.S.' assert test_item.info.date == datetime.datetime(year=2014, day=26, month=9) assert test_item.info.comment == u'OP00140925501199' assert te...
code_fim
hard
{ "lang": "python", "repo": "baldman/pybankreader", "path": "/tests/test_gpc_reports.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: baldman/pybankreader path: /tests/test_gpc_reports.py import datetime from six import StringIO from pybankreader.formats.gpc.records import AccountRecord, ItemRecord, \ ItemInfoRecord, ItemRemittance1Record, ItemRemittance2Record from pybankreader.formats.gpc.reports import AccountReport, Acc...
code_fim
hard
{ "lang": "python", "repo": "baldman/pybankreader", "path": "/tests/test_gpc_reports.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> output_dir = ctx["OutputDir"] # start server class RequestHandler(SimpleHTTPRequestHandler): def do_GET(self): if hasattr(self, "error") and self.error is not None: self.send_response(200, 'OK') self.send_header('Content-type', 'html') ...
code_fim
hard
{ "lang": "python", "repo": "qema/nanosite", "path": "/nanosite/server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qema/nanosite path: /nanosite/server.py import nanosite.util as util import nanosite.build as build import os from datetime import datetime from traceback import print_exc as trace_print_exc from traceback import format_exc as trace_format_exc from time import sleep from http.server import Simpl...
code_fim
hard
{ "lang": "python", "repo": "qema/nanosite", "path": "/nanosite/server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ordering = ["exercise_title"] def __str__(self): return self.exercise_title def get_number_of_favorisations(self): return len(Favorisation.objects.filter( exercise__id=self.id )) def get_rating_score(self): ratings = [r.rating_number for r...
code_fim
hard
{ "lang": "python", "repo": "sigrunnu/programvareutviklingV2020", "path": "/feed/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sigrunnu/programvareutviklingV2020 path: /feed/models.py from django.contrib.auth.models import User from django.contrib.postgres.search import SearchVector from django.db import models from django.db.models import Q, SET_NULL from six import python_2_unicode_compatible from profile_page.models ...
code_fim
hard
{ "lang": "python", "repo": "sigrunnu/programvareutviklingV2020", "path": "/feed/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.version: print('bfi %s' % bfi.__version__) return if not args.file: print('Please specify a brainfuck source file') return with open(args.file, 'r') as fh: prog = fh.read() if args.intermediate: for opcode in bfi.parse(prog): ...
code_fim
hard
{ "lang": "python", "repo": "eriknyquist/bfi", "path": "/bin/bfi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eriknyquist/bfi path: /bin/bfi #!/usr/bin/env python import os import argparse import bfi def main(): parser = argparse.ArgumentParser(description="Brainfuck interpreter") parser.add_argument('file', type=str, nargs='?', help="Brainfuck source file to interpret") parser.ad...
code_fim
hard
{ "lang": "python", "repo": "eriknyquist/bfi", "path": "/bin/bfi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: catboost/catboost path: /contrib/python/Pygments/py3/pygments/styles/staroffice.py """ pygments.styles.staroffice ~~~~~~~~~~~~~~~~~~~~~~~~~~ Style similar to StarOffice style, also in OpenOffice and LibreOffice. <|fim_suffix|> styles = { Token: '#000080',...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/Pygments/py3/pygments/styles/staroffice.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Style similar to StarOffice style, also in OpenOffice and LibreOffice. """ styles = { Token: '#000080', # Blue Comment: '#696969', # DimGray Error: '#800000', # Maroon Literal: '#EE00...
code_fim
hard
{ "lang": "python", "repo": "catboost/catboost", "path": "/contrib/python/Pygments/py3/pygments/styles/staroffice.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Phuong39/TaurusTrade-platform-go path: /gateway-szkingdom/lib/demo.py import ctypes so = ctypes.cdll.LoadLibrary lib = so("./extern_demo.dll") # print(lib.Add) # print(lib.Add(3,5)) # # /** 初始化信息 ST_tagInitInfo (Define.h) */ # # typedef struct # # { # # char szUserName[32]; ...
code_fim
hard
{ "lang": "python", "repo": "Phuong39/TaurusTrade-platform-go", "path": "/gateway-szkingdom/lib/demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # int InitPlugin(PST_tagInitInfo pInitInfo, ST_tagKCBP_CONFIG& tagKcbpConfig, int nThreads = 1, char* pszLogName = "", char* pszAlgoName = OEM_PRODUCT_NAME, int bLogOpenFlag = 0); //fengwc alter 7.27 # lib.InitPlugin.argtypes = ( # ctypes.POINTER(ST_tagInitInfo), # ctypes.POINTER(ST_tagKCBP_...
code_fim
hard
{ "lang": "python", "repo": "Phuong39/TaurusTrade-platform-go", "path": "/gateway-szkingdom/lib/demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(10000): if distance(robot, goal) < 1: print(distance(robot, goal)) break ax.set_xlim([-10,30]) ax.set_ylim([-10,30]) #ax.plot([robot[0]],[robot[1]], 'bo') circle1 = plt.Circle((robot[0], robot[1]), r_robot, color='b') ax.add_patch(circle1) #ax.scatter(goal[0],goal[1],'g') #ax.sc...
code_fim
hard
{ "lang": "python", "repo": "Vikr-182/robotics-planning-algorithms", "path": "/VO/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def check_collision(robot, obs_init): print(robot) print(obs_init) for i in obs_init: if abs(robot[0] - i[0]) <= 0.1 and abs(robot[1] - i[1]) <= 0.1: print("COLLISION") return 1 return 0 for i in range(10000): if distance(robot, goal) < 1: print(distance(robot, goal)) break ax.set_xlim(...
code_fim
hard
{ "lang": "python", "repo": "Vikr-182/robotics-planning-algorithms", "path": "/VO/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vikr-182/robotics-planning-algorithms path: /VO/main.py import numpy as np import time import math import matplotlib.pyplot as plt robot = [0,0] r_robot = 0.1 goal = [20,10] obs_init = [[6,0], [0,6], [4,0],[2,1]]#, [25,]]#, [0,7], [7,0],[10,10]] obs_vel = [[-0.3,.3],[.3,0], [-.3,0],[0,-.3]]#, ...
code_fim
hard
{ "lang": "python", "repo": "Vikr-182/robotics-planning-algorithms", "path": "/VO/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Attention arguments parser.add_argument('--attn_type', type=str, default='gat', choices=['gat', 'tang'], help='Attention type. GAT or that used in Tang 2020') parser.add_argument('--gat_act', type=str, default='leakyrelu', choices=['leakyrelu',...
code_fim
hard
{ "lang": "python", "repo": "sangttruong/stereonet", "path": "/stereonet/models/parsing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sangttruong/stereonet path: /stereonet/models/parsing.py from argparse import ArgumentParser, Namespace import torch def add_train_args(parser: ArgumentParser): """ Adds training arguments to an ArgumentParser. :param parser: An ArgumentParser. """ # General arguments pa...
code_fim
hard
{ "lang": "python", "repo": "sangttruong/stereonet", "path": "/stereonet/models/parsing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_saved_md5(file): if not file.exists(): return None md5 = run_command( f"exiftool {file} | awk '/^Subject/' | awk '{{print $3}}'") return md5 md5 = get_file_md5(resume_tmp) existing_md5 = get_saved_md5(resume_pdf) # if the hashes don...
code_fim
hard
{ "lang": "python", "repo": "kylevedder/kylevedder.github.io", "path": "/build/build.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kylevedder/kylevedder.github.io path: /build/build.py from pathlib import Path import hashlib import os import tempfile import shutil from utils import read_lines, write_lines, run_command, make_tmp_copy from preprocess import preprocess_lines root_dir = Path().absolute() def preprocess(file:...
code_fim
hard
{ "lang": "python", "repo": "kylevedder/kylevedder.github.io", "path": "/build/build.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def apk(actual, predicted, k=10): actual = [int(actual)] if len(predicted) > k: predicted = predicted[:k] score = 0.0 num_hits = 0.0 for i, p in enumerate(predicted): if p in actual and p not in predicted[:i]: num_hits += 1.0 score += num_hits ...
code_fim
hard
{ "lang": "python", "repo": "chenpaopao/-", "path": "/metric_learning/Happy-Whale/retrieval/utils/metric.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> actual = [int(actual)] if len(predicted) > k: predicted = predicted[:k] score = 0.0 num_hits = 0.0 for i, p in enumerate(predicted): if p in actual and p not in predicted[:i]: num_hits += 1.0 score += num_hits / (i + 1.0) if not actual: ...
code_fim
medium
{ "lang": "python", "repo": "chenpaopao/-", "path": "/metric_learning/Happy-Whale/retrieval/utils/metric.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenpaopao/- path: /metric_learning/Happy-Whale/retrieval/utils/metric.py import numpy as np import pandas as pd def sigmoid_rampup(current, rampup_length): """Exponential rampup from https://arxiv.org/abs/1610.02242""" if rampup_length == 0: return 1.0 else: current...
code_fim
medium
{ "lang": "python", "repo": "chenpaopao/-", "path": "/metric_learning/Happy-Whale/retrieval/utils/metric.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return result except Exception as e: log.exception("db connection exception : {}".format(str(e))) return [] # Log config dictConfig({ 'version': 1, 'formatters': {'default': { 'format': '[%(asctime)s] {%(filename)s:%(linen...
code_fim
hard
{ "lang": "python", "repo": "panyamred/ulca-1", "path": "/backend/metric/ulca-metric-api/src/models/db/attributes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: panyamred/ulca-1 path: /backend/metric/ulca-metric-api/src/models/db/attributes.py from sqlalchemy.sql.expression import column from src.db import get_data_store from sqlalchemy import text from config import DRUID_DB_SCHEMA from src.models.api_enums import DataEnums ,LANG_CODES, DATA_TYPES impor...
code_fim
hard
{ "lang": "python", "repo": "panyamred/ulca-1", "path": "/backend/metric/ulca-metric-api/src/models/db/attributes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Log config dictConfig({ 'version': 1, 'formatters': {'default': { 'format': '[%(asctime)s] {%(filename)s:%(lineno)d} %(threadName)s %(levelname)s in %(module)s: %(message)s', }}, 'handlers': { 'info': { 'class': 'logging.FileHandler', 'level': 'DE...
code_fim
hard
{ "lang": "python", "repo": "panyamred/ulca-1", "path": "/backend/metric/ulca-metric-api/src/models/db/attributes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Transform labels back to original encoding. Parameters ---------- y : numpy array of shape [n_samples] Target values. Returns ------- y_dec : numpy array of shape [n_samples] """ check_is_fitted(self, attributes=['cla...
code_fim
hard
{ "lang": "python", "repo": "hying99/capstry", "path": "/scikit-activeml-master/scikit-activeml-master/skactiveml/utils/_label.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Attributes ---------- classes_: array-like, shape (n_classes) Holds the label for each class. """ def __init__(self, classes=None, missing_label=MISSING_LABEL): self.classes = classes self.missing_label = missing_label def fit(self, y): """Fit labe...
code_fim
hard
{ "lang": "python", "repo": "hying99/capstry", "path": "/scikit-activeml-master/scikit-activeml-master/skactiveml/utils/_label.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: hying99/capstry path: /scikit-activeml-master/scikit-activeml-master/skactiveml/utils/_label.py import numpy as np from iteration_utilities import deepflatten from sklearn.base import BaseEstimator, TransformerMixin from sklearn.preprocessing import LabelEncoder from sklearn.utils.validation impo...
code_fim
hard
{ "lang": "python", "repo": "hying99/capstry", "path": "/scikit-activeml-master/scikit-activeml-master/skactiveml/utils/_label.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Joe-Kelley/Image-Recognition-Fun path: /project_driver.py # Code Modified from: http://lucylabs.gatech.edu/kbai/fall-2021/project-overview/ import os import sys import csv import pandas as pd from agent_main import Agent def getNextLine(r): return r.readline().rstrip() # The project's m...
code_fim
medium
{ "lang": "python", "repo": "Joe-Kelley/Image-Recognition-Fun", "path": "/project_driver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def display_answers(): df = pd.read_csv("AgentAnswers.csv") df['Correct?'] = df.apply(lambda row: check_answers(row), axis=1) print(df) print('Results:\n', df['Correct?'].value_counts()) pass # The main execution will have your agent generate answers for all the problems, def main()...
code_fim
medium
{ "lang": "python", "repo": "Joe-Kelley/Image-Recognition-Fun", "path": "/project_driver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }