text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: cap-ntu/Video-to-Retail-Platform path: /tests/test_index.py # @Time : 14/11/18 3:03 PM # @Author : Huaizheng Zhang # @Site : zhanghuaizheng.info # @File : text_index.py import _init_paths from dataset.TVQA.index import TVQA_indexer from search.index import BasicIndex, SubtitleIndex fr...
code_fim
hard
{ "lang": "python", "repo": "cap-ntu/Video-to-Retail-Platform", "path": "/tests/test_index.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> temp = cv2.imread('test_sofa2.jpg') q_tensor = Image.fromarray(cv2.cvtColor(temp, cv2.COLOR_BGR2RGB)) q_vec = scene_model.extract_vec(q_tensor, True) print(q_vec.shape) gpu_machine = BasicIndex.init_size(VIDEO_DATA_PATH) gpu_machine.index() tic = time.time() results = gpu_...
code_fim
hard
{ "lang": "python", "repo": "cap-ntu/Video-to-Retail-Platform", "path": "/tests/test_index.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: howonlee/diogenes8 path: /diocli.py #!/usr/bin/env python3.7 from __future__ import annotations import functools import csv import random import sys import email import smtplib import argparse import datetime import crontab import click from dio import * from typing import Optional, Any, Dict, Li...
code_fim
hard
{ "lang": "python", "repo": "howonlee/diogenes8", "path": "/diocli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Emails the destination email the recommendations for today """ click.echo("Emailing recommendations to destination...") dio_dir: DioDir = DioDir() sched: ScheduleABC = DefaultSchedule() today: datetime.date = datetime.datetime.now().date() res: Optional[List[Person]] = ...
code_fim
hard
{ "lang": "python", "repo": "howonlee/diogenes8", "path": "/diocli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tondonia/data-science-bowl-2017 path: /luna_image.py from __future__ import division import os.path import numpy as np import sys, getopt, argparse import gzip import cPickle as pickle import skimage.morphology import time import re import glob import datetime from random import shuffle _EPSILO...
code_fim
hard
{ "lang": "python", "repo": "tondonia/data-science-bowl-2017", "path": "/luna_image.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not deterministic: lung, truth, outside = augment([lung, truth, outside]) truth = np.array(np.round(truth),dtype=np.int64) outside = np.array(np.round(outside),dtype=np.int64) #Set label of outside pixels to -10 truth = truth - (outside*10) lung = lung*(1-outside) ...
code_fim
hard
{ "lang": "python", "repo": "tondonia/data-science-bowl-2017", "path": "/luna_image.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for ev in ["Casper::BoolSet","Casper::IntSet"]: ExprWrapper().print1(ev,"CP::Var<"+ev+">") ExprWrapper().print1("Seq<"+ev+">","CP::VarArray<"+ev+",1>") ExprWrapper().print1("Seq<"+ev+">","CP::VarArray<"+ev+",2>") for arg in [varArg]: objdb.forAllRelOper(ExprWrapper(),arg) objdb.forAllRelPred(...
code_fim
hard
{ "lang": "python", "repo": "marcovc/casper", "path": "/casper/cp/set/spexpr/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: marcovc/casper path: /casper/cp/set/spexpr/util.py import sys import os libPath = os.path.abspath('pyutils') sys.path.append(libPath) import objdb def printViews(h): header = h class ViewCreator: def __init__(self,t,ev=None,m=None): self.header = header self.t = t self.ev = ev ...
code_fim
hard
{ "lang": "python", "repo": "marcovc/casper", "path": "/casper/cp/set/spexpr/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if r.properties["ev"]==self.ev and objdb.getCPModule(r)==self.m: self.print1(f) def varArg(ev): if ev not in ["Casper::BoolSet","Casper::IntSet"]: return None return "CP::Var<"+ev+">" if header: for arg in [varArg]: objdb.forAllRelOper(RefCreator("Ref<int>","int","set"),arg) objd...
code_fim
hard
{ "lang": "python", "repo": "marcovc/casper", "path": "/casper/cp/set/spexpr/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: t-nagasaki/cheeseshop path: /class_counter.py # -*- coding: utf-8 -*- ''' クラスでのデータと関数のテスト ''' class MyClass: "A simple example class" def __init__(self): pass i = 12345 ''' pylintで、counterを関数外で定義しているエラーになるのは、 ここで定義すればでなくなる。   ただ、外部で定義しても動くためのテストなので、そのままにする coun...
code_fim
medium
{ "lang": "python", "repo": "t-nagasaki/cheeseshop", "path": "/class_counter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>MYCLASS = MyClass() MYCLASS.counter = 1 while MYCLASS.counter < 10: MYCLASS.counter = MYCLASS.counter * 2 print MYCLASS.counter del MYCLASS.counter class MyClass2: "A simple example class" def __init__(self): pass i = 12345 ''' selfをとったらエラーになった。クラス内の関数だから引数いるのかな. 普通...
code_fim
medium
{ "lang": "python", "repo": "t-nagasaki/cheeseshop", "path": "/class_counter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # pred[pred >1] = 1 # pred[pred <0] = 0 if with_sigmoid: pred = torch.sigmoid(pred) else : pred = pred.clamp(0,1) loss = mse_criterion(pred, gt) return loss<|fim_prefix|># repo: MengLcool/Oc-OCR path: /Craft/SynthTrain/synthLoss.py import torch def cal_loss(...
code_fim
medium
{ "lang": "python", "repo": "MengLcool/Oc-OCR", "path": "/Craft/SynthTrain/synthLoss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MengLcool/Oc-OCR path: /Craft/SynthTrain/synthLoss.py import torch def cal_loss(pred, gt , mse_criterion, with_sigmoid=False): """ pred : tensor (b,h,w,2) gt : tensor (b,h,w,2) mse_criterion : MSELoss [ cuda() ] TODO: use sigmoid ? """ # pred[pred >1] = 1 # pr...
code_fim
medium
{ "lang": "python", "repo": "MengLcool/Oc-OCR", "path": "/Craft/SynthTrain/synthLoss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> loss = mse_criterion(pred, gt) return loss<|fim_prefix|># repo: MengLcool/Oc-OCR path: /Craft/SynthTrain/synthLoss.py import torch def cal_loss(pred, gt , mse_criterion, with_sigmoid=False): """ pred : tensor (b,h,w,2) gt : tensor (b,h,w,2) mse_criterion : MSELoss [ cuda() ] ...
code_fim
medium
{ "lang": "python", "repo": "MengLcool/Oc-OCR", "path": "/Craft/SynthTrain/synthLoss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def setUp(self): self.prefix = tempfile.mkdtemp() def tearDown(self): shutil.rmtree(self.prefix) @mock.patch("egginst.main.install_egg_cli") def test_main(self, install_egg_cli): # Given r_egg = "enstaller-4.8.0-1.egg" r_output = 'Bootstrapping: {0...
code_fim
medium
{ "lang": "python", "repo": "enthought/enstaller", "path": "/egginst/tests/test_bootstrap.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: enthought/enstaller path: /egginst/tests/test_bootstrap.py import shutil import sys import tempfile import mock import testfixtures from egginst.bootstrap import main if sys.version_info < (2, 7): import unittest2 as unittest else: import unittest class TestEgginstBootstrap(unittest....
code_fim
hard
{ "lang": "python", "repo": "enthought/enstaller", "path": "/egginst/tests/test_bootstrap.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def suggested_quests(): #scheduled_ids = ScheduledQuest.objects.all().values_list('quest_id', flat=True) scheduled = ScheduledQuest.objects.all() quests = Quest.public.filter(parent_comment__isnull=True, ugq=False) quests = quests.exclude(scheduledquest__in=scheduled) quests = quests....
code_fim
hard
{ "lang": "python", "repo": "MichaelBechHansen/drawquest-web", "path": "/website/drawquest/apps/quest_scheduler/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> quests = Quest.public.filter(parent_comment__isnull=True, ugq=False) quests = quests.exclude(scheduledquest__in=scheduled) quests = quests.order_by('-timestamp') quests = quests[:50] return [QuestPreview.get_from_quest(quest) for quest in quests]<|fim_prefix|># repo: MichaelBechHansen...
code_fim
hard
{ "lang": "python", "repo": "MichaelBechHansen/drawquest-web", "path": "/website/drawquest/apps/quest_scheduler/models.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MichaelBechHansen/drawquest-web path: /website/drawquest/apps/quest_scheduler/models.py from django.shortcuts import get_object_or_404, Http404 from canvas.models import get_mapping_id_from_short_id from drawquest.apps.quests.models import Quest, ScheduledQuest <|fim_suffix|> preview = ...
code_fim
hard
{ "lang": "python", "repo": "MichaelBechHansen/drawquest-web", "path": "/website/drawquest/apps/quest_scheduler/models.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def sub(self, x, y): # O(n) c = max(x.bit_length(), y.bit_length()) self.num_sub += 1 self.cost_sub += c self.cost += c def mul(self, x, y): # ~ Karatsuba algorithm # nbit x nbit takes O(n^1.6) # unsure what constants to use ...
code_fim
hard
{ "lang": "python", "repo": "PulledPork0/AlgoCompetition", "path": "/algocomp/cost_tracking.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PulledPork0/AlgoCompetition path: /algocomp/cost_tracking.py from .tracked_number import (coerce_int, TrackedNumber) from math import log class CostTracking: def __init__(self): self._last = 0 self.cost = 0 # details on fundemental operations self.num_add = 0...
code_fim
hard
{ "lang": "python", "repo": "PulledPork0/AlgoCompetition", "path": "/algocomp/cost_tracking.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> import code # TODO: these two does not work froms cript but work when type in interpreter import rlcompleter # noqa import readline # noqa data = json.load(open(json_path)) print("{0} {1} {0}".format("=" * 10, "WELCOME TO JEX")) print("Access the data via name data") i...
code_fim
hard
{ "lang": "python", "repo": "hvnsweeting/jex", "path": "/jex/cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hvnsweeting/jex path: /jex/cli.py import argparse import json import tempfile import os import sys import subprocess import webbrowser HTML = """ <html lang="en"> <head> <meta charset="utf-8"> </head> <body style="background: gray; color: white"> <h1><a href="file://JSONPATH">View ...
code_fim
hard
{ "lang": "python", "repo": "hvnsweeting/jex", "path": "/jex/cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def extract(html, lang, text_processor): text = u"" if html: html = TextSanitizer.to_unicode(html, is_html=True, lang=lang) text = html2text(html.encode('utf-8'), sanitize=True) text = text_processor.process(text) return html, te...
code_fim
hard
{ "lang": "python", "repo": "christianbuck/CorpusMining", "path": "/baseline/candidates2corpus.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: christianbuck/CorpusMining path: /baseline/candidates2corpus.py #!/usr/bin/env python # -*- coding: utf-8 -*- import base64 import json import sys from ccdownloader import CCDownloader from html2text import html2text from textsanitzer import TextSanitizer from external_processor import TextProce...
code_fim
hard
{ "lang": "python", "repo": "christianbuck/CorpusMining", "path": "/baseline/candidates2corpus.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> start_server = websockets.serve(broadcast, "127.0.0.1", 8891) asyncio.get_event_loop().run_until_complete(start_server) asyncio.get_event_loop().run_forever() return 1 if __name__ == "__main__": main()<|fim_prefix|># repo: akatona33/jimcoggeshall.com path: /sbin/broadcast #!/usr/b...
code_fim
hard
{ "lang": "python", "repo": "akatona33/jimcoggeshall.com", "path": "/sbin/broadcast", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: akatona33/jimcoggeshall.com path: /sbin/broadcast #!/usr/bin/env python3 import asyncio import datetime import random import websockets import datetime import time import json import subprocess import itertools class Messenger: def _fetch_message_now(self): self._message = next(se...
code_fim
hard
{ "lang": "python", "repo": "akatona33/jimcoggeshall.com", "path": "/sbin/broadcast", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheTrueHonker/File-Renamer path: /src/tools/Prefixer.py import os import os.path import time import eyed3 import datetime class Prefixer: def __init__(self, folder_path): self.folder = folder_path self.files = os.scandir(folder_path) def _prefix(self, file, information)...
code_fim
hard
{ "lang": "python", "repo": "TheTrueHonker/File-Renamer", "path": "/src/tools/Prefixer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for file in self.files: if file.is_file(): modified_date = datetime.datetime.utcfromtimestamp(os.path.getctime(self.folder + file.name)) modified_date_str = modified_date.strftime('%Y%m%d') self._prefix(file.name, modified_date_str) ...
code_fim
hard
{ "lang": "python", "repo": "TheTrueHonker/File-Renamer", "path": "/src/tools/Prefixer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if rendered: job.set_output(rendered) else: job.log( f"No export (or empty) generated.", object=export_template, level_choice=LogLevel.INFO, logger=logger, ) job.mark_completed( "Export template rendered.", object...
code_fim
medium
{ "lang": "python", "repo": "netravnen/peering-manager", "path": "/extras/jobs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: netravnen/peering-manager path: /extras/jobs.py import logging from django_rq import job from core.enums import LogLevel logger = logging.getLogger("peering.manager.extras.jobs") <|fim_suffix|> job.mark_completed( "Export template rendered.", object=export_template, logger=logger ...
code_fim
hard
{ "lang": "python", "repo": "netravnen/peering-manager", "path": "/extras/jobs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> job.mark_completed( "Export template rendered.", object=export_template, logger=logger )<|fim_prefix|># repo: netravnen/peering-manager path: /extras/jobs.py import logging from django_rq import job from core.enums import LogLevel logger = logging.getLogger("peering.manager.extras.jobs...
code_fim
hard
{ "lang": "python", "repo": "netravnen/peering-manager", "path": "/extras/jobs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def load_df(filepath, id_column=None): extension = filepath.split('.')[-1] if extension == 'csv' or extension == 'txt': df = pandas.read_csv(filepath) elif extension == 'shp': df = geopandas.read_file(filepath) else: raise ValueError( 'Unrecognized file ...
code_fim
hard
{ "lang": "python", "repo": "gerrymandr/graphmaker", "path": "/graphmaker/integrate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gerrymandr/graphmaker path: /graphmaker/integrate.py import geopandas import numpy import pandas from graphmaker.graph import RookAndQueenGraphs from graphmaker.resources import BlockAssignmentFile from graphmaker.utils import infer_id_column def integrate(blocks_filepath, columns, unit): b...
code_fim
medium
{ "lang": "python", "repo": "gerrymandr/graphmaker", "path": "/graphmaker/integrate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Integrates the block-level values in :series: to produce vtd-level aggregate values. :fips: state fips code :series: pandas Series, assumed to be indexed by Census block GEOID :function: (defaults to sum) the function to use for aggregation """ blocks['data'] = series ...
code_fim
hard
{ "lang": "python", "repo": "gerrymandr/graphmaker", "path": "/graphmaker/integrate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @task(name="notify_results") def notify_results(scan_id): with db.session_scope() as session: scan = get_scan(scan_id, session) scan_vulns = set([scan_vuln.scan_dep.raw_dep for scan_vuln in get_scan_vulnerabilities(scan_id, session)]) project = scan.project logger.deb...
code_fim
hard
{ "lang": "python", "repo": "Sergiodfdez/deeptracy", "path": "/deeptracy/tasks/notify_results.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sergiodfdez/deeptracy path: /deeptracy/tasks/notify_results.py # Copyright 2017 BBVA # # 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://www.apache.org/licen...
code_fim
hard
{ "lang": "python", "repo": "Sergiodfdez/deeptracy", "path": "/deeptracy/tasks/notify_results.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: while True: s = input('> ') n = int(s) print(pe28(n)) except (SyntaxError, EOFError, KeyboardInterrupt, NameError): pass<|fim_prefix|># repo: kittttttan/pe path: /py/pe/pe28.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ What is the s...
code_fim
hard
{ "lang": "python", "repo": "kittttttan/pe", "path": "/py/pe/pe28.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kittttttan/pe path: /py/pe/pe28.py #!/usr/bin/env python # -*- coding: utf-8 -*- """ What is the sum of both diagonals in a 1001 by 1001 spiral? 21 22 23 24 25 .. 20 7 8 9 10 19 6 1 2 11 18 5 4 3 12 17 16 15 14 13 """ def pe28(d=1001): <|fim_suffix|> try: while True: ...
code_fim
hard
{ "lang": "python", "repo": "kittttttan/pe", "path": "/py/pe/pe28.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get the Linux memory maps.""" filename = os.path.join("/proc", pid, "smaps") if not os.path.exists(filename): return [] with open(filename, encoding="utf-8") as input_: cur_dict: dict[str, int] = defaultdict(int) sizes: dict[str, Any] = {} for line in inp...
code_fim
hard
{ "lang": "python", "repo": "camptocamp/c2cwsgiutils", "path": "/c2cwsgiutils/debug/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """Get the sum size of object & members.""" if isinstance(obj, BLACKLIST): return 0 seen_ids: set[int] = set() size = 0 objects = [obj] while objects: need_referents = [] for obj_ in objects: if not isinstance(obj_, BLACKLIST) and id(obj_) not in...
code_fim
medium
{ "lang": "python", "repo": "camptocamp/c2cwsgiutils", "path": "/c2cwsgiutils/debug/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: camptocamp/c2cwsgiutils path: /c2cwsgiutils/debug/utils.py import gc import logging import os import re import sys from collections import defaultdict from types import FunctionType, ModuleType from typing import Any # 7ff7d33bd000-7ff7d33be000 r--p 00000000 00:65 49 /usr...
code_fim
medium
{ "lang": "python", "repo": "camptocamp/c2cwsgiutils", "path": "/c2cwsgiutils/debug/utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Chanrom/paper-autosuggestion path: /utils/get_raw_text.py #coding=utf-8 import os def get_raw_doc(direcory): files = os.list_dir(direcory) <|fim_suffix|> # parse latex source code, convert to txt cmd_res = os.system(r"detex %s > %s"%(file, file + ".txt")) with open(f...
code_fim
hard
{ "lang": "python", "repo": "Chanrom/paper-autosuggestion", "path": "/utils/get_raw_text.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # tokenize # omit tokenized_doc = [] for sent in doc: words = sent.split(' ') tokenized_doc.append(words) corpus.append(tokenized_doc) return corpus<|fim_prefix|># repo: Chanrom/paper-autosuggestion path: /utils/get_raw_text.py #coding...
code_fim
hard
{ "lang": "python", "repo": "Chanrom/paper-autosuggestion", "path": "/utils/get_raw_text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # tokenize # omit tokenized_doc = [] for sent in doc: words = sent.split(' ') tokenized_doc.append(words) corpus.append(tokenized_doc) return corpus<|fim_prefix|># repo: Chanrom/paper-autosuggestion path: /utils/get_raw_text.py #codin...
code_fim
hard
{ "lang": "python", "repo": "Chanrom/paper-autosuggestion", "path": "/utils/get_raw_text.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stepjam/PyRep path: /pyrep/robots/configuration_paths/mobile_configuration_path.py from pyrep.backend import sim, utils from pyrep.robots.configuration_paths.configuration_path import ( ConfigurationPath) from pyrep.robots.mobiles.mobile_base import MobileBase from pyrep.const import PYREP_SC...
code_fim
hard
{ "lang": "python", "repo": "stepjam/PyRep", "path": "/pyrep/robots/configuration_paths/mobile_configuration_path.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(self._path_points)): points = self._path_points[i] self._mobile.set_2d_pose(points[:3]) p = list(tip.get_position()) sim.simAddDrawingObjectItem(self._drawing_handle, prev_point + p) prev_point = p # Set the ar...
code_fim
hard
{ "lang": "python", "repo": "stepjam/PyRep", "path": "/pyrep/robots/configuration_paths/mobile_configuration_path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_to_start(self) -> None: """Sets the mobile base to the beginning of this path. :param allow_force_mode: Not used. """ start_config = self._path_points[0] self._mobile.set_2d_pose(start_config[:3]) self._path_done = False def set_to_end(self...
code_fim
hard
{ "lang": "python", "repo": "stepjam/PyRep", "path": "/pyrep/robots/configuration_paths/mobile_configuration_path.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if string == "loc": return self.loc if string == "lang": return self.lang return self.strings.get(string, f"{string}") def get(self, string: str): return self.strings.get(string, f"{string}")<|fim_prefix|># repo: mprenditore/covid19-italy path:...
code_fim
hard
{ "lang": "python", "repo": "mprenditore/covid19-italy", "path": "/src/translation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mprenditore/covid19-italy path: /src/translation.py import yaml from cachetools import cached, TTLCache cache = TTLCache(maxsize=10, ttl=86400) class Languages: lang_mapping = {} @cached(cache) def __init__(self): with open("translations/lang_mapping.yml", 'r') as yml_mappi...
code_fim
medium
{ "lang": "python", "repo": "mprenditore/covid19-italy", "path": "/src/translation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ProteinsWebTeam/pronto path: /pronto/api/signatures/go.py from typing import Dict, List, Set from flask import jsonify, request from pronto import utils from . import bp, get_sig2interpro _ASPECTS = {'cellular_component', 'molecular_function', 'biological_process'} @bp.route("/<path:accessio...
code_fim
hard
{ "lang": "python", "repo": "ProteinsWebTeam/pronto", "path": "/pronto/api/signatures/go.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> go_terms = list(go_terms) for i in range(0, len(go_terms), 100): subset = go_terms[i:i+100] for term in get_go_details(subset, pg_cur): terms[term["id"]].update(term) return terms def get_go_details(term_ids: List[str], pg_cur) -> List[dict]: details = [] ...
code_fim
hard
{ "lang": "python", "repo": "ProteinsWebTeam/pronto", "path": "/pronto/api/signatures/go.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_availability_by_soup(self): try: self.availability = self.soup.select("#availability")[0].text.replace("\n", "") except IndexError: logger.warning("Cannot get availability info from soup") def get_ratings_by_soup(self): try: revi...
code_fim
hard
{ "lang": "python", "repo": "shuangliu1993/PyScraper", "path": "/product_scrapper/amazon/amazon_product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: self.title = self.soup.select("#productTitle")[0].text.replace("\n", "") except IndexError: # no title available logger.warning("Cannot get title info from soup") def get_price_by_soup(self): try: self.price = self.soup.select("#price_...
code_fim
medium
{ "lang": "python", "repo": "shuangliu1993/PyScraper", "path": "/product_scrapper/amazon/amazon_product.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shuangliu1993/PyScraper path: /product_scrapper/amazon/amazon_product.py import logging from product_scrapper.product import Product logger = logging.getLogger(__name__) class AmazonProduct(Product): def __init__(self, url=None): super().__init__() self.set_url(url) <|fim...
code_fim
hard
{ "lang": "python", "repo": "shuangliu1993/PyScraper", "path": "/product_scrapper/amazon/amazon_product.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def first_exact_match(self, *args, **kwargs): for case in args: if(self.__is_hard_match(case.obj)): case.function(self) return default = kwargs['default'] if default: default() def __is_hard_match(self, obj): ...
code_fim
hard
{ "lang": "python", "repo": "keithballinger/case.py", "path": "/case_object.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __is_hard_match(self, obj): """ True is the objects are an exact match, defined as each attribute matching, or ANY for that attribute. """ for attr in self.list: try: if getattr(obj, attr) != getattr(self, attr): ...
code_fim
hard
{ "lang": "python", "repo": "keithballinger/case.py", "path": "/case_object.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: keithballinger/case.py path: /case_object.py class _ANY(object): """ A helper object that compares equal to everything. Shamelessly stolen from Mock. """ def __eq__(self, other): return True def __ne__(self, other): return False def __repr__(self): ...
code_fim
hard
{ "lang": "python", "repo": "keithballinger/case.py", "path": "/case_object.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitter-badger/jsonrpcserver path: /examples/socketio_server.py from flask import Flask from flask_socketio import SocketIO, send from jsonrpcserver import methods from jsonrpcserver.response import NotificationResponse app = Flask(__name__) socketio = SocketIO(app) @methods.add def ping(): <|fi...
code_fim
medium
{ "lang": "python", "repo": "gitter-badger/jsonrpcserver", "path": "/examples/socketio_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@socketio.on('message') def handle_message(request): response = methods.dispatch(request) if not response.is_notification: send(response, json=True) if __name__ == '__main__': socketio.run(app, port=5000)<|fim_prefix|># repo: gitter-badger/jsonrpcserver path: /examples/socketio_serve...
code_fim
easy
{ "lang": "python", "repo": "gitter-badger/jsonrpcserver", "path": "/examples/socketio_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = methods.dispatch(request) if not response.is_notification: send(response, json=True) if __name__ == '__main__': socketio.run(app, port=5000)<|fim_prefix|># repo: gitter-badger/jsonrpcserver path: /examples/socketio_server.py from flask import Flask from flask_socketio impo...
code_fim
medium
{ "lang": "python", "repo": "gitter-badger/jsonrpcserver", "path": "/examples/socketio_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: githwxi/ATS-Postiats-frozen path: /projects/SMALL/openshift-flask-2016-07-20/libatscc2py3/ats2pypre_bool_cats.py ###### # # HX-2014-08: # for Python code translated from ATS # ###### ###### #beg of [bool_cats.py] ###### ###### from ats2pypre_basics_cats import * ###### <|fim_suffix|># ########...
code_fim
medium
{ "lang": "python", "repo": "githwxi/ATS-Postiats-frozen", "path": "/projects/SMALL/openshift-flask-2016-07-20/libatscc2py3/ats2pypre_bool_cats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>############################################ def ats2pypre_mul_bool0_bool0(x, y): return(x and y) def ats2pypre_mul_bool0_bool1(x, y): return(x and y) def ats2pypre_mul_bool1_bool0(x, y): return(x and y) def ats2pypre_mul_bool1_bool1(x, y): return(x and y) ############################################ # ...
code_fim
medium
{ "lang": "python", "repo": "githwxi/ATS-Postiats-frozen", "path": "/projects/SMALL/openshift-flask-2016-07-20/libatscc2py3/ats2pypre_bool_cats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a = 0 fibs = [] if n > 0: while a < n: a += 1 fibs.append(f(a)) elif n < 0: while a > n: a -= 1 fibs.append(f(a)) return fibs def run(): number_wanted = int(input("Stage of Fibs wanted")) fibs = fib(number_wanted...
code_fim
medium
{ "lang": "python", "repo": "FayeAlephNil/Messing-With-Python", "path": "/src/maths/fib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run(): number_wanted = int(input("Stage of Fibs wanted")) fibs = fib(number_wanted) print("F(0) = 0") a = 0 if number_wanted > 0: while a < number_wanted: a += 1 print("F(" + str(a) + ") = " + str(fibs[a-1])) elif number_wanted < 0: whil...
code_fim
hard
{ "lang": "python", "repo": "FayeAlephNil/Messing-With-Python", "path": "/src/maths/fib.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: FayeAlephNil/Messing-With-Python path: /src/maths/fib.py phi = (1 + 5**0.5) / 2 def f(n): return int(round((phi**n - (1-phi)**n) / 5**0.5)) <|fim_suffix|>def run(): number_wanted = int(input("Stage of Fibs wanted")) fibs = fib(number_wanted) print("F(0) = 0") a = 0 i...
code_fim
hard
{ "lang": "python", "repo": "FayeAlephNil/Messing-With-Python", "path": "/src/maths/fib.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tonisuter/python-adb-client path: /src/pythonadb/adb_device.py #!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import annotations import multiprocessing from concurrent.futures.thread import ThreadPoolExecutor from typing import Optional, IO, Dict from .packageparser import Packa...
code_fim
hard
{ "lang": "python", "repo": "tonisuter/python-adb-client", "path": "/src/pythonadb/adb_device.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def open_settings(self): log().verbose("Opening Settings Activity...") return self.client.shell( "am start -a android.intent.action.MAIN -n com.android.settings/.Settings" ) def open_bluetooth_settings(self): log().verbose("Opening Blueooth Settings Act...
code_fim
hard
{ "lang": "python", "repo": "tonisuter/python-adb-client", "path": "/src/pythonadb/adb_device.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #################################################################### # User Topics #################################################################### @cache.cached(timeout=300) @app.route('/users/<user>/topics', methods=['GET']) def user_topics(user): if request.args.get('page'): try: ...
code_fim
hard
{ "lang": "python", "repo": "djunehor/nairaland-api", "path": "/app/app.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: djunehor/nairaland-api path: /app/app.py app) file_handler = StreamHandler() app.logger.setLevel(logging.DEBUG) app.logger.addHandler(file_handler) # log to stderr import logging from logging import StreamHandler file_handler = StreamHandler() app.logger.setLevel(logging.DEBUG) app.logger.addHa...
code_fim
hard
{ "lang": "python", "repo": "djunehor/nairaland-api", "path": "/app/app.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> if not request.form.get('content'): return jsonify({'error': 'Content is required!'}), 422 # load browser for current request browser = Browser(os.environ.get('LINUX')) user = User(browser) # login first if not browser.login(username=os.environ.get('NL_USERNAME'), user_pas...
code_fim
hard
{ "lang": "python", "repo": "djunehor/nairaland-api", "path": "/app/app.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: henkez73/docker_registry_frontend path: /docker_registry_frontend/test_manifest.py import json from unittest import TestCase from docker_registry_frontend.manifest import DockerRegistrySchema1Manifest docker_registry_schema1_manifest_content = """{ "schemaVersion": 1, "name": "registry", ...
code_fim
hard
{ "lang": "python", "repo": "henkez73/docker_registry_frontend", "path": "/docker_registry_frontend/test_manifest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_docker_version(self): self.assertEqual( self.manifest.get_docker_version(), '1.12.6' ) def test_get_entrypoint(self): self.assertEqual( self.manifest.get_entrypoint(), ['/entrypoint.sh'] ) def test_g...
code_fim
hard
{ "lang": "python", "repo": "henkez73/docker_registry_frontend", "path": "/docker_registry_frontend/test_manifest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_created_date(self): self.assertEqual( self.manifest.get_created_date(), '2017-04-06T16:15:54.391896801Z' ) def test_get_docker_version(self): self.assertEqual( self.manifest.get_docker_version(), '1.12.6' ...
code_fim
hard
{ "lang": "python", "repo": "henkez73/docker_registry_frontend", "path": "/docker_registry_frontend/test_manifest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#logging.basicConfig(filename=path, level=logging.INFO)<|fim_prefix|># repo: flipkart-incubator/Astra path: /utils/logs.py import logging import os if os.getcwd().split('/')[-1] == 'API': path = '../logs/scan.log' else: path = 'logs/scan.log' <|fim_middle|> logger = logging.getLogger() ...
code_fim
medium
{ "lang": "python", "repo": "flipkart-incubator/Astra", "path": "/utils/logs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: flipkart-incubator/Astra path: /utils/logs.py import logging import os if os.getcwd().split('/')[-1] == 'API': path = '../logs/scan.log' else: path = 'logs/scan.log' <|fim_suffix|>#logging.basicConfig(filename=path, level=logging.INFO)<|fim_middle|>logger = logging.getLogger() ...
code_fim
medium
{ "lang": "python", "repo": "flipkart-incubator/Astra", "path": "/utils/logs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> module_name = command_name if command_name == 'import': # special case for the import command, to avoid conflict # with the "import" keyword module_name += 'command' try: command_module = import_module('plastron.commands.' + module_name) except ModuleNotFoun...
code_fim
hard
{ "lang": "python", "repo": "umd-lib/plastron", "path": "/plastron/commands/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> The default implementation of this method simply returns the provided repo_config dictionary without change """ return repo_config def get_command_class(command_name: str): module_name = command_name if command_name == 'import': # special case for the impo...
code_fim
hard
{ "lang": "python", "repo": "umd-lib/plastron", "path": "/plastron/commands/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: umd-lib/plastron path: /plastron/commands/__init__.py from importlib import import_module from plastron.exceptions import FailureException class BaseCommand: def __init__(self, config=None): <|fim_suffix|> The default implementation of this method simply returns the provided ...
code_fim
hard
{ "lang": "python", "repo": "umd-lib/plastron", "path": "/plastron/commands/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaonanln/myleetcode-python path: /src/322. Coin Change - 2.py class Solution(object): def coinChange(self, coins, amount): <|fim_suffix|> res = dp[CN][amount] return res if res != inf else -1 print Solution().coinChange([1, 2, 5], 11) print Solution().coinChange([2], 3)<|fim_middle|> """ ...
code_fim
hard
{ "lang": "python", "repo": "xiaonanln/myleetcode-python", "path": "/src/322. Coin Change - 2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> res = dp[CN][amount] return res if res != inf else -1 print Solution().coinChange([1, 2, 5], 11) print Solution().coinChange([2], 3)<|fim_prefix|># repo: xiaonanln/myleetcode-python path: /src/322. Coin Change - 2.py class Solution(object): def coinChange(self, coins, amount): """ :type coins: ...
code_fim
medium
{ "lang": "python", "repo": "xiaonanln/myleetcode-python", "path": "/src/322. Coin Change - 2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # print("Hola! Aqui estan los usuarios: \n") # for usuario in usuarios: # print ("ID: " + usuario.get('ID')) # print ("Nombre: " + usuario.get('Nombre')) # archivo = open("usuarios.txt","w+") # for usuario in usuarios: # archivo.write("ID: " + usuario.get('ID') + "\n") # archi...
code_fim
hard
{ "lang": "python", "repo": "DeadZombie14/chillMagicCarPygame", "path": "/pantallas/asd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print("Hola! Aqui estan los usuarios: \n") # for usuario in usuarios: # print ("ID: " + usuario.get('ID')) # print ("Nombre: " + usuario.get('Nombre')) # archivo = open("usuarios.txt","w+") # for usuario in usuarios: # archivo.write("ID: " + usuario.get('ID') + "\n") # archivo...
code_fim
medium
{ "lang": "python", "repo": "DeadZombie14/chillMagicCarPygame", "path": "/pantallas/asd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: DeadZombie14/chillMagicCarPygame path: /pantallas/asd.py ##################### Funcion principal ##################### def miprograma(): empresas = [] productos = [] usuarios = [ { 'ID': "1", 'Nombre': "Pablo" } ] ...
code_fim
hard
{ "lang": "python", "repo": "DeadZombie14/chillMagicCarPygame", "path": "/pantallas/asd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>", "False").replace("true", "True").replace("null", "None"))["title"]<|fim_prefix|># repo: dovegaming/dovenetwork path: /runtime/bots/irc/github.py import requests def get_issue_title(owner,repo,issue): html = requests.get("https://api.github.com/repos/{}/{}/issues/{}".format(owner, <|fim_middle|>repo,...
code_fim
medium
{ "lang": "python", "repo": "dovegaming/dovenetwork", "path": "/runtime/bots/irc/github.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dovegaming/dovenetwork path: /runtime/bots/irc/github.py import requests def get_issue_title(owner,repo,issue): html = reque<|fim_suffix|>repo, str(issue))).content return eval(html.decode().replace("false", "False").replace("true", "True").replace("null", "None"))["title"]<|fim_middle|>sts.g...
code_fim
medium
{ "lang": "python", "repo": "dovegaming/dovenetwork", "path": "/runtime/bots/irc/github.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ypymy/neural-network-lyapunov path: /neural_network_lyapunov/examples/quadrotor3d/train_quadrotor_demo.py controller). """ import neural_network_lyapunov.examples.quadrotor3d.quadrotor as quadrotor import neural_network_lyapunov.lyapunov as lyapunov import neural_network_lyapunov.utils as utils i...
code_fim
hard
{ "lang": "python", "repo": "ypymy/neural-network-lyapunov", "path": "/neural_network_lyapunov/examples/quadrotor3d/train_quadrotor_demo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> forward_system = quadrotor.QuadrotorReLUSystem(dtype, x_lo, x_up, u_lo, u_up, forward_model, plant.hover_thrust, dt) if args.train_adversarial: forward_system.network_bound_propagate_metho...
code_fim
hard
{ "lang": "python", "repo": "ypymy/neural-network-lyapunov", "path": "/neural_network_lyapunov/examples/quadrotor3d/train_quadrotor_demo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>client_oxd_id="" # Client oxd id of consumer configured in GG with UMA mode client_id="" # Client id of consumer configured in GG with UMA mode client_secret="" # Client secret of consumer configur...
code_fim
hard
{ "lang": "python", "repo": "daviddumenil/gluu-gateway", "path": "/gg-demo/config.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: daviddumenil/gluu-gateway path: /gg-demo/config.py import cgi gg_base_url = "http://demo.gluu.org" # GG url, which listens to 8000 port oxd_host = "https://demo.gluu.org" # Url of your oxd server, which is listening to 8443 port ce_url="https://demo.gluu.org" ...
code_fim
hard
{ "lang": "python", "repo": "daviddumenil/gluu-gateway", "path": "/gg-demo/config.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: nickgerend/EyeintheSky path: /top_bar.py # Written by: Nick Gerend, @dataoutsider # Viz: "Eye in the Sky", enjoy! import pandas as pd import numpy as np import os from math import isnan, pi, sin, cos, sqrt, tan class point: def __init__(self, index, item1, item2, segment, x, y, path, xo = 0...
code_fim
hard
{ "lang": "python", "repo": "nickgerend/EyeintheSky", "path": "/top_bar.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#region linear output df_out = pd.DataFrame.from_records([s.to_dict() for s in list_xy]) df_out['xt'] = df_out['x'] df_out['yt'] = df_out['y'] df_out['group'] = df_out['item1'] + df_out['item2'] df_out['item_group'] = df_out.apply(lambda i: i['item1'] if (i['x'] > i['xo']) | (i['segment'] == 5) else i['it...
code_fim
hard
{ "lang": "python", "repo": "nickgerend/EyeintheSky", "path": "/top_bar.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: VinF/deer path: /deer/helper/tree.py """ Implementation of a binary tree for prioritized experience replay. Each leaf node is a past experience with its associated priority. Each parent node is the sum of the priorities of its children. The tree data structure serves purpose of efficient O(log(n...
code_fim
hard
{ "lang": "python", "repo": "VinF/deer", "path": "/deer/helper/tree.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Argument: index - chosen index based on priority dataset - contains the circular buffers Return: index - checked or corrected value of the input index. """ history_size = dataset._max_history_size terminals = dataset._terminals ...
code_fim
hard
{ "lang": "python", "repo": "VinF/deer", "path": "/deer/helper/tree.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: banana-galaxy/challenges path: /challenge19(prime)/solutions/Exainz.py def solution(never_used, p): def gcd(a, b): if b == 0: return a else: return gcd(b, a % b) string = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" length = len(p) index = 0 result = ""...
code_fim
hard
{ "lang": "python", "repo": "banana-galaxy/challenges", "path": "/challenge19(prime)/solutions/Exainz.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>en(encrypted_list)): encrypted_list[k] = p[k - 1] // encrypted_list[k - 1] for l in range(length - 1): if gcd(p[l], p[l + 1]) != p[l]: for m in range(l, -1, -1): encrypted_list[m] = p[m] // encrypted_list[m + 1] decrypted_list = list(sorted(set(e...
code_fim
hard
{ "lang": "python", "repo": "banana-galaxy/challenges", "path": "/challenge19(prime)/solutions/Exainz.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> message: TransactionMessage signatures: List[str] class MetaInnerInstructionData(TypedDict): accounts: List[int] data: str programIdIndex: int class MetaInnerInstruction(TypedDict): index: int instruction: List[TransactionMessageInstruction] class UiTokenAmount(TypedDict)...
code_fim
medium
{ "lang": "python", "repo": "eteryko/audius-protocol", "path": "/discovery-provider/src/solana/solana_transaction_types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: eteryko/audius-protocol path: /discovery-provider/src/solana/solana_transaction_types.py import logging from typing import Any, List, Optional, TypedDict logger = logging.getLogger(__name__) class TransactionMessageHeader(TypedDict): numReadonlySignedAccounts: int # num read only signed ...
code_fim
hard
{ "lang": "python", "repo": "eteryko/audius-protocol", "path": "/discovery-provider/src/solana/solana_transaction_types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class ResultMeta(TypedDict): err: Optional[Any] fee: int innerInstructions: List[MetaInnerInstruction] logMessages: List[str] preBalances: List[int] postBalances: List[int] preTokenBalances: List[TokenBalance] postTokenBalances: List[TokenBalance] uiTokenAmount: UiToken...
code_fim
hard
{ "lang": "python", "repo": "eteryko/audius-protocol", "path": "/discovery-provider/src/solana/solana_transaction_types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: upwork/python-upwork path: /tests/routers/test_snapshots.py import upwork from upwork.routers import snapshots from unittest.mock import patch @patch.object(upwork.Client, "get") def test_get_by_contract(mocked_method): <|fim_suffix|>@patch.object(upwork.Client, "put") def test_update_by_contra...
code_fim
medium
{ "lang": "python", "repo": "upwork/python-upwork", "path": "/tests/routers/test_snapshots.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }