text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> applications_from_db = Application.query.filter_by(user_id=user_id,status=status).all()
for application in applications_from_db:
assert application is not None
assert application.status is "Applied"
if application.is_inhouse_posting:
assert application.date == c... | code_fim | hard | {
"lang": "python",
"repo": "scrum-gang/jobapplications",
"path": "/tests/test_db_creation.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Pregelnuss/snappy-pipeline path: /snappy_wrappers/wrappers/gcnv/coverage/wrapper.py
# -*- coding: utf-8 -*-
from snakemake.shell import shell
<|fim_suffix|>gatk CollectReadCounts \
--interval-merging-rule OVERLAPPING_ONLY \
-R {snakemake.config[static_data_config][reference][path]} \
... | code_fim | easy | {
"lang": "python",
"repo": "Pregelnuss/snappy-pipeline",
"path": "/snappy_wrappers/wrappers/gcnv/coverage/wrapper.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>gatk CollectReadCounts \
--interval-merging-rule OVERLAPPING_ONLY \
-R {snakemake.config[static_data_config][reference][path]} \
-L {snakemake.input.interval_list} \
-I {snakemake.input.bam} \
--format TSV \
-O {snakemake.output.tsv}
"""
)<|fim_prefix|># repo: Pregelnuss/snappy-pip... | code_fim | easy | {
"lang": "python",
"repo": "Pregelnuss/snappy-pipeline",
"path": "/snappy_wrappers/wrappers/gcnv/coverage/wrapper.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lmmentel/mendeleev path: /alembic/versions/615cc0829a54_add_molar_heat_capacity.py
"""add molar_heat_capacity
Revision ID: 615cc0829a54
Revises: 4d617114c1f5
Create Date: 2022-07-17 12:44:53.465229
"""
# revision identifiers, used by Alembic.
revision = '615cc0829a54'
down_revision = '4d617114... | code_fim | medium | {
"lang": "python",
"repo": "lmmentel/mendeleev",
"path": "/alembic/versions/615cc0829a54_add_molar_heat_capacity.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> op.add_column("elements", sa.Column("molar_heat_capacity", sa.Float))
def downgrade():
with op.batch_alter_table("elements") as batch_op:
batch_op.drop_column("molar_heat_capacity")<|fim_prefix|># repo: lmmentel/mendeleev path: /alembic/versions/615cc0829a54_add_molar_heat_capacity.py
... | code_fim | medium | {
"lang": "python",
"repo": "lmmentel/mendeleev",
"path": "/alembic/versions/615cc0829a54_add_molar_heat_capacity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
op.add_column("elements", sa.Column("molar_heat_capacity", sa.Float))
def downgrade():
with op.batch_alter_table("elements") as batch_op:
batch_op.drop_column("molar_heat_capacity")<|fim_prefix|># repo: lmmentel/mendeleev path: /alembic/versions/615cc0829a54_add_molar_heat_capacit... | code_fim | hard | {
"lang": "python",
"repo": "lmmentel/mendeleev",
"path": "/alembic/versions/615cc0829a54_add_molar_heat_capacity.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def load_input(self, context):
if context.dagster_type.typing_type == type(None):
return None
key = self._get_path(context)
context.log.debug(f"Loading S3 object from: {self._uri_for_key(key)}")
obj = pickle.loads(self.s3.get_object(Bucket=self.bucket, Key=... | code_fim | hard | {
"lang": "python",
"repo": "iKintosh/dagster",
"path": "/python_modules/libraries/dagster-aws/dagster_aws/s3/io_manager.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iKintosh/dagster path: /python_modules/libraries/dagster-aws/dagster_aws/s3/io_manager.py
import io
import pickle
from typing import Sequence, Union
from dagster import (
Field,
InputContext,
MemoizableIOManager,
MetadataValue,
OutputContext,
StringSource,
_check as c... | code_fim | hard | {
"lang": "python",
"repo": "iKintosh/dagster",
"path": "/python_modules/libraries/dagster-aws/dagster_aws/s3/io_manager.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vossenv/oneroster-python path: /tests/util.py
root_config_clever = {
'host': 'https://api.clever.com/v2.1/',
'client_id': '5d8a7b5eff6cbe25bc6e',
'client_secret': 'ec6d2c060987e32cbe785f7f1a58a30<|fim_suffix|>07a04cf0a4',
'key_identifier': 'id',
'page_s... | code_fim | hard | {
"lang": "python",
"repo": "vossenv/oneroster-python",
"path": "/tests/util.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|>07a04cf0a4',
'key_identifier': 'id',
'page_size': 1000,
'max_user_count': 0,
'match_groups_by': 'name',
'access_token': 'TEST_TOKEN'
}<|fim_prefix|># repo: vossenv/oneroster-python path: /tests/util.py
root_config_clever = {
'host': 'https://api.cle... | code_fim | hard | {
"lang": "python",
"repo": "vossenv/oneroster-python",
"path": "/tests/util.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: metisto/leaderboard path: /leaderboard/tower_fall.py
from collections import namedtuple, defaultdict
from leaderboard.model import Rank, PlayerRank
Score = namedtuple('Score', 'pseudo kills')
Match = namedtuple('Match', 'scores')
def compute_ranking(match):
<|fim_suffix|> ranking = []
... | code_fim | medium | {
"lang": "python",
"repo": "metisto/leaderboard",
"path": "/leaderboard/tower_fall.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ranking = []
rank = 1
for kills, pseudos in sorted(player_by_kills().iteritems(), reverse=True):
ranking.extend([PlayerRank(pseudo, Rank(rank)) for pseudo in pseudos])
rank += len(pseudos)
return ranking<|fim_prefix|># repo: metisto/leaderboard path: /leaderboard/tower_fal... | code_fim | hard | {
"lang": "python",
"repo": "metisto/leaderboard",
"path": "/leaderboard/tower_fall.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def player_by_kills():
result = defaultdict(list)
for score in match.scores:
result[score.kills].append(score.pseudo)
return result
ranking = []
rank = 1
for kills, pseudos in sorted(player_by_kills().iteritems(), reverse=True):
ranking.extend([... | code_fim | medium | {
"lang": "python",
"repo": "metisto/leaderboard",
"path": "/leaderboard/tower_fall.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertFalse("Sepal.Width" in result['X_train'])
self.assertFalse("Sepal.Width" in result['X_validate'])
self.assertFalse("Sepal.Width" in result['X_test'])
self.assertFalse("Petal.Width" in result['X_train'])
self.assertFalse("Petal.Width" in result['X_validate... | code_fim | hard | {
"lang": "python",
"repo": "david-ryan-alviola/utilities",
"path": "/modeling/test_model_utils.py",
"mode": "spm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: david-ryan-alviola/utilities path: /modeling/test_model_utils.py
import unittest
import model_utils as utils
import pandas as pd
from pydataset import data
from sklearn.model_selection import train_test_split
class TestModelUtils(unittest.TestCase):
train, test = train_test_split(data("iri... | code_fim | hard | {
"lang": "python",
"repo": "david-ryan-alviola/utilities",
"path": "/modeling/test_model_utils.py",
"mode": "psm",
"license": "Unlicense",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andife/hoggorm path: /tests/conftest.py
'''
To be able to run test you have to install the hoggorm package.
You can either do a normal install
pip install hoggorm
or you can install in developer mode
pip install -e .
or
python setup.py develop
'''
from pathlib import Path
import numpy as np
imp... | code_fim | hard | {
"lang": "python",
"repo": "andife/hoggorm",
"path": "/tests/conftest.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
def load_data(name, dtype=np.float64, reshape=None):
mat = np.loadtxt(datafolder.joinpath(name),
dtype=dtype,
skiprows=1)
if reshape:
mat = mat.reshape(*reshape)
return mat
return load_data
@pytest.f... | code_fim | hard | {
"lang": "python",
"repo": "andife/hoggorm",
"path": "/tests/conftest.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return "CardPrinting: {print.id_}".format(print=self)
def __repr__(self):
return "<CardPrinting: {print.id_}>".format(print=self)
def __hash__(self):
return hash(self.id_)
def __eq__(self, other):
return isinstance(other, type(self)) an... | code_fim | hard | {
"lang": "python",
"repo": "TonyRoomZ/mtg_ssm",
"path": "/mtg_ssm/mtg/models.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TonyRoomZ/mtg_ssm path: /mtg_ssm/mtg/models.py
"""Models for managing data."""
import datetime as dt
import string
import weakref
VARIANT_CHARS = string.ascii_letters + "★"
STRICT_BASICS = {"Plains", "Island", "Swamp", "Mountain", "Forest"}
class Card:
"""Model for storing card informatio... | code_fim | hard | {
"lang": "python",
"repo": "TonyRoomZ/mtg_ssm",
"path": "/mtg_ssm/mtg/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PainterQubits/Labber-Drivers path: /Painter_MiniCircuits_Solid_State_Switch/Painter_MiniCircuits_Solid_State_Switch.py
#!/usr/bin/env python
import clr # pythonnet
clr.AddReference('mcl_SolidStateSwitch_NET45') # Reference the DLL
from mcl_SolidStateSwitch_NET45 import USB_Digital_Switch
i... | code_fim | hard | {
"lang": "python",
"repo": "PainterQubits/Labber-Drivers",
"path": "/Painter_MiniCircuits_Solid_State_Switch/Painter_MiniCircuits_Solid_State_Switch.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Perform the Get Value instrument operation"""
self.establish_connection()
name = quant.name.split(" ")
if len(name) == 2:
switch_type = name[0]
elif len(name) == 3:
switch_type = name[0]
switch_channel = name[2]
if swi... | code_fim | hard | {
"lang": "python",
"repo": "PainterQubits/Labber-Drivers",
"path": "/Painter_MiniCircuits_Solid_State_Switch/Painter_MiniCircuits_Solid_State_Switch.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#Grade each HIT
#Remember, here 'hit' is a dictionary data structure corresponding to one row of your input CSV. It maps the CSV headers to the corresponding values for each row.
for hit in hit_data:
# get the correct answer for the control from this row of the CSV
correct_control_answer = hit['Input.l... | code_fim | hard | {
"lang": "python",
"repo": "manosai/tweepy",
"path": "/grade_hits_naive_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: manosai/tweepy path: /grade_hits_naive_template.py
#!/bin/python
"""
This code grades the HITs based on the embedded control tweets.
It takes as input the csv file containing the submitted HITs.
It outputs hits_graded.csv, which contains the columns 'Approve' and 'Reject', one of which contains ... | code_fim | medium | {
"lang": "python",
"repo": "manosai/tweepy",
"path": "/grade_hits_naive_template.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>#You may have used slightly different labelings when you annotated the gold standard tweets and when you recorded the Turkers' answers. You will need to map all the answers into a common notation so you can compare. For example, if you used 0=positive, 1=negative, 2=neutral in the HIT, fill that in here. ... | code_fim | hard | {
"lang": "python",
"repo": "manosai/tweepy",
"path": "/grade_hits_naive_template.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rhayes777/PyAutoFit path: /autofit/non_linear/search/mcmc/emcee/plotter.py
import numpy as np
import corner
from autofit.plot.samples_plotters import MCMCPlotter
class EmceePlotter(MCMCPlotter):
<|fim_suffix|> self.output.to_figure(structure=None, auto_filename="corner")
s... | code_fim | hard | {
"lang": "python",
"repo": "rhayes777/PyAutoFit",
"path": "/autofit/non_linear/search/mcmc/emcee/plotter.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def time_series(self, **kwargs):
self._plot_time_series(
samples=self.samples.results_internal.get_chain(),
)<|fim_prefix|># repo: rhayes777/PyAutoFit path: /autofit/non_linear/search/mcmc/emcee/plotter.py
import numpy as np
import corner
from autofit.plot.samples... | code_fim | hard | {
"lang": "python",
"repo": "rhayes777/PyAutoFit",
"path": "/autofit/non_linear/search/mcmc/emcee/plotter.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bihealth/hlama path: /hlama/pedigree.py
# -*- coding: utf-8 -*-
"""Implementation of the pedigree checking"""
from . import base
class PedigreeMember:
"""Representation of one PED file line"""
UNKNOWN = '0'
MALE = '1'
FEMALE = '2'
UNAFFECTED = '1'
AFFECTED = '2'
@... | code_fim | hard | {
"lang": "python",
"repo": "bihealth/hlama",
"path": "/hlama/pedigree.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def to_str(hla):
return hla.prec_str(precision)
for gene in 'ABC':
lhs_set = set(map(to_str, lhs_calls[gene]))
rhs_set = set(map(to_str, rhs_calls[gene]))
if lhs_set != rhs_set:
return False
return True
def run(args):
"""Run the consistency ch... | code_fim | hard | {
"lang": "python",
"repo": "bihealth/hlama",
"path": "/hlama/pedigree.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Register the enum with the marshal.
marshal.register(cls, EnumRule(cls))
# Done; return the class.
return cls
class Enum(enum.IntEnum, metaclass=ProtoEnumMeta):
"""A enum object that also builds a protobuf enum descriptor."""
pass<|fim_prefix|># repo: bobhanco... | code_fim | hard | {
"lang": "python",
"repo": "bobhancock/proto-plus-python",
"path": "/proto/enums.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bobhancock/proto-plus-python path: /proto/enums.py
# Copyright 2019 Google LLC
#
# 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
#
# https://www.apache.org/licenses/L... | code_fim | hard | {
"lang": "python",
"repo": "bobhancock/proto-plus-python",
"path": "/proto/enums.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>@pic.handle()
async def pic(bot: Bot, event: Event, state: dict): # 数据库
# logger.info(bot.__dict__)
# logger.info(event.dict())
# logger.info(state)
args = str(event.get_message()).strip().split()
url = args[0]
if url[:4] == "http":
await bot.send(message=Message(MessageSe... | code_fim | hard | {
"lang": "python",
"repo": "jijiuli/nonebot_tools",
"path": "/nonebot_tools/nonebot-plugin-hso/nonebot-plugin-hso/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>@reply.receive()
async def reply_receive(bot: Bot, event: Event, state: dict):
# logger.info(event.dict())
replay = event.dict()["reply"]
if replay and str(replay["sender"]["user_id"]) in hso_config.bot:
await Setu(bot, event, state).get_text(message_id=event.dict()["reply"]["message_i... | code_fim | hard | {
"lang": "python",
"repo": "jijiuli/nonebot_tools",
"path": "/nonebot_tools/nonebot-plugin-hso/nonebot-plugin-hso/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jijiuli/nonebot_tools path: /nonebot_tools/nonebot-plugin-hso/nonebot-plugin-hso/__init__.py
#! /usr/bin/env python3
# coding=utf-8
import asyncio
import httpx
from loguru import logger
from nonebot import on_command, on_message
from nonebot import on_regex
from nonebot.adapters.cqhttp import Bo... | code_fim | hard | {
"lang": "python",
"repo": "jijiuli/nonebot_tools",
"path": "/nonebot_tools/nonebot-plugin-hso/nonebot-plugin-hso/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def load_mask(self):
filepath = self.dirpath.joinpath("mask", f"{self.imsize}.npy")
assert filepath.is_file(),\
f"Did not find mask at: {filepath}"
masks = np.load(filepath)
assert len(masks) == len(self)
assert masks.dtype == np.bool
self.ma... | code_fim | hard | {
"lang": "python",
"repo": "hukkelas/DeepPrivacy",
"path": "/deep_privacy/dataset/fdf.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hukkelas/DeepPrivacy path: /deep_privacy/dataset/fdf.py
import pathlib
import numpy as np
import torch
from .build import DATASET_REGISTRY
from .custom import CustomDataset
def load_torch(filepath: pathlib.Path):
assert filepath.is_file(),\
f"Did not find file. Looked at: {filepath}... | code_fim | hard | {
"lang": "python",
"repo": "hukkelas/DeepPrivacy",
"path": "/deep_privacy/dataset/fdf.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> #In this part of code, each herb is
#1. Cropped ,after performing masking
#2.
for i in range(0,len(accepted_contours)):
image_counter = image_counter + 1
cv2.drawContours(thresh, accepted_contours, i, (255,255,255),thickness = -1)
x,y,w,h = cv2.boundingRect(accepted_contours[i])
#... | code_fim | hard | {
"lang": "python",
"repo": "shrobon/Traditional-Chinese-Herb-Classification",
"path": "/code/start1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
cropped_img= img[y:y+h,x:x+w]
Masked = perform_masking(cropped_img,erosion)
#We are now saving the extracted herb into the folder, after labelling it (filename)
cv2.imwrite('/home/shrobon/Assignment2/code/extracted/'+category_name+str(image_counter)+'.jpg',Masked)
'''
for i in range(0,le... | code_fim | hard | {
"lang": "python",
"repo": "shrobon/Traditional-Chinese-Herb-Classification",
"path": "/code/start1.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shrobon/Traditional-Chinese-Herb-Classification path: /code/start1.py
#__author__ : Shrobon Biswas
'''__Description__ :
This script segments individual herbs from the given images of the dataset.
The extracted herbs are labeled with the first 2 letters of their class name,
and stored in a separa... | code_fim | hard | {
"lang": "python",
"repo": "shrobon/Traditional-Chinese-Herb-Classification",
"path": "/code/start1.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>..")
bemenu_extended.bemenu().cache_build()<|fim_prefix|># repo: flopraden/bemenu-extended path: /scripts/bemenu_extended_cache_build
#! /usr/bin/env python
# -*- coding: utf8 -*-
import bemenu_extended
if __name__ == "__main__<|fim_middle|>":
print("Rebuilding bemenu_extended cache. | code_fim | easy | {
"lang": "python",
"repo": "flopraden/bemenu-extended",
"path": "/scripts/bemenu_extended_cache_build",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flopraden/bemenu-extended path: /scripts/bemenu_extended_cache_build
#! /usr/bin/env python
# -*- coding: utf8 -*-
import bemenu_extended
if __name__ == "__main__<|fim_suffix|>..")
bemenu_extended.bemenu().cache_build()<|fim_middle|>":
print("Rebuilding bemenu_extended cache. | code_fim | easy | {
"lang": "python",
"repo": "flopraden/bemenu-extended",
"path": "/scripts/bemenu_extended_cache_build",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
-------
None.
"""
print("Name: {}".format(self.name))
print("Input Queue: {}".format(self.input_queue))
print("Output Queue: {}".format(self.output_queue))
print("Restart Required: {}".format(str(self.restart_required)))
... | code_fim | hard | {
"lang": "python",
"repo": "blackhole077/rentvision-internship-project",
"path": "/core/PipelineManager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blackhole077/rentvision-internship-project path: /core/PipelineManager.py
sing documentation for more information.
output_queue : multiprocessing.JoinableQueue
The JoinableQueue which Processes will place finished items in.
See the Multiprocessing docum... | code_fim | hard | {
"lang": "python",
"repo": "blackhole077/rentvision-internship-project",
"path": "/core/PipelineManager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blackhole077/rentvision-internship-project path: /core/PipelineManager.py
ableQueue, Process, active_children
from time import sleep
# IMPORTS FOR TYPE HINTING
from typing import Callable, List, Optional, Type, Union
class PipelineManager:
"""
Class encapsulating multiprocessing libr... | code_fim | hard | {
"lang": "python",
"repo": "blackhole077/rentvision-internship-project",
"path": "/core/PipelineManager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MACBIO/MPAPostHocAccounting path: /resources.py
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.9.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x01\xd0\
\x89... | code_fim | hard | {
"lang": "python",
"repo": "MACBIO/MPAPostHocAccounting",
"path": "/resources.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>qt_resource_struct_v2 = b"\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x01\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x00\x00\x02\x00\x00\x00\x01\x00\x00\x00\x02\
\x00\x00\x00\x00\x00\x00\x00\x00\
\x00\x00\x00\x14\x00\x02\x00\x00\x00\x01\x00\x00\x00\x03\
\x00\x00\x00\x00\x00\x00\x00\x... | code_fim | hard | {
"lang": "python",
"repo": "MACBIO/MPAPostHocAccounting",
"path": "/resources.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> imgs_arr = []
for img_path in img_paths:
arr = load_image_with_keras(img_path, target_size, dim_ordering)
imgs_arr.append(arr)
return imgs_arr
def preprocess_image_batch(image_paths, img_size=None, crop_size=None, color_mode="rgb", out=None):
img_list = []
for im_path... | code_fim | hard | {
"lang": "python",
"repo": "previtus/MGR-Project-Code",
"path": "/Downloader/ImageHelpers.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: previtus/MGR-Project-Code path: /Downloader/ImageHelpers.py
import numpy as np
from scipy.misc import imread, imresize, imsave
from keras.preprocessing.image import *
from Downloader.Defaults import KERAS_SETTING_DIMENSIONS
# Helper functions for loading of images
def list_images(folder):
'... | code_fim | hard | {
"lang": "python",
"repo": "previtus/MGR-Project-Code",
"path": "/Downloader/ImageHelpers.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/adjectives/_delicate.py
#calss header
class _DELICATE():
def __init__(self,):
self.name = "DELICATE"
self.definitions = [u'needing careful treatment, especially because easily damaged: ', u'needing to be done carefully: ', u'a situation. matter, etc.... | code_fim | medium | {
"lang": "python",
"repo": "cash2one/xai",
"path": "/xai/brain/wordbase/adjectives/_delicate.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def sigterm_handler(_, __):
print('Received SIGTERM!')
sys.exit(ERROR_SIGTERM)
def ctrl_break_handler(_, __):
print('You pressed Ctrl+Break!')
sys.exit(USER_CTRL_BREAK)
signal.signal(signal.SIGINT, ctrl_c_handler)
signal.signal(signal.SIGTERM, sigterm_hand... | code_fim | hard | {
"lang": "python",
"repo": "ttencate/conan",
"path": "/conans/cli/cli.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ttencate/conan path: /conans/cli/cli.py
import importlib
import os
import pkgutil
import signal
import sys
from collections import defaultdict
from difflib import get_close_matches
from inspect import getmembers
from conans import __version__ as client_version
from conans.cli.command import Cona... | code_fim | hard | {
"lang": "python",
"repo": "ttencate/conan",
"path": "/conans/cli/cli.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Kostrov73/testRuf path: /instructions.py
txt_instruction = '''
Данное приложение позволит вам с помощью теста Руфье провести первичную диагностику вашего здоровья.\n
Проба Руфье представляет собой нагрузочный комплекс, предназначенный для оценки работоспособности сердца при физической нагрузке.... | code_fim | medium | {
"lang": "python",
"repo": "Kostrov73/testRuf",
"path": "/instructions.py",
"mode": "psm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>txt_test2 = '''Выполните 30 приседаний за 45 секунд.\n
Нажмите кнопку "Начать", чтобы запустить счетчик приседаний.\n
Делайте приседания со скоростью счетчика.'''
txt_test3 = '''В течение минуты замерьте пульс два раза:\n
за первые 15 секунд минуты, затем за последние 15 секунд.\n
Результаты запиши... | code_fim | medium | {
"lang": "python",
"repo": "Kostrov73/testRuf",
"path": "/instructions.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>txt_test3 = '''В течение минуты замерьте пульс два раза:\n
за первые 15 секунд минуты, затем за последние 15 секунд.\n
Результаты запишите в соответствующие поля.'''
txt_sits = 'Выполните 30 приседаний за 45 секунд.'<|fim_prefix|># repo: Kostrov73/testRuf path: /instructions.py
txt_instruction = '''... | code_fim | hard | {
"lang": "python",
"repo": "Kostrov73/testRuf",
"path": "/instructions.py",
"mode": "spm",
"license": "CC0-1.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class DNDF(Mean):
"""
References:
Peter Kontschieder, Madalina Fiterau, Antonio Criminisi, Samuel Rota Bulo. "Deep Neural Decision Forests."
https://www.cv-foundation.org/openaccess/content_iccv_2015/papers/Kontschieder_Deep_Neural_Decision_ICCV_2015_paper.pdf
"""
def __i... | code_fim | hard | {
"lang": "python",
"repo": "nhatsmrt/nn-toolbox",
"path": "/nntoolbox/components/dndf.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nhatsmrt/nn-toolbox path: /nntoolbox/components/dndf.py
"""Deep Neural Decision Forest"""
from functools import partial
import torch
from torch import nn, Tensor
from .merge import Mean
__all__ = ['DNDFTree', 'DNDF']
class DNDFTree(nn.Module):
"""
Based on Deep Neural Decision Forest,... | code_fim | hard | {
"lang": "python",
"repo": "nhatsmrt/nn-toolbox",
"path": "/nntoolbox/components/dndf.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self._split_name[1:3] == ['ansible', 'builtin']:
# we don't want to allow this one to have on-disk search capability
self._subpackage_search_paths = []
elif not self._subpackage_search_paths:
raise ImportError('no {0} found in {1}'.format(self._packag... | code_fim | hard | {
"lang": "python",
"repo": "SimonFangCisco/dne-dna-code",
"path": "/intro-ansible/venv3/lib/python3.8/site-packages/ansible/utils/collection_loader/_collection_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SimonFangCisco/dne-dna-code path: /intro-ansible/venv3/lib/python3.8/site-packages/ansible/utils/collection_loader/_collection_finder.py
if len(_file_finder_hook) != 1:
raise Exception('need exactly one FileFinder import hook (found {0})'.format(len(_file_finder_hook)))
... | code_fim | hard | {
"lang": "python",
"repo": "SimonFangCisco/dne-dna-code",
"path": "/intro-ansible/venv3/lib/python3.8/site-packages/ansible/utils/collection_loader/_collection_finder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aruba/pyaoscx path: /pyaoscx/bgp_neighbor.py
# (C) Copyright 2019-2023 Hewlett Packard Enterprise Development LP.
# Apache License 2.0
import json
import logging
import re
from pyaoscx.exceptions.generic_op_error import GenericOperationError
from pyaoscx.exceptions.response_error import Respons... | code_fim | hard | {
"lang": "python",
"repo": "aruba/pyaoscx",
"path": "/pyaoscx/bgp_neighbor.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @classmethod
def from_response(cls, session, parent_bgp_router, response_data):
"""
Create a BgpNeighbor object given a response_data related to the
BGP Router ID object
:param cls: Object's class
:param session: pyaoscx.Session object used to represent a ... | code_fim | hard | {
"lang": "python",
"repo": "aruba/pyaoscx",
"path": "/pyaoscx/bgp_neighbor.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return periodicity(y=self.y, fs=self.fs, dof=dof, R=R, P=P, n=n,
fig=fig, ax=ax, **kwargs)
def downsample(y, u, n, nsper=None, keep=False):
"""Filter and downsample signals
The displacement is decimated(low-pass filtered and downsampled) where
forcing is o... | code_fim | hard | {
"lang": "python",
"repo": "pawsen/pyvib",
"path": "/pyvib/signal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pawsen/pyvib path: /pyvib/signal.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import matplotlib.pylab as plt
import numpy as np
from numpy.fft import fft
from scipy.signal import decimate
from .common import db, prime_factor
from .filter import differentiate, integrate
from .frf import bla... | code_fim | hard | {
"lang": "python",
"repo": "pawsen/pyvib",
"path": "/pyvib/signal.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
# cast to 2d. Format is now y[ndofs,ns]. For 1d cases ndof=0
self.y = _set_signal(y)
self.yd = _set_signal(yd)
self.ydd = _set_signal(ydd)
self.isset_y = False
self.isset_yd = False
self.isset_ydd = False
# ns: total sample point... | code_fim | hard | {
"lang": "python",
"repo": "pawsen/pyvib",
"path": "/pyvib/signal.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> groupStart = 0
groupCount = 1
prev = 0
pos = 0
totalTime = 0
totalGroups = 0
for count, i in enumerate(trackingTimes):
if groupStart == 0:
groupStart = i
else:
if i - prev > 0.5:
#above threshold
diff ... | code_fim | hard | {
"lang": "python",
"repo": "joaoventuraoliveira/VisualAcuityTests",
"path": "/VAT/VAT/MouseDetect2.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joaoventuraoliveira/VisualAcuityTests path: /VAT/VAT/MouseDetect2.py
import cv2 as cv
import numpy as np
from sklearn.cluster import MiniBatchKMeans
import math
from scipy.cluster.vq import kmeans,vq
import LogUtil
import zipapp
from datetime import datetime
from PyQt5 import QtCore, QtGui, QtWid... | code_fim | hard | {
"lang": "python",
"repo": "joaoventuraoliveira/VisualAcuityTests",
"path": "/VAT/VAT/MouseDetect2.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kidist-amde/image-search-engine path: /Perceptual Hash -Asher/methods/kmeans.py
import sys
sys.path.append('..')
from base import BaseSolution
from tqdm import tqdm
import cv2
from sklearn.cluster import KMeans, DBSCAN, MiniBatchKMeans
from scipy import spatial
from sklearn.preprocessing import S... | code_fim | hard | {
"lang": "python",
"repo": "kidist-amde/image-search-engine",
"path": "/Perceptual Hash -Asher/methods/kmeans.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # we return the normalized features
return self.scale.transform(features)
class KmeansSolution(BaseSolution):
def parse_args(self):
parser = argparse.ArgumentParser(description='Challenge presentation example')
parser.add_argument('--data_path',
... | code_fim | hard | {
"lang": "python",
"repo": "kidist-amde/image-search-engine",
"path": "/Perceptual Hash -Asher/methods/kmeans.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> parser = argparse.ArgumentParser(description='Challenge presentation example')
parser.add_argument('--data_path',
'-d',
type=str,
default='dataset',
help='Dataset path')
... | code_fim | hard | {
"lang": "python",
"repo": "kidist-amde/image-search-engine",
"path": "/Perceptual Hash -Asher/methods/kmeans.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> adam = keras.optimizers.Adam(lr=0.001, beta_1=0.9, beta_2=0.999, epsilon=None, decay=0.0)
model.compile(optimizer=adam, loss='binary_crossentropy', metrics=['acc'])
# # prepare callback
# histories = my_callbacks.Histories()
model.summary()
return model<|f... | code_fim | hard | {
"lang": "python",
"repo": "alexandrusoloms/Bela-Server-Side",
"path": "/src/load_keras_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alexandrusoloms/Bela-Server-Side path: /src/load_keras_model.py
import os
import keras
from keras.layers import Conv2D, Dropout, MaxPooling2D, BatchNormalization
from keras.layers import Dense, Flatten
from keras.layers.advanced_activations import LeakyReLU
from keras.models import load_model, S... | code_fim | hard | {
"lang": "python",
"repo": "alexandrusoloms/Bela-Server-Side",
"path": "/src/load_keras_model.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> model.add(Conv2D(16, (3, 1), padding='valid')) # drfault 0.01. Try 0.001 and 0.001
model.add(BatchNormalization())
model.add(LeakyReLU(alpha=.001))
model.add(MaxPooling2D(pool_size=(3, 1)))
# dense layers
model.add(Flatten())
model.add(Dropout(0.5)... | code_fim | hard | {
"lang": "python",
"repo": "alexandrusoloms/Bela-Server-Side",
"path": "/src/load_keras_model.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: evhart/energyuse path: /energyuse/eserver/views.py
Tag, Subscription, Vote
from biostar.apps.badges.models import Award
from django.contrib import messages
from biostar import const
from django.core.paginator import Paginator
from django.http import HttpResponse
from django.http import Http404
f... | code_fim | hard | {
"lang": "python",
"repo": "evhart/energyuse",
"path": "/energyuse/eserver/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Add the more like this field
post = super(PostDetails, self).get_object()
return obj
def get_context_data(self, **kwargs):
context = super(PostDetails, self).get_context_data(**kwargs)
context['request'] = self.request
# Create JSON-LD
#
... | code_fim | hard | {
"lang": "python",
"repo": "evhart/energyuse",
"path": "/energyuse/eserver/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>######
#FIXME directly copied and modiffed from source
######
class PostDetails(DetailView):
"""
Shows a thread, top level post and all related content.
"""
model = Post
context_object_name = "post"
template_name = "post_details.html"
def get(self, *args, **kwargs):
... | code_fim | hard | {
"lang": "python",
"repo": "evhart/energyuse",
"path": "/energyuse/eserver/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
text = smart_text(email_message)
subject = ''
to = ''
fromm = smart_text(sender) if sender else SYSTEM_NAME
all_ccs = ''
email_data = {
'subject': subject,
'text': text,
'to': to,
'fromm': fromm,
'cc': all_ccs
... | code_fim | hard | {
"lang": "python",
"repo": "Djandwich/disturbance",
"path": "/disturbance/components/main/email.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Djandwich/disturbance path: /disturbance/components/main/email.py
from django.utils.encoding import smart_text
from django.core.mail import EmailMultiAlternatives, EmailMessage
from disturbance.settings import SYSTEM_NAME
<|fim_suffix|> else:
text = smart_text(email_message)
s... | code_fim | hard | {
"lang": "python",
"repo": "Djandwich/disturbance",
"path": "/disturbance/components/main/email.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(sender)
if isinstance(email_message, (EmailMultiAlternatives, EmailMessage,)):
# TODO this will log the plain text body, should we log the html
# instead
text = email_message.body
subject = email_message.subject
fromm = smart_text(sender) if sender els... | code_fim | medium | {
"lang": "python",
"repo": "Djandwich/disturbance",
"path": "/disturbance/components/main/email.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eisen-ai/covid19-challenge path: /covid_challenge/datasets/cloud_datasets.py
import boto3
import os
import tempfile
from eisen.datasets import MSDDataset, JsonDataset
from eisen.utils import read_json_from_file
from covid_challenge import get_file_from_s3
class S3MSDDataset(MSDDataset):
de... | code_fim | hard | {
"lang": "python",
"repo": "eisen-ai/covid19-challenge",
"path": "/covid_challenge/datasets/cloud_datasets.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, data_dir, json_file, aws_id=None, aws_secret=None, transform=None):
self.s3_client = boto3.client(
's3',
aws_access_key_id=aws_id,
aws_secret_access_key=aws_secret
)
self.tempdir = tempfile.mkdtemp()
json_file = g... | code_fim | hard | {
"lang": "python",
"repo": "eisen-ai/covid19-challenge",
"path": "/covid_challenge/datasets/cloud_datasets.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PRBonn/semantic-kitti-api path: /auxiliary/SSCDataset.py
import os
import numpy as np
def unpack(compressed):
''' given a bit encoded voxel grid, make a normal voxel grid out of it. '''
uncompressed = np.zeros(compressed.shape[0] * 8, dtype=np.uint8)
uncompressed[::8] = compressed[:] >> ... | code_fim | hard | {
"lang": "python",
"repo": "PRBonn/semantic-kitti-api",
"path": "/auxiliary/SSCDataset.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
# Small example of the usage.
# Replace "/path/to/semantic/kitti/" with actual path to the folder containing the "sequences" folder
dataset = SSCDataset("/path/to/semantic/kitti/")
print("# files: {}".format(len(dataset)))
(seq, filename), data = dataset[100]
pri... | code_fim | hard | {
"lang": "python",
"repo": "PRBonn/semantic-kitti-api",
"path": "/auxiliary/SSCDataset.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fostroll/morra path: /examples/ne_train_pipeline.py
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Morra project
#
# Copyright (C) 2019-present by Sergei Ternovykh
# License: BSD, see LICENSE for details
"""
Example: A pipeline to train the Morra NER model.
"""
from morra import MorphParserNE
###
i... | code_fim | hard | {
"lang": "python",
"repo": "fostroll/morra",
"path": "/examples/ne_train_pipeline.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_model (load_corpuses=True, load_model=True):
mp = MorphParserNE(guess_ne=guess_ne)
if load_corpuses:
mp.load_test_corpus(dev_corpus)
mp.load_train_corpus(train_corpus)
if load_model:
mp.load(MODEL_FN)
return mp
def reload_train_corpus ():
mp._train_corp... | code_fim | hard | {
"lang": "python",
"repo": "fostroll/morra",
"path": "/examples/ne_train_pipeline.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> if news_json:
news_qtd = 0
for news in news_json['itens']:
try:
SmartnewsListWidget = QWidget()
ui = Ui_SmartNewsWidget()
ui.setupUi(SmartnewsListWidget)
ui.update_proposal_detai... | code_fim | hard | {
"lang": "python",
"repo": "SmartCash/electrum-smart",
"path": "/gui/qt/smartnews_tab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> news_json = self.get_json('electrum-news.smartcash.cc', '/smartnews.json')
print_msg('Loading news: {}'.format(json.dumps(news_json)))
if news_json:
news_qtd = 0
for news in news_json['itens']:
try:
SmartnewsListWidget = ... | code_fim | hard | {
"lang": "python",
"repo": "SmartCash/electrum-smart",
"path": "/gui/qt/smartnews_tab.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmartCash/electrum-smart path: /gui/qt/smartnews_tab.py
import os
import traceback
import json
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from .smartnews_list import Ui_SmartNewsWidget
import requests
from electrum_smart.util import print_msg
class SmartnewsTab(QWidget):
def... | code_fim | hard | {
"lang": "python",
"repo": "SmartCash/electrum-smart",
"path": "/gui/qt/smartnews_tab.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return DataFrame(data=prval, columns=var_comp)
def sample(self, n=1, seed=None):
"""Draw samples from joint density
Draw samples according to joint density using marginal and copula
information.
Args:
n (int): Number of samples to draw
... | code_fim | hard | {
"lang": "python",
"repo": "zdelrosario/py_grama",
"path": "/grama/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def name_corr(self):
"""Name the correlation elements
"""
raise NotImplementedError
## Build matrix of names
corr_mat = []
for ind in range(self.n_in):
corr_mat.append(
list(map(lambda s: s + "," + self.domain.var[ind], self.d... | code_fim | hard | {
"lang": "python",
"repo": "zdelrosario/py_grama",
"path": "/grama/core.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zdelrosario/py_grama path: /grama/core.py
, n=1, seed=None):
"""Draw samples from copula
Args:
n (int): Number of samples
seed (int): Random seed
Returns:
DataFrame: Independent samples
"""
## Set seed only if given
... | code_fim | hard | {
"lang": "python",
"repo": "zdelrosario/py_grama",
"path": "/grama/core.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Check that nuclei_bbox_annot_list is nearly equal to
# nuclei_bbox_annot_list_gtruth
assert len(nuclei_bbox_annot_list) == len(nuclei_bbox_annot_list_gtruth)
for pos in range(len(nuclei_bbox_annot_list)):
np.testing.assert_array_almost_equal(
n... | code_fim | hard | {
"lang": "python",
"repo": "DigitalSlideArchive/HistomicsTK",
"path": "/tests/test_cli_common.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_suffix|> nuclei_bndry_annot_list.extend(cur_bndry_annot_list)
if GENERATE_GROUNDTRUTH:
open('/tmp/TCGA-06-0129-01Z-00-DX3_roi_nuclei_bbox.anot', 'w').write(
json.dumps({'elements': nuclei_bbox_annot_list}))
open('/tmp/TCGA-06-0129-01Z-00-DX3_roi_nuclei_b... | code_fim | hard | {
"lang": "python",
"repo": "DigitalSlideArchive/HistomicsTK",
"path": "/tests/test_cli_common.py",
"mode": "spm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DigitalSlideArchive/HistomicsTK path: /tests/test_cli_common.py
import collections
import json
import os
from argparse import Namespace
import large_image
import numpy as np
import skimage.io
import histomicstk.preprocessing.color_deconvolution as htk_cdeconv
import histomicstk.preprocessing.co... | code_fim | hard | {
"lang": "python",
"repo": "DigitalSlideArchive/HistomicsTK",
"path": "/tests/test_cli_common.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xcamilox/frastro path: /external/sncosmos_fit.py
import sncosmo
import pandas as pd
import requests
from astropy.table import Table
import numpy as np
import json
import math
from pandas.io.json import json_normalize
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfP... | code_fim | hard | {
"lang": "python",
"repo": "xcamilox/frastro",
"path": "/external/sncosmos_fit.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
table_json = json_normalize(data_info)
data = Table.from_pandas(table_json)
# define fields for sncosmo imput table:
time = [] # np.array([])
band = [] # np.str([])
mag = [] # np.array([])
mag_err = [] # np.array([])
zp = [] # np.arra... | code_fim | hard | {
"lang": "python",
"repo": "xcamilox/frastro",
"path": "/external/sncosmos_fit.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> batch_size = rnn_outputs.size(0)
sent_len = rnn_outputs.size(1)
maskTemp = torch.arange(1, sent_len + 1, dtype=torch.long).view(
1, sent_len).expand(batch_size, sent_len).to(self.device)
mask = torch.le(maskTemp, lengths.view(batch_size, 1).expand(
b... | code_fim | hard | {
"lang": "python",
"repo": "mcollardanuy/eval-historical-texts",
"path": "/models/ner_rnn/ner_predictor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mcollardanuy/eval-historical-texts path: /models/ner_rnn/ner_predictor.py
ntities.metric import Metric
from entities.data_output_log import DataOutputLog
from entities.batch_representation import BatchRepresentation
from entities.options.rnn_encoder_options import RNNEncoderOptions
from entities.... | code_fim | hard | {
"lang": "python",
"repo": "mcollardanuy/eval-historical-texts",
"path": "/models/ner_rnn/ner_predictor.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @overrides
def compare_metric(self, best_metric: Metric, new_metric: Metric) -> bool:
if best_metric.is_new:
return True
keys = [
self._create_measure_key(
TagMetric.F1ScoreMicro,
TagMeasureType.Partial,
entit... | code_fim | hard | {
"lang": "python",
"repo": "mcollardanuy/eval-historical-texts",
"path": "/models/ner_rnn/ner_predictor.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> for pass_id in range(PASS_NUM):
for batch_id, data in enumerate(train_reader()):
train_image = np.array(
map(lambda x: x[0].reshape(data_shape), data)).astype("float32")
train_label = np.array(map(lambda x: x[1], data)).astype("int64")
train_... | code_fim | hard | {
"lang": "python",
"repo": "wanghaoshuang/Paddle",
"path": "/paddle/contrib/float16/float16_inference_demo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> prediction = np.argmax(results[0], axis=1).reshape([-1, 1])
correct_num += np.sum(prediction == test_label)
test_num += test_label.size
print("{0} out of {1} predictions are correct.".format(correct_num,
test_num))
... | code_fim | hard | {
"lang": "python",
"repo": "wanghaoshuang/Paddle",
"path": "/paddle/contrib/float16/float16_inference_demo.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wanghaoshuang/Paddle path: /paddle/contrib/float16/float16_inference_demo.py
# Copyright (c) 2018 PaddlePaddle Authors. All Rights Reserved.
#
# 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 ... | code_fim | hard | {
"lang": "python",
"repo": "wanghaoshuang/Paddle",
"path": "/paddle/contrib/float16/float16_inference_demo.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wgatharia/csci131 path: /6-functions/exercise_6.3.py
"""
File: exercise_6.3.py
Author: William Gatharia
This code demonstrates function as first class data object in a function.
i.e. passing a function as an argument in a function
"""
<|fim_suffix|> return function_arg(data_ar... | code_fim | easy | {
"lang": "python",
"repo": "wgatharia/csci131",
"path": "/6-functions/exercise_6.3.py",
"mode": "psm",
"license": "LicenseRef-scancode-warranty-disclaimer",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.