text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> def generator(self, data_dir, tmp_dir, is_training): # In this test problem, we assume that the data is in tmp_dir/ocr/ in # files names 0.png, 0.txt, 1.png, 1.txt and so on until num_examples. num_examples = 2 ocr_dir = os.path.join(tmp_dir, "ocr/") tf.logging.info("Looking for OCR ...
code_fim
hard
{ "lang": "python", "repo": "yyht/BERT", "path": "/t2t_bert/utils/tensor2tensor/data_generators/ocr.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # moonlight channel # calc current brightness of the moon # percentage is max_moonlight_percentage times moonlight_brightness in percent if not channel['manual'] and channel['moonlight']: print(" moonlight channel") # create moonlight object using t...
code_fim
hard
{ "lang": "python", "repo": "isnuryusuf/ReefLight", "path": "/reeflight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # normal channel (new percentage calculated via interpolation of the data_points) if not channel['manual'] and not channel['moonlight']: # normal channel # new percentage updated via linear interpolation of the data_points print(" regular channel") ...
code_fim
hard
{ "lang": "python", "repo": "isnuryusuf/ReefLight", "path": "/reeflight.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: isnuryusuf/ReefLight path: /reeflight.py from flask import Flask, request, render_template import json import time import datetime import paho.mqtt.client as mqtt import pylunar import threading import math server = Flask(__name__) settings_file = "settings.json" # # save, load and print the ...
code_fim
hard
{ "lang": "python", "repo": "isnuryusuf/ReefLight", "path": "/reeflight.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert isinstance(node, ast.Name) return node.id<|fim_prefix|># repo: mugwort-rc/pyqtpp path: /pyqtpp/util.py # -*- coding: utf-8 -*- import ast def attr2list(node): prefix = [] assert isinstance(node, ast.Attribute) if isinstance(node.value, ast.Attribute): prefix = attr2li...
code_fim
easy
{ "lang": "python", "repo": "mugwort-rc/pyqtpp", "path": "/pyqtpp/util.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mugwort-rc/pyqtpp path: /pyqtpp/util.py # -*- coding: utf-8 -*- import ast def attr2list(node): <|fim_suffix|> assert isinstance(node, ast.Name) return node.id<|fim_middle|> prefix = [] assert isinstance(node, ast.Attribute) if isinstance(node.value, ast.Attribute): pr...
code_fim
hard
{ "lang": "python", "repo": "mugwort-rc/pyqtpp", "path": "/pyqtpp/util.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> type A shortened string of the platform name. typeLong An enlongated string of the platform name. membershipTypeID The numerical value of the platform. """ def __init__(self, membershipType): self._conversion = { 1: ["xb", "xbox", 1], ...
code_fim
medium
{ "lang": "python", "repo": "TheTimebike/destiny.py", "path": "/destiny/platform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheTimebike/destiny.py path: /destiny/platform.py class Platform: """Represents membershipType data given back by the API in a more user-friendly format. Can be created any time by passing a numerical membershipType value. IE: 1, 2 or 3 <|fim_suffix|> self._conversion = { ...
code_fim
hard
{ "lang": "python", "repo": "TheTimebike/destiny.py", "path": "/destiny/platform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _read_lines(fn): # NC_000007.13 RefSeq cDNA_match 50344265 50344518 254 + . ID=aln58042;Target=NM_001220765.2 1 254 +;gap_count=0;identity=0.0691326;idty=1;num_ident=428;num_mismatch=0;pct_coverage=6.91326;pct_identity_gap=100;pct_identity_ungap=100;score=254 # NC_000002.11 RefSeq...
code_fim
hard
{ "lang": "python", "repo": "simexin/uta", "path": "/sbin/ncbi-parse-gff", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def convert_exon_data(opts, exon_recs): """return (TxInfo,ExonSet) tuple for given exon record data""" er0 = exon_recs[0] ti = TxInfo(ac=er0["tx_ac"], origin=opts.origin, hgnc=None, cds_se_i=None, exons_se_i=";".join( ...
code_fim
hard
{ "lang": "python", "repo": "simexin/uta", "path": "/sbin/ncbi-parse-gff", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: simexin/uta path: /sbin/ncbi-parse-gff #!/usr/bin/env python """Write exonsets and txinfo files from NCBI GFF alignments, as obtained from ftp://ftp.ncbi.nlm.nih.gov/refseq/H_sapiens/alignments/ This service appeared in April 2015 and is due to update weekly. See uta.formats for a description o...
code_fim
hard
{ "lang": "python", "repo": "simexin/uta", "path": "/sbin/ncbi-parse-gff", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ckreutz/open-aid-data path: /openaid.py 'a') link = 'recipient_country/' + country + '/' + year input = sitemap(link) sitemap_file.write(input) sitemap_file.close() year = int(year) position = query_db('SELECT id from crs_donortop where recipientcode = {0}'.format(countr...
code_fim
hard
{ "lang": "python", "repo": "ckreutz/open-aid-data", "path": "/openaid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/sectors/<year>/') def show_schwerpunkte(year): var = {'year': year} sitemap_file = open('sitemap.xml', 'a') link = 'sectors/' + year input = sitemap(link) sitemap_file.write(input) sitemap_file.close() entries = [] if year == ...
code_fim
hard
{ "lang": "python", "repo": "ckreutz/open-aid-data", "path": "/openaid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> recipient_countries = [] for row in query_db('select round(sum(usd_disbursement * 1000000)) as main_value, recipientname, recipientcode, count(id) as activities from crs where donorcode = {0} and Year = {1} group by recipientname order by main_value desc limit 10'.format(donor, year)): ...
code_fim
hard
{ "lang": "python", "repo": "ckreutz/open-aid-data", "path": "/openaid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: StanleyCruvinel/mlrun path: /tests/test_sqldb.py # Copyright 2019 Iguazio # # 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/licenses/LICENSE-2...
code_fim
hard
{ "lang": "python", "repo": "StanleyCruvinel/mlrun", "path": "/tests/test_sqldb.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> runs = list(db.list_runs(uid=uid, iter=True)) assert 5 == len(runs), 'iter=True' def test_schedules(db: sqldb.SQLDB): count = 7 for i in range(count): data = {'i': i} db.store_schedule(data) scheds = list(db.list_schedules()) assert count == len(scheds), 'wrong n...
code_fim
hard
{ "lang": "python", "repo": "StanleyCruvinel/mlrun", "path": "/tests/test_sqldb.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> db.store_artifact('k1', {}, '1', tag='t1', project='p1') db.store_artifact('k1', {}, '2', tag='t2', project='p1') db.store_artifact('k1', {}, '2', tag='t2', project='p2') tags = db.list_artifact_tags('p1') assert {'t1', 't2'} == set(tags), 'bad tags' def test_list_artifact_date(db: ...
code_fim
hard
{ "lang": "python", "repo": "StanleyCruvinel/mlrun", "path": "/tests/test_sqldb.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiazhizhong/bk-log path: /apps/feature_toggle/plugins/base.py # -*- coding: utf-8 -*- """ Tencent is pleased to support the open source community by making BK-LOG 蓝鲸日志平台 available. Copyright (C) 2021 THL A29 Limited, a Tencent company. All rights reserved. BK-LOG 蓝鲸日志平台 is licensed under the MIT...
code_fim
hard
{ "lang": "python", "repo": "jiazhizhong/bk-log", "path": "/apps/feature_toggle/plugins/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def action(self): """ trigger action if need at update config must try any exception """ pass @register class DummyFeatureToggle(FeatureToggleBase): target = "dummy" def set_status(self, param: dict) -> dict: return param ...
code_fim
hard
{ "lang": "python", "repo": "jiazhizhong/bk-log", "path": "/apps/feature_toggle/plugins/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>append(int(line)) line = f.readline() line = line.strip('\n') f.close() c.sort() len1 = int(len(c)/2) print(c[len1])<|fim_prefix|># repo: ioyy900205/PyTorch_mess-around path: /txt_read.py f = open("/home/liuliang/data.txt") line = f.readline() line <|fim_middle|>= line.strip('\n') c = [] while l...
code_fim
medium
{ "lang": "python", "repo": "ioyy900205/PyTorch_mess-around", "path": "/txt_read.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ioyy900205/PyTorch_mess-around path: /txt_read.py f = open("/home/liuliang/data.txt") line = f.readline() line = line.strip('\n') c = [] while line: # print(line) c.<|fim_suffix|>p('\n') f.close() c.sort() len1 = int(len(c)/2) print(c[len1])<|fim_middle|>append(int(line)) line = f.re...
code_fim
medium
{ "lang": "python", "repo": "ioyy900205/PyTorch_mess-around", "path": "/txt_read.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jordan-Kowal/discord-dice-roller path: /discord_dice_roller/cogs/utility.py """Cog for utility commands like clean up or about""" # Built-in import time # Third-party from discord.ext import commands # Application from utils.cog import ImprovedCog from utils.embed import create_embed, create_e...
code_fim
hard
{ "lang": "python", "repo": "Jordan-Kowal/discord-dice-roller", "path": "/discord_dice_roller/cogs/utility.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _should_delete(self, msg, ctx): """ Predicate to choose which message to delete in the `purge` API :param Message msg: Any discord message we are reading through :param Context ctx: The command call context :return: Whether the message should be deleted ...
code_fim
hard
{ "lang": "python", "repo": "Jordan-Kowal/discord-dice-roller", "path": "/discord_dice_roller/cogs/utility.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muzudho/openpyxl-practice path: /read_cell.py import openpyxl as xl # Book wb = xl.load_workbook('test-data/test-data.xlsx') # Sheet ws = wb['Test1'] <|fim_suffix|># Cell value print(f'cell(value={c3.value})')<|fim_middle|># Cell c3 = ws['C3']
code_fim
easy
{ "lang": "python", "repo": "muzudho/openpyxl-practice", "path": "/read_cell.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Cell value print(f'cell(value={c3.value})')<|fim_prefix|># repo: muzudho/openpyxl-practice path: /read_cell.py import openpyxl as xl # Book wb = xl.load_workbook('test-data/test-data.xlsx') <|fim_middle|># Sheet ws = wb['Test1'] # Cell c3 = ws['C3']
code_fim
easy
{ "lang": "python", "repo": "muzudho/openpyxl-practice", "path": "/read_cell.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muzudho/openpyxl-practice path: /read_cell.py import openpyxl as xl <|fim_suffix|># Cell value print(f'cell(value={c3.value})')<|fim_middle|># Book wb = xl.load_workbook('test-data/test-data.xlsx') # Sheet ws = wb['Test1'] # Cell c3 = ws['C3']
code_fim
medium
{ "lang": "python", "repo": "muzudho/openpyxl-practice", "path": "/read_cell.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if line.end == 0: return pos = line.end while line.buffer[pos - 1] in string.whitespace and pos > line.start: pos -= 1 if pos != line.end and line.buffer[pos] in ' \t': yield LintProblem(line.line_no, pos - line.start + 1, 'trailing spaces...
code_fim
medium
{ "lang": "python", "repo": "jennahung/infra_project-config", "path": "/jenkins/scripts/yamllint.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jennahung/infra_project-config path: /jenkins/scripts/yamllint.py #!/usr/bin/env python import sys import yaml import string from yamllint.linter import LintProblem if len(sys.argv) < 2: print 'Missing file to lint' sys.exit(1) ID = 'trailing-spaces' TYPE = 'line' def check(conf, line...
code_fim
medium
{ "lang": "python", "repo": "jennahung/infra_project-config", "path": "/jenkins/scripts/yamllint.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class TestManager(models.Manager): def for_user(self, user): return self.get_query_set().filter(Q(website__users__id=user.pk) | Q(website__groups__users__id=user.pk))<|fim_prefix|># repo: randomknowledge/mwt path: /mwt/managers.py from django.db import models from django.db.models.query_util...
code_fim
hard
{ "lang": "python", "repo": "randomknowledge/mwt", "path": "/mwt/managers.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: randomknowledge/mwt path: /mwt/managers.py from django.db import models from django.db.models.query_utils import Q from . import constants from .utils.time import get_tznow class RunScheduleManager(models.Manager): def pending(self): qset = self.get_query_set().filter(paused=False) ...
code_fim
hard
{ "lang": "python", "repo": "randomknowledge/mwt", "path": "/mwt/managers.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: ltoscano/Y-Flow path: /tools/trec2trecs.py import argparse import os import io import re def output_doc(text, filename): with open(filename, 'wt') as fout: for line in text: fout.write(line) def trecs2trec(filename, output_dir, lowercase=False): <|fim_suffix|> files =...
code_fim
hard
{ "lang": "python", "repo": "ltoscano/Y-Flow", "path": "/tools/trec2trecs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open(filename) as fin: print(filename) for line in fin: line.strip() if '<DOC>' in line: ## begin a document text = [line] elif '</DOC>' in line: text.append(line) output_doc(text, os.path.join(out...
code_fim
medium
{ "lang": "python", "repo": "ltoscano/Y-Flow", "path": "/tools/trec2trecs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if clean: green_print("Clean") # Return the porcelain status of a submodule project @memoized def submodule_status(self, sub): path = self.sub_folder(sub) command = ["git", "-C", path, "status", "--porcelain", "--branch"] status = exec_command(com...
code_fim
hard
{ "lang": "python", "repo": "wichtounet/pm", "path": "/pm/scm/git.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wichtounet/pm path: /pm/scm/git.py #======================================================================= # Copyright (c) 2014 Baptiste Wicht # Distributed under the terms of the MIT License. # (See accompanying file LICENSE or copy at # http://opensource.org/licenses/MIT) #===================...
code_fim
hard
{ "lang": "python", "repo": "wichtounet/pm", "path": "/pm/scm/git.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> path = self.sub_folder(sub) command = ["git", "-C", path, "status", "--porcelain", "--branch"] status = exec_command(command) return status def find_detached_source_branch(self, path): command = ["git", "-C", path, "for-each-ref", "--forma...
code_fim
hard
{ "lang": "python", "repo": "wichtounet/pm", "path": "/pm/scm/git.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: watrt/micropython-mgui path: /mgui/dev/ssd1306pygame.py try: import framebuf except ImportError: from . import framebuf from sys import exit from multiprocessing import Process, Queue, Array # from pygame.time import wait from pygame import locals as L from pygame import display as pyg_d...
code_fim
hard
{ "lang": "python", "repo": "watrt/micropython-mgui", "path": "/mgui/dev/ssd1306pygame.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> req = RefreshRequest() req.action = signal req.value = value req.rect = rect req.data = data if self.__main_process: if self.__screen == None: return self.__request_list.append(req) else: if self.__...
code_fim
hard
{ "lang": "python", "repo": "watrt/micropython-mgui", "path": "/mgui/dev/ssd1306pygame.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Setup robots.txt path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_type="text/plain")) ] if settings.PGS_ON_CURATION_SITE: # e.g.: /stats/ urlpatterns.append(path('stats/', views.stats, name='Stats')) # e.g.: /releases/ urlpatterns.append(path('release...
code_fim
hard
{ "lang": "python", "repo": "PGScatalog/PGS_Catalog", "path": "/catalog/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # e.g.: /labs path('labs/', views.LabsView.as_view(), name="Labs"), # Setup URL used to warmup the Django app in the Google App Engine path('_ah/warmup', views.warmup, name="Warmup"), # Setup robots.txt path("robots.txt", TemplateView.as_view(template_name="robots.txt", content_t...
code_fim
hard
{ "lang": "python", "repo": "PGScatalog/PGS_Catalog", "path": "/catalog/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: PGScatalog/PGS_Catalog path: /catalog/urls.py from django.conf import settings from django.urls import path from django.views.generic.base import RedirectView, TemplateView from django.views.decorators.cache import cache_page from . import views # Seconds * Minutes cache_time = 60 * 60 urlpatt...
code_fim
hard
{ "lang": "python", "repo": "PGScatalog/PGS_Catalog", "path": "/catalog/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return cls( item.get(DynamoDbClient.GITHUB_HANDLE_KEY, {}).get("S", ""), item.get(DynamoDbClient.USER_ID_KEY, {}).get("S", ""), ) @staticmethod def _get_custom_field_value(custom_field: dict): if custom_field["type"] == "text": return cu...
code_fim
medium
{ "lang": "python", "repo": "isabella232/SGTM", "path": "/src/sync_users/sgtm_user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.domain_user_id = domain_user_id @classmethod def from_dynamodb_item(cls, item: dict) -> SgtmUser: return cls( item.get(DynamoDbClient.GITHUB_HANDLE_KEY, {}).get("S", ""), item.get(DynamoDbClient.USER_ID_KEY, {}).get("S", ""), ) @staticmeth...
code_fim
medium
{ "lang": "python", "repo": "isabella232/SGTM", "path": "/src/sync_users/sgtm_user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: isabella232/SGTM path: /src/sync_users/sgtm_user.py """ Class representing a "User" for SGTM, which comprises of a Github handle and an Asana domain user id. In practice, these should be actual developers in your organization that are contributing to your repository, which have an Asana account a...
code_fim
medium
{ "lang": "python", "repo": "isabella232/SGTM", "path": "/src/sync_users/sgtm_user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: praekeltfoundation/nurseconnect-registration path: /seaworthy/fixtures.py import pytest from seaworthy.containers.postgresql import PostgreSQLContainer from seaworthy.definitions import ContainerDefinition NCREG_IMAGE = pytest.config.getoption("--ncreg-image") <|fim_suffix|> super().__i...
code_fim
medium
{ "lang": "python", "repo": "praekeltfoundation/nurseconnect-registration", "path": "/seaworthy/fixtures.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> postgresql_container = PostgreSQLContainer("postgresql") f = postgresql_container.pytest_clean_fixtures("postgresql_container") postgresql_fixture, clean_postgresql_fixture = f ncreg_container = NCRegContainer( "nurseconnect_registration", postgresql_container.database_url() ) ncreg_fixture = ncreg_...
code_fim
hard
{ "lang": "python", "repo": "praekeltfoundation/nurseconnect-registration", "path": "/seaworthy/fixtures.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>print(f"\nO Jogador {jogador['Nome']} jogou {len(jogador['Gols'])} partidas.") for item, valor in enumerate(jogador['Gols']): print(f'Na partida {item+1} fez {valor} gols') print(f"Foi um total de {jogador['Total de Gols']} gols.")<|fim_prefix|># repo: matheusguerreiro/python path: /Python/19 - 093 -...
code_fim
medium
{ "lang": "python", "repo": "matheusguerreiro/python", "path": "/Python/19 - 093 - cadastro de jogador de futebol.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: matheusguerreiro/python path: /Python/19 - 093 - cadastro de jogador de futebol.py # Aula 19 (Dicionários) from time import sleep jogador = {} gols = [] jogador['Nome'] = str(input('Nome do Jogador: ')) totalGols = 0 quantidadePartidas = int(input('Quantas partidas ele Jogou? ')) for c in rang...
code_fim
medium
{ "lang": "python", "repo": "matheusguerreiro/python", "path": "/Python/19 - 093 - cadastro de jogador de futebol.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlexKyuu/collective-intelligence path: /recommendations.py # coding=utf-8 from math import sqrt critics = { 'Lisa Rose': { 'Lady in the Water': 2.5, 'Snakes on the Plane': 3.5, 'Just My Luck': 3.0, 'Superman Returns': 3.5, 'You, Me and Dupree': 2.5, ...
code_fim
hard
{ "lang": "python", "repo": "AlexKyuu/collective-intelligence", "path": "/recommendations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user_rattings = prefs[user] scores = {} total_sim = {} # 循环遍历由当前用户评分的物品 for (item, rating) in user_rattings.items(): # 循环遍历与当前物品相近的物品 for (similarity, item2) in item_match[item]: # 如果该用户已经对当前物品做过评价, 则将其忽略 if item2 in user_rattings: continue ...
code_fim
hard
{ "lang": "python", "repo": "AlexKyuu/collective-intelligence", "path": "/recommendations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nocproject/noc path: /vc/migrations/0018_vc_state.py # --------------------------------------------------------------------- # VRF, Prefix, IP state # --------------------------------------------------------------------- # Copyright (C) 2007-2019 The NOC Project # See LICENSE for details # ------...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/vc/migrations/0018_vc_state.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(BaseMigration): depends_on = [("main", "0043_default_resourcestates")] def migrate(self): # Create .state ResourceState = self.db.mock_model( model_name="ResourceState", db_table="main_resourcestate" ) self.db.add_column( "v...
code_fim
medium
{ "lang": "python", "repo": "nocproject/noc", "path": "/vc/migrations/0018_vc_state.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdikov/vae-playground path: /playground/models/networks/encoder.py 'add', 'concatenate' and 'product' are available.") standard_normal_sampler.arguments = {'seed': config['seed'], 'noise_dim': noise_dim, 'mode': noise_mode} for i, inp in enumerate(inputs): noise_inpu...
code_fim
hard
{ "lang": "python", "repo": "gdikov/vae-playground", "path": "/playground/models/networks/encoder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class StandardConjointEncoder(object): """ A StandardConjointEncoder parametrises an arbitrary latent distribution given two (or more) datasets, by partially sharing the latent vector between two (or more) encoders: Data_1 Data_2 | ...
code_fim
hard
{ "lang": "python", "repo": "gdikov/vae-playground", "path": "/playground/models/networks/encoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> latent_factors = [] for i, (a, v) in enumerate(zip(coefficients, noise_basis_vectors)): latent_factors.append(Multiply(name='enc_elemwise_coeff_vecs_mult_{}'.format(i))([a, v])) latent_factors = Add(name='enc_add_weighted_vecs')(latent_factors) latent_factors = ...
code_fim
hard
{ "lang": "python", "repo": "gdikov/vae-playground", "path": "/playground/models/networks/encoder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': mprre = MultiPulseRadarRangeEquation() mprre.main()<|fim_prefix|># repo: djfish1/RadarToolbox path: /MultiPulseRadarRangeEquation.py import math import RadarRangeEquation class MultiPulseRadarRangeEquation(RadarRangeEquation.RadarRangeEquation): <|fim_middle|> def __init...
code_fim
medium
{ "lang": "python", "repo": "djfish1/RadarToolbox", "path": "/MultiPulseRadarRangeEquation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: djfish1/RadarToolbox path: /MultiPulseRadarRangeEquation.py import math import RadarRangeEquation class MultiPulseRadarRangeEquation(RadarRangeEquation.RadarRangeEquation): def __init__(self): <|fim_suffix|>if __name__ == '__main__': mprre = MultiPulseRadarRangeEquation() mprre.main()<|fi...
code_fim
medium
{ "lang": "python", "repo": "djfish1/RadarToolbox", "path": "/MultiPulseRadarRangeEquation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Export data from a python engine, data= (engname, onames), result=None EXPORT = 'Export' #Import data from a file, data=(), result=None IMPORT = 'Import'<|fim_prefix|># repo: tito2016/Python-Project path: /PythonToolkit-14.04.04/ptk_lib/core_tools/fileio/fileio_messages.py """ Message types for th...
code_fim
medium
{ "lang": "python", "repo": "tito2016/Python-Project", "path": "/PythonToolkit-14.04.04/ptk_lib/core_tools/fileio/fileio_messages.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tito2016/Python-Project path: /PythonToolkit-14.04.04/ptk_lib/core_tools/fileio/fileio_messages.py """ Message types for the FileIO tool """ #Addressed messages sent to 'FileIO' #Open the file(s) using the fileio system, data=filenames, result=None OPEN = 'Open' <|fim_suffix|>#Import ...
code_fim
medium
{ "lang": "python", "repo": "tito2016/Python-Project", "path": "/PythonToolkit-14.04.04/ptk_lib/core_tools/fileio/fileio_messages.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lsmo-epfl/aiida-lsmo path: /aiida_lsmo/calcfunctions/working_cap.py # -*- coding: utf-8 -*- """Calcfunctions to compute working capacities for different gasses.""" from math import sqrt from aiida.engine import calcfunction from aiida.orm import Dict def get_molec_uc_to_mg_g(isot_dict): ""...
code_fim
hard
{ "lang": "python", "repo": "lsmo-epfl/aiida-lsmo", "path": "/aiida_lsmo/calcfunctions/working_cap.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # conversion factors form mol/kg to cm3STP/cm3 and wt% conv1 = isot_dict['conversion_factor_molec_uc_to_cm3stp_cm3'] / isot_dict['conversion_factor_molec_uc_to_mol_kg'] # pylint: disable=line-too-long conv2 = get_molec_uc_to_mg_g(isot_dict) / isot_dict['conversion_factor_molec_uc_...
code_fim
hard
{ "lang": "python", "repo": "lsmo-epfl/aiida-lsmo", "path": "/aiida_lsmo/calcfunctions/working_cap.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('home', '0010_auto_20200822_0327'), ] operations = [ migrations.AlterField( model_name='siparis', name='kisi_say', field=models.IntegerField(default=1, verbose_name='Kisi Say'), ), ]<|fim_prefix|># rep...
code_fim
medium
{ "lang": "python", "repo": "nursenyanar/bi-odeme", "path": "/home/migrations/0011_auto_20200822_0335.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nursenyanar/bi-odeme path: /home/migrations/0011_auto_20200822_0335.py # Generated by Django 2.1.7 on 2020-08-22 00:35 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('home', '0010_auto_20200822_0327'), ] operations = [ migrations.A...
code_fim
easy
{ "lang": "python", "repo": "nursenyanar/bi-odeme", "path": "/home/migrations/0011_auto_20200822_0335.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sudoguy/dtf_bot path: /base/models/skipped.py from django.db import models from .base import BaseModel class Skipped(BaseModel): <|fim_suffix|> class Meta: constraints = [ models.UniqueConstraint(fields=["object_id", "object_type"], name="unique_skipped") ]<|fim_...
code_fim
medium
{ "lang": "python", "repo": "sudoguy/dtf_bot", "path": "/base/models/skipped.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> object_id = models.BigIntegerField() object_type = models.CharField(max_length=255) class Meta: constraints = [ models.UniqueConstraint(fields=["object_id", "object_type"], name="unique_skipped") ]<|fim_prefix|># repo: sudoguy/dtf_bot path: /base/models/skipped.py...
code_fim
easy
{ "lang": "python", "repo": "sudoguy/dtf_bot", "path": "/base/models/skipped.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: constraints = [ models.UniqueConstraint(fields=["object_id", "object_type"], name="unique_skipped") ]<|fim_prefix|># repo: sudoguy/dtf_bot path: /base/models/skipped.py from django.db import models from .base import BaseModel <|fim_middle|>class Skipped(Base...
code_fim
medium
{ "lang": "python", "repo": "sudoguy/dtf_bot", "path": "/base/models/skipped.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Atelier-Developers/atelier-artemisia-processor path: /Processor/utils.py from gate.input_gate import Input <|fim_suffix|> for i in range(len(bitstring)): inps[i].output = 0 if bitstring[i] == "0" else 1 return inps<|fim_middle|>def bits_to_gates(bitstring, inps):
code_fim
easy
{ "lang": "python", "repo": "Atelier-Developers/atelier-artemisia-processor", "path": "/Processor/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(bitstring)): inps[i].output = 0 if bitstring[i] == "0" else 1 return inps<|fim_prefix|># repo: Atelier-Developers/atelier-artemisia-processor path: /Processor/utils.py from gate.input_gate import Input <|fim_middle|>def bits_to_gates(bitstring, inps):
code_fim
easy
{ "lang": "python", "repo": "Atelier-Developers/atelier-artemisia-processor", "path": "/Processor/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return fun(expx(x), *fargs, **fkwargs) # Transform the final result result = minimizer(new_fun, logx(x0), jac=new_jac, bounds=bounds, **minimizer_kwargs) result['x'] = expx(result['x']) return result return new_minimizer de...
code_fim
hard
{ "lang": "python", "repo": "lizhangzhan/revrand", "path": "/revrand/optimize/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lizhangzhan/revrand path: /revrand/optimize/base.py nums=[5, 3]).shape (2, 15) >>> candidate_start_points_lattice([(-1, 1.5), (-1.5, 3), (0, 5)], ... nums=[5, 10, 9]) # doctest: +ELLIPSIS array([[-1. , -1. , -1. , ..., 1.5 , 1.5 , ...
code_fim
hard
{ "lang": "python", "repo": "lizhangzhan/revrand", "path": "/revrand/optimize/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if bounds is None: return sgd(fun, x0, data, bounds=bounds, eval_obj=eval_obj, **sgd_kwargs) logx, expx, gradx, bounds = logtrick_gen(bounds) if bool(eval_obj): def new_fun(x, *fargs, **fkwargs): o, g = fun(expx(x), ...
code_fim
hard
{ "lang": "python", "repo": "lizhangzhan/revrand", "path": "/revrand/optimize/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: graphistry/pygraphistry path: /graphistry/tests/test_ArrowFileUploader.py import pandas as pd, pyarrow as pa, unittest from graphistry.arrow_uploader import ArrowUploader from graphistry.ArrowFileUploader import ( ArrowFileUploader, DF_TO_FILE_ID_CACHE, MemoizedFileUpload, Wrappe...
code_fim
hard
{ "lang": "python", "repo": "graphistry/pygraphistry", "path": "/graphistry/tests/test_ArrowFileUploader.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class TestArrowFileUploader_Core(unittest.TestCase): def test_memoization(self): afu = ArrowFileUploader(ArrowUploader(token="xx")) arr = pa.Table.from_pandas(pd.DataFrame({"x": [1, 2, 3]})) # avoid directly holding references DF_TO_FILE_ID_CACHE[cache_arr(WrappedTab...
code_fim
medium
{ "lang": "python", "repo": "graphistry/pygraphistry", "path": "/graphistry/tests/test_ArrowFileUploader.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: jvrsantacruz/ipodio path: /spec/ui/rename_spec.py # -*- coding: utf-8 -*- from expects import expect from mamba import describe, context, before, after from spec.ui._ipod_helpers import * from spec.ui._fixture import update_environment <|fim_suffix|> execution = _.env.run( *...
code_fim
hard
{ "lang": "python", "repo": "jvrsantacruz/ipodio", "path": "/spec/ui/rename_spec.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def should_show_an_error_when_called_without_arguments(): execution = _.env.run(*_.cmd + ['rename'], expect_error=True) expect(execution.stderr).to.have('Usage') def should_show_an_error_when_called_with_expression_but_without_replacement(): execution = _.env.run(*_.cmd +...
code_fim
medium
{ "lang": "python", "repo": "jvrsantacruz/ipodio", "path": "/spec/ui/rename_spec.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> execution = _.env.run(*_.cmd + ['rename'], expect_error=True) expect(execution.stderr).to.have('Usage') def should_show_an_error_when_called_with_expression_but_without_replacement(): execution = _.env.run(*_.cmd + ['rename', _.expression], expect_error=True) expect(...
code_fim
hard
{ "lang": "python", "repo": "jvrsantacruz/ipodio", "path": "/spec/ui/rename_spec.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fmehralian/Image-Caption-Joint-Embedding path: /transfer.py from data import Data from settings import config from iconClasses.model import Model from loss import PairwiseRankingLoss as Loss from optimizer import Optimizer if __name__ == "__main__": # Load data data = Data() data.load_dictio...
code_fim
hard
{ "lang": "python", "repo": "fmehralian/Image-Caption-Joint-Embedding", "path": "/transfer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Optimizer optimizer = Optimizer(model) # Begin epochs for epoch in range(config["num_epochs"]): print("[EPOCH]", epoch+1) # Process batches for caption, image_feature, contents in data: pass # Pass data through model caption, image_feature = model(caption, image_feature) # ...
code_fim
medium
{ "lang": "python", "repo": "fmehralian/Image-Caption-Joint-Embedding", "path": "/transfer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Evaluate final model results model.evaluate(data, save_if_better=True) # Final evaluation print("\nFinal evaluation:") model.evaluate(data, save_if_better=True) print("\n[SCRIPT] complete")<|fim_prefix|># repo: fmehralian/Image-Caption-Joint-Embedding path: /transfer.py from data imp...
code_fim
hard
{ "lang": "python", "repo": "fmehralian/Image-Caption-Joint-Embedding", "path": "/transfer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmenezesgabriel/tick_track path: /tick_track/src/models/base.py from peewee import Model, DatabaseProxy <|fim_suffix|>class BaseModel(Model): """ Class responsible to create database connection. """ class Meta: # Indicates in which database the tables it will be created ...
code_fim
easy
{ "lang": "python", "repo": "dmenezesgabriel/tick_track", "path": "/tick_track/src/models/base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Class responsible to create database connection. """ class Meta: # Indicates in which database the tables it will be created database = database_proxy<|fim_prefix|># repo: dmenezesgabriel/tick_track path: /tick_track/src/models/base.py from peewee import Model, Databa...
code_fim
easy
{ "lang": "python", "repo": "dmenezesgabriel/tick_track", "path": "/tick_track/src/models/base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> NINDIRECT = 512 def __init__(self, idisk): self._NINDIRECT = IndirectInodeDisk.NINDIRECT self._idisk = idisk def get_iattr(self, ino): return self._idisk.get_iattr(ino) def set_iattr(self, ino, attr): self._idisk.set_iattr(ino, attr) def read(self, l...
code_fim
hard
{ "lang": "python", "repo": "fengjixuchui/hydra", "path": "/src/yggdrasil/xv6inode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fengjixuchui/hydra path: /src/yggdrasil/xv6inode.py import errno import sys import time import argparse from collections import namedtuple from stat import S_IFDIR import cython if not cython.compiled: from diskimpl import Allocator, DentryLookup from waldisk import WALDisk from disk...
code_fim
hard
{ "lang": "python", "repo": "fengjixuchui/hydra", "path": "/src/yggdrasil/xv6inode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return content ### # # Version: 1.1.0 # Date: 2020-04-15 # Author: Yves Vindevogel (vindevoy) # # Added logging # # Version: 1.0.0 # Date: 2020-04-13 # Author: Yves Vindevogel (vindevoy) # # This class was split of the DataLoader class # ###<|fim_prefix|># repo: vindevoy/cherryblo...
code_fim
hard
{ "lang": "python", "repo": "vindevoy/cherryblog", "path": "/src/application/model/codeversion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @property def data(self): content = Content().load_data_settings_yaml(self.__base_dir) self.__logger.debug('data - content: {0}'.format(content)) return content ### # # Version: 1.1.0 # Date: 2020-04-15 # Author: Yves Vindevogel (vindevoy) # # Added logging # # ...
code_fim
medium
{ "lang": "python", "repo": "vindevoy/cherryblog", "path": "/src/application/model/codeversion.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vindevoy/cherryblog path: /src/application/model/codeversion.py ### # # Full history: see below # # Version: 1.2.0 # Date: 2020-04-17 # Author: Yves Vindevogel (vindevoy) # # Features: # - Caching done outside this class # ### import logging <|fim_suffix|> __base_dir = 'codev...
code_fim
medium
{ "lang": "python", "repo": "vindevoy/cherryblog", "path": "/src/application/model/codeversion.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: analuisadev/100-Days-Of-Code path: /day-14.py import sys from time import sleep player = 10 sleep(1) #Welcome print ('=' *38) print ('\033[1;33mWelcome to game I ALREADY and I NEVER!\033[m') print ('=' *38) sleep(2) #Rules print ('''\033[1;33mRules: 1 ° For every question you ask you lose ...
code_fim
hard
{ "lang": "python", "repo": "analuisadev/100-Days-Of-Code", "path": "/day-14.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ever\033[m ')) if q8 == 1: player = player - 1 elif q8 == 2: pass else: print ('\033[1;31mInvalid answer, Choose between 1 (already) and 2 (NEVER)\033[m ') sys.exit() q9 = int(input('\033[1;36mI never immediately regretted having sent a message: 1 - Already 2 - Never\033[m ')) if q9 == 1: ...
code_fim
hard
{ "lang": "python", "repo": "analuisadev/100-Days-Of-Code", "path": "/day-14.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> text = request.data return text @app.after_request def add_cors(resp): resp.headers['Access-Control-Allow-Origin'] = flask.request.headers.get('Origin', '*') resp.headers['Access-Control-Allow-Credentials'] = True resp.headers['Access-Control-Allow-Methods'] = 'POST, OPTIONS, GET, PUT...
code_fim
hard
{ "lang": "python", "repo": "fayllanera/startup", "path": "/startup_llanera/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> res = spcall('login', (email,password), True) print res if 'Error' in str(res[0][0]): return jsonify({'status': 'error'}) return jsonify({'status': 'ok'}) @app.route('/data', methods=['POST', 'GET']) def data_post(): text = request.data return text @app.after_request def...
code_fim
medium
{ "lang": "python", "repo": "fayllanera/startup", "path": "/startup_llanera/app.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fayllanera/startup path: /startup_llanera/app.py from flask import Flask, jsonify, request from flask.ext.httpauth import HTTPBasicAuth import sys, flask import model app = Flask(__name__) auth = HTTPBasicAuth() def spcall(qry, param, commit=False): <|fim_suffix|> params = request.get_json(...
code_fim
hard
{ "lang": "python", "repo": "fayllanera/startup", "path": "/startup_llanera/app.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if select == 5 or select == 6: # 프리퀀시 데이터에 자카드 유사도 사용시 Xarr_seq, yTotal_seq, fileNum_seq = gcn_dataprocess.fileRead_Xarr(Normal_seq, Attack_seq, 1) if select == 5: # 전체 JACCARD_ROW = gcn_jaccard.JaccardSim(Xarr_seq, fileNum, 0) elif select == 6: # 한행...
code_fim
hard
{ "lang": "python", "repo": "yanghun-park/Sequenced-based-GCN-deep-learning", "path": "/kegra/gcn_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yanghun-park/Sequenced-based-GCN-deep-learning path: /kegra/gcn_main.py import os, datetime import numpy as np import scipy.sparse as sp import gcn_train import gcn_dataprocess import gcn_jaccard # ================================================================= # ...
code_fim
hard
{ "lang": "python", "repo": "yanghun-park/Sequenced-based-GCN-deep-learning", "path": "/kegra/gcn_main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 시퀀스 데이터에 자카드 유사도 사용시 if select == 2: # 전체 JACCARD_ROW = gcn_jaccard.JaccardSim(Xarr, fileNum, 0) if select == 3: # 한행 JACCARD_ROW = gcn_jaccard.JaccardSim(Xarr, fileNum, 1) if select == 5 or select == 6: # 프리퀀시 데이터에 자카드 유사도 사용시 Xarr_seq, ...
code_fim
hard
{ "lang": "python", "repo": "yanghun-park/Sequenced-based-GCN-deep-learning", "path": "/kegra/gcn_main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: savagej/mlflow-torchserve path: /examples/MNIST/predict.py import os from argparse import ArgumentParser import matplotlib.pyplot as plt from mlflow.deployments import get_deploy_client from torchvision import transforms def predict(parser_args): plugin = get_deploy_client(parser_args["tar...
code_fim
medium
{ "lang": "python", "repo": "savagej/mlflow-torchserve", "path": "/examples/MNIST/predict.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": parser = ArgumentParser(description="MNIST hand written digits classification example") parser.add_argument( "--target", type=str, default="torchserve", help="MLflow target (default: torchserve)", ) parser.add_argument( ...
code_fim
medium
{ "lang": "python", "repo": "savagej/mlflow-torchserve", "path": "/examples/MNIST/predict.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cytoplasm_feature = extract_cell_level_feature( c, 'Cytoplasm', tid, iid, set(extract_info_dict['cytoplasm_feature_filter_name']), extract_info_dict['cytoplasm_name'] ) nuclei_feature = extract_cell_level_feat...
code_fim
hard
{ "lang": "python", "repo": "gitter-lab/pharmaco-image", "path": "/scripts/extract_median_feature.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Connect the sql db conn = sqlite3.connect('./{}.sqlite'.format(pid)) c = conn.cursor() plate_features = [] plate_row_index = [] plate_row_bids = [] # Extract features well by well for i, r in df.iterrows(): if i == 3: break wid = r['Metadata_Well'] features, row_index = extract_f...
code_fim
hard
{ "lang": "python", "repo": "gitter-lab/pharmaco-image", "path": "/scripts/extract_median_feature.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gitter-lab/pharmaco-image path: /scripts/extract_median_feature.py import sqlite3 import pandas as pd import numpy as np from sys import argv from json import load def extract_cell_level_feature(c, table, tid, iid, filter_names, validation_names): """ Extr...
code_fim
hard
{ "lang": "python", "repo": "gitter-lab/pharmaco-image", "path": "/scripts/extract_median_feature.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # print(tf.get_collection(end_points_collection)) end_points.update( dict([(ep.name, ep) for ep in tf.get_collection(end_points_collection)])) end_points[ns + '_to_32'] = fcn32 end_points[ns + '_to_16'] = fcn16 end_points[ns + '_to_8'] = fcn8...
code_fim
hard
{ "lang": "python", "repo": "Mooonside/SEGS", "path": "/segs/fcn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mooonside/SEGS path: /segs/fcn.py """ An implementation of Fully Convolution Network By Yifeng Chen """ from re import search import tensorflow as tf from backbones.vgg_16 import vgg_16, vgg_arg_scope from tf_ops.wrap_ops import trans_conv2d, conv2d, tensor_shape arg_scope = tf.contrib.framewo...
code_fim
hard
{ "lang": "python", "repo": "Mooonside/SEGS", "path": "/segs/fcn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }