text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> # format clean up
tl = np.asmatrix(tl)
tl = tl.argmax(axis=1).astype('uint8')
pdxt = np.asmatrix(pdx)
prl = pdxt.argmax(axis=1).astype('uint8')
prl = pd.DataFrame(prl, columns=['Prediction'])
lbdict = {0: 'negative', 1: pmd}
outt = pd.DataFrame(pdxt, columns=['NEG_score', '... | code_fim | hard | {
"lang": "python",
"repo": "rhong3/Neutrophil",
"path": "/scripts/Legacy/Accessory.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_asynction_exceptiions_attr():
assert hasattr(asynction, "AsynctionException")
assert hasattr(asynction, "ValidationException")
assert hasattr(asynction, "PayloadValidationException")
assert hasattr(asynction, "BindingsValidationException")
assert hasattr(asynction, "MessageAc... | code_fim | medium | {
"lang": "python",
"repo": "pedrohbtp/asynction",
"path": "/tests/unit/test_asynction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pedrohbtp/asynction path: /tests/unit/test_asynction.py
"""Tests that assert backwards compatibility of the package's API"""
<|fim_suffix|>def test_asynction_exceptiions_attr():
assert hasattr(asynction, "AsynctionException")
assert hasattr(asynction, "ValidationException")
assert ha... | code_fim | medium | {
"lang": "python",
"repo": "pedrohbtp/asynction",
"path": "/tests/unit/test_asynction.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert hasattr(asynction, "AsynctionException")
assert hasattr(asynction, "ValidationException")
assert hasattr(asynction, "PayloadValidationException")
assert hasattr(asynction, "BindingsValidationException")
assert hasattr(asynction, "MessageAckValidationException")<|fim_prefix|># re... | code_fim | medium | {
"lang": "python",
"repo": "pedrohbtp/asynction",
"path": "/tests/unit/test_asynction.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yaniv14/OpenCommunity path: /src/acl/tests.py
from acl.default_roles import DefaultRoles
from acl.models import Role
from django.test import TestCase
<|fim_suffix|> r = Role()
r.title = "Dictator"
r.based_on = DefaultRoles.DECIDER
r.full_clean()
r.save()
... | code_fim | hard | {
"lang": "python",
"repo": "yaniv14/OpenCommunity",
"path": "/src/acl/tests.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> r.perms.create(code='editclosed_issue')
self.assertEquals(set(r.all_perms()),
set(DefaultRoles.permissions[
DefaultRoles.DECIDER] + [
'editclosed_issue']))<|fim_prefix|># repo: yaniv14/OpenCommuni... | code_fim | hard | {
"lang": "python",
"repo": "yaniv14/OpenCommunity",
"path": "/src/acl/tests.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shintakezou/ReplyChallenges path: /2018/CyberSecurity/coding-1/unscramble.py
#! /usr/bin/python3
import hashlib
sha = hashlib.sha256()
dname = 'dictionary.txt'
sname = 'scrambled-words.txt'
dlen = {}
def wsorted(ws):
<|fim_suffix|>sha.update(b''.join(wlist))
# i.e., "{FLG:%s}" % (sha.hexdige... | code_fim | hard | {
"lang": "python",
"repo": "shintakezou/ReplyChallenges",
"path": "/2018/CyberSecurity/coding-1/unscramble.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>wlist = []
with open(sname, 'r') as f:
for ws in f:
w = ws.rstrip()
wlist.append(dlen[k(w)].encode('utf-8'))
f.close()
sha.update(b''.join(wlist))
# i.e., "{FLG:%s}" % (sha.hexdigest())
print(sha.hexdigest())<|fim_prefix|># repo: shintakezou/ReplyChallenges path: /2018/CyberSec... | code_fim | hard | {
"lang": "python",
"repo": "shintakezou/ReplyChallenges",
"path": "/2018/CyberSecurity/coding-1/unscramble.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ygCoconut/volume2stl path: /1_benchmarking/longest_axis.py
import os,sys
# add ibexHelper path , NEEDS TO BE ABSOLUTE !!!
# sys.path.append('/home/donglai/lib/ibex_fork/ibexHelper')
sys.path.append('/n/home00/nwendt/scriptsAndSoftware/repos/ibexHelper')
from ibexHelper.skel import CreateSkeleton... | code_fim | hard | {
"lang": "python",
"repo": "ygCoconut/volume2stl",
"path": "/1_benchmarking/longest_axis.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> ### Content for benchmark START
main_G, length = search_longest_path_efficient(G, weight=weight)
# identify outliers with less than 10 nodes
if len(main_G)<=10: #hardcoded, 10 nodes needs to be bigger than max_depth
endnodes = [x for x in main_G.nodes()... | code_fim | hard | {
"lang": "python",
"repo": "ygCoconut/volume2stl",
"path": "/1_benchmarking/longest_axis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # identify outliers with less than 10 nodes
if len(main_G)<=10: #hardcoded, 10 nodes needs to be bigger than max_depth
endnodes = [x for x in main_G.nodes() if main_G.degree(x)==1]
length, thickness = edge_length_and_thickness(main_G, endnodes[0], endnodes[1])
... | code_fim | hard | {
"lang": "python",
"repo": "ygCoconut/volume2stl",
"path": "/1_benchmarking/longest_axis.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> wrapanapi.containers.providers.rhopenshift import Openshift # NOQA
from .hawkular import Hawkular # NOQA
from .lenovo import LenovoSystem # NOQA
from .nuage import NuageSystem # NOQA<|fim_prefix|># repo: ohiliazo/wrapanapi path: /wrapanapi/__init__.py
# Imports for backward compatility and convenienc... | code_fim | hard | {
"lang": "python",
"repo": "ohiliazo/wrapanapi",
"path": "/wrapanapi/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ohiliazo/wrapanapi path: /wrapanapi/__init__.py
# Imports for backward compatility and convenience
# NOQA all the things because
from __future__ import absolute_import
from .base import * # NOQA
from .exceptions import * # NOQA
fro<|fim_suffix|>tem # NOQA
from .virtualcenter import VMWareSyste... | code_fim | medium | {
"lang": "python",
"repo": "ohiliazo/wrapanapi",
"path": "/wrapanapi/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (pyM.cap_conv[loc, compName] == compDict[compName]._capacityFix[loc]
if compDict[compName]._capacityFix is not None else pyomo.Constraint.Skip)
pyM.ConstrCapacityFix_conv = pyomo.Constraint(pyM.designDimensionVarSet_conv, rule=capacityFix_conv)
# Set... | code_fim | hard | {
"lang": "python",
"repo": "dcaglayan/FINE",
"path": "/FINE/conversionModeling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """ Declares design and operation variables """
# Function for setting lower and upper capacity bounds
def capBounds(pyM, loc, compName):
comp = self._componentsDict[compName]
return (comp._capacityMin[loc] if (comp._capacityMin is not None and not comp._has... | code_fim | hard | {
"lang": "python",
"repo": "dcaglayan/FINE",
"path": "/FINE/conversionModeling.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dcaglayan/FINE path: /FINE/conversionModeling.py
self._name + ' already exists. Data will be overwritten.')
else:
raise ValueError('Component name ' + self._name + ' is not unique.')
else:
esM._componentNames.update({self._name: ConversionModeling._... | code_fim | hard | {
"lang": "python",
"repo": "dcaglayan/FINE",
"path": "/FINE/conversionModeling.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def go_to_cart():
if os.name == 'net':
print(1)
elif os.name == 'linux':
print(2)
else:
print('macOS')
def checkout():
if os.name == 'net':
print(1)
elif os.name == 'linux':
print(2)
else:
print('macOS')<|fim_prefix|># repo: qavi... | code_fim | hard | {
"lang": "python",
"repo": "qaviton/test_step_parser",
"path": "/py/tests/test_steps.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: qaviton/test_step_parser path: /py/tests/test_steps.py
import os
def login(username, password='123456'):
if os.name == 'net':
print(1)
elif os.name == 'linux':
print(2)
else:
print('macOS')
return os.name
def logout():
if os.name == 'net':
... | code_fim | medium | {
"lang": "python",
"repo": "qaviton/test_step_parser",
"path": "/py/tests/test_steps.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Force the chatbot to update it's timestamp
self.chatbot.log = False
# Submit input which should cause a new log to be created
input_text = "What is the airspeed velocity of an unladen swallow?"
response = self.chatbot.get_response(input_text)
file_size_a... | code_fim | hard | {
"lang": "python",
"repo": "aibotnet/ChatterBot",
"path": "/tests/test_response.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aibotnet/ChatterBot path: /tests/test_response.py
from .base_case import ChatBotTestCase
class ChatBotTests(ChatBotTestCase):
def test_logging_timestamps(self):
"""
Tests that the chat bot returns the correct datetime for logging
"""
import datetime
... | code_fim | hard | {
"lang": "python",
"repo": "aibotnet/ChatterBot",
"path": "/tests/test_response.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .extract import extract
from .copy import copy
from .add import add
from .merge import merge
from .append_structures import append_structures
from .get import *
from .set import *
from .iterators import StructuresIterator, TopologyIterator
from .to_molsysmt_MolSys import to_molsysmt_MolSys
from .to_... | code_fim | medium | {
"lang": "python",
"repo": "uibcdf/MolSysMT",
"path": "/molsysmt/form/pytraj_Trajectory/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: uibcdf/MolSysMT path: /molsysmt/form/pytraj_Trajectory/__init__.py
form_name = 'pytraj.Trajectory'
form_type = 'class'
form_info = ["", ""]
from .is_form import is_form
<|fim_suffix|>from .extract import extract
from .copy import copy
from .add import add
from .merge import merge
from .append_s... | code_fim | medium | {
"lang": "python",
"repo": "uibcdf/MolSysMT",
"path": "/molsysmt/form/pytraj_Trajectory/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from .to_molsysmt_MolSys import to_molsysmt_MolSys
from .to_molsysmt_Topology import to_molsysmt_Topology
from .to_molsysmt_Structures import to_molsysmt_Structures
from .to_pytraj_Topology import to_pytraj_Topology
from .to_nglview_NGLWidget import to_nglview_NGLWidget
_convert_to={
'pytraj.Traj... | code_fim | hard | {
"lang": "python",
"repo": "uibcdf/MolSysMT",
"path": "/molsysmt/form/pytraj_Trajectory/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: croplands-dev/croplands path: /croplands_api/utils/google/fusion.py
from googleapiclient.http import MediaIoBaseUpload, HttpError
from croplands_api.utils.google import build_service
<|fim_suffix|> media_body = MediaIoBaseUpload(fd, mimetype='application/octet-stream')
service = build_se... | code_fim | hard | {
"lang": "python",
"repo": "croplands-dev/croplands",
"path": "/croplands_api/utils/google/fusion.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> media_body = MediaIoBaseUpload(fd, mimetype='application/octet-stream')
service = build_service("fusiontables", "v2")
table = service.table()
command = table.replaceRows(tableId=table_id,
media_body=media_body,
startLine=star... | code_fim | hard | {
"lang": "python",
"repo": "croplands-dev/croplands",
"path": "/croplands_api/utils/google/fusion.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> service = build_service("fusiontables", "v2")
table = service.table()
command = table.replaceRows(tableId=table_id,
media_body=media_body,
startLine=startLine)
try:
command.execute()
except HttpError as e:
... | code_fim | hard | {
"lang": "python",
"repo": "croplands-dev/croplands",
"path": "/croplands_api/utils/google/fusion.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: twistedpair/google-cloud-sdk path: /google-cloud-sdk/lib/googlecloudsdk/third_party/apis/edgenetwork/v1alpha1/resources.py
# -*- coding: utf-8 -*- #
# Copyright 2015 Google LLC. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file ex... | code_fim | hard | {
"lang": "python",
"repo": "twistedpair/google-cloud-sdk",
"path": "/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/edgenetwork/v1alpha1/resources.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Collections(enum.Enum):
"""Collections for all supported apis."""
PROJECTS = (
'projects',
'projects/{projectsId}',
{},
['projectsId'],
True
)
PROJECTS_LOCATIONS = (
'projects.locations',
'{+name}',
{
'':
'projects/{pro... | code_fim | hard | {
"lang": "python",
"repo": "twistedpair/google-cloud-sdk",
"path": "/google-cloud-sdk/lib/googlecloudsdk/third_party/apis/edgenetwork/v1alpha1/resources.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return np.float32((input1+input2+input3).numpy())<|fim_prefix|># repo: bzcheeseman/pytorch-inference path: /scripts/test_sum.py
import torch
import numpy as np
<|fim_middle|>def test_sum(filename1, filename2, filename3):
input1 = torch.load(filename1)
input2 = torch.load(filename2)
inpu... | code_fim | medium | {
"lang": "python",
"repo": "bzcheeseman/pytorch-inference",
"path": "/scripts/test_sum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> input1 = torch.load(filename1)
input2 = torch.load(filename2)
input3 = torch.load(filename3)
return np.float32((input1+input2+input3).numpy())<|fim_prefix|># repo: bzcheeseman/pytorch-inference path: /scripts/test_sum.py
import torch
import numpy as np
<|fim_middle|>def test_sum(filena... | code_fim | easy | {
"lang": "python",
"repo": "bzcheeseman/pytorch-inference",
"path": "/scripts/test_sum.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bzcheeseman/pytorch-inference path: /scripts/test_sum.py
import torch
import numpy as np
<|fim_suffix|> input1 = torch.load(filename1)
input2 = torch.load(filename2)
input3 = torch.load(filename3)
return np.float32((input1+input2+input3).numpy())<|fim_middle|>def test_sum(filena... | code_fim | easy | {
"lang": "python",
"repo": "bzcheeseman/pytorch-inference",
"path": "/scripts/test_sum.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: latticetower/dr-derks-mutants path: /agent/simple_bot.py
import numpy as np
from models.network_v1 import Network
NPZ_FILENAME = "weights/model_v1.npz"
class DerkPlayer:
"""
Player which controls all agents
Each arena has 3 agents which the player must control.
"""
def __... | code_fim | hard | {
"lang": "python",
"repo": "latticetower/dr-derks-mutants",
"path": "/agent/simple_bot.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def signal_env_reset(self, obs):
"""
env.reset() was called
"""
def take_action(self, env_step_ret):
"""
Parameters:
- env_step_ret: whatever env.step() returned (obs_n, rew_n, done_n, info_n)
Returns: action for each agent for each arena
... | code_fim | hard | {
"lang": "python",
"repo": "latticetower/dr-derks-mutants",
"path": "/agent/simple_bot.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_conversion_random_angles(self) -> None:
seed(7777)
for test_id in range(20):
a = _rand_ang()
b = _rand_ang()
c = _rand_ang()
x = _rand_ang()
y = _rand_ang()
z = _rand_ang()
self._test_conversio... | code_fim | hard | {
"lang": "python",
"repo": "beittech/Quasar",
"path": "/builtin_arithmetics_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_inverse_y(self) -> None:
self.assertEqual(
invert_gate(Y_GATE, []),
(Y_GATE, []))
def test_inverse_z(self) -> None:
self.assertEqual(
invert_gate(Z_GATE, []),
(Z_GATE, []))
def test_inverse_h(self) -> None:
self... | code_fim | hard | {
"lang": "python",
"repo": "beittech/Quasar",
"path": "/builtin_arithmetics_test.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: beittech/Quasar path: /builtin_arithmetics_test.py
import unittest
from cmath import exp, cos, sin, pi
from itertools import product
import numpy as np
from numpy.testing import assert_allclose
from random import random, seed
from builtin_arithmetics import invert_gate, reduce_consecutive_u3
fr... | code_fim | hard | {
"lang": "python",
"repo": "beittech/Quasar",
"path": "/builtin_arithmetics_test.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def GetDerivedStats(self):
# Derived Stats Dictionary
DerivedStats = {}
# Return Derived Stats Dictionary
return DerivedStats
# Combat Methods
def Damage(self, DamageAmount):
TotalDamageAmount = DamageAmount
CurrentTempHealth = self.Stats["Temp... | code_fim | hard | {
"lang": "python",
"repo": "Snackhole/PyFifth",
"path": "/Core/Character.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Snackhole/PyFifth path: /Core/Character.py
import math
import os
from Core.Base64Converters import GetBase64StringFromFilePath, GetBinaryFromBase64String, WriteFileFromBase64String
class Character:
def __init__(self):
self.CreateStaticValues()
self.CreateStats()
def Cr... | code_fim | hard | {
"lang": "python",
"repo": "Snackhole/PyFifth",
"path": "/Core/Character.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abraker95/ultimate_osu_analyzer path: /unit_tests/test_std_score_data_release.py
import unittest
import pandas as pd
from analysis.osu.std.score_data import StdScoreData
from analysis.osu.std.map_data import StdMapData
class TestStdScoreDataRelease(unittest.TestCase):
@classmethod
def... | code_fim | hard | {
"lang": "python",
"repo": "abraker95/ultimate_osu_analyzer",
"path": "/unit_tests/test_std_score_data_release.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif -StdScoreData.neg_rel_miss_range < offset <= -StdScoreData.neg_rel_range:
self.assertEqual(adv, StdScoreData._StdScoreData__ADV_NOTE, f'Offset: {offset} ms')
self.assertEqual(score_data[0][6], StdScoreData.TYPE_MISS, f'Offset: {offset} ms')
eli... | code_fim | hard | {
"lang": "python",
"repo": "abraker95/ultimate_osu_analyzer",
"path": "/unit_tests/test_std_score_data_release.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MengYunSong/poseidon_master path: /poseidon/ui/mobile/common/Init.py
# coding=utf-8
"""
@author:songmengyun
@file: Init.py
@time: 2020/01/08
"""
import json
import logging
import subprocess
import sys
import os
import redis
import requests
import time
class Init(object):
def _execute(se... | code_fim | hard | {
"lang": "python",
"repo": "MengYunSong/poseidon_master",
"path": "/poseidon/ui/mobile/common/Init.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> init.download(url="http://192.168.160.188:8080/download2/uiautomator2-server.apk",
target_file_path=os.path.abspath(path_apk + "/" + "uiautomator2-server.apk"))
print("'uiautomator2-server.apk'下载执行完成")
init.download(url="http://192.168.160.188:8080/download2/... | code_fim | hard | {
"lang": "python",
"repo": "MengYunSong/poseidon_master",
"path": "/poseidon/ui/mobile/common/Init.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Edwin10151/geoai-immap path: /utils/gee_settings.py
98,7.054700505000028],
'cucuta': [-72.60807671699996,7.723856582000053,-72.34649040099998,8.431575791000057],
'tibu': [-73.07343705199997,8.251246337000055,-72.47112479799995,9.142041082000048],
'soacha': [-74.30657295399999,4.382... | code_fim | hard | {
"lang": "python",
"repo": "Edwin10151/geoai-immap",
"path": "/utils/gee_settings.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# cloud filter and if mask is applied
CLOUD_PARAMS = {
'riohacha': {'2015-2016': (30, True),'2017-2018': (40, True),'2019-2020': (40, True),},
'maicao': {'2015-2016': (20, True), '2017-2018': (40, True), '2019-2020': (40, True), },
'uribia': {'2015-2016': (10, True),'2017-2018': (40, True),'... | code_fim | hard | {
"lang": "python",
"repo": "Edwin10151/geoai-immap",
"path": "/utils/gee_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> 'facatativa': {'2015-2016': (10, False), '2017-2018': (40, True), '2019-2020': (40, True)},
'bosconia': {'2015-2016': (40, True), '2017-2018': (40, True), '2019-2020': (40, True)},
'puertogaitan': {'2015-2016': (40, True), '2017-2018': (40, True), '2019-2020': (40, True)},
'tubara': {'2015... | code_fim | hard | {
"lang": "python",
"repo": "Edwin10151/geoai-immap",
"path": "/utils/gee_settings.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> cli_cmd: t.List[str],
cli_args: t.List[str],
inputs: t.List[t.Any],
env: t.Dict[str, str],
message: str,
server: "Server",
session: Session,
tmp_path: pathlib.Path,
monkeypatch: pytest.MonkeyPatch,
capsys: pytest.CaptureFixture,
) -> None:
monkeypatch.setenv("HO... | code_fim | hard | {
"lang": "python",
"repo": "tmux-python/tmuxp",
"path": "/tests/cli/test_shell.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tmux-python/tmuxp path: /tests/cli/test_shell.py
import contextlib
import io
import pathlib
import subprocess
import typing as t
import pytest
from libtmux.server import Server
from libtmux.session import Session
from tmuxp import cli, exc
@pytest.mark.parametrize("cli_cmd", [["shell"], ["she... | code_fim | hard | {
"lang": "python",
"repo": "tmux-python/tmuxp",
"path": "/tests/cli/test_shell.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def test_compute_pmp_no_windows():
ts = np.loadtxt(os.path.join(MODULE_PATH, '..', 'tests', 'sampledata.txt'))
profile = compute(ts)
assert(profile['algorithm'] == 'skimp')
assert(profile['class'] == 'PMP')
# sample pct is ignored when windows are provided and defaults to 1
asser... | code_fim | hard | {
"lang": "python",
"repo": "matrix-profile-foundation/matrixprofile",
"path": "/tests/test_compute.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ts = np.array([np.nan, np.inf, np.inf, np.nan, np.inf, 2, 3, 2, 3, 1, 2, 3, 4, 2,
np.nan, np.inf, 4, 2, 3, 4, 5, 6, 7, 8, 3, 4, 2, 3, 4, 5, 6, 7, 6,
5, 4, 3, np.nan, np.nan, np.inf, np.nan, np.inf, np.nan])
m = 6
preprocessing_kwargs = {
'window': ... | code_fim | hard | {
"lang": "python",
"repo": "matrix-profile-foundation/matrixprofile",
"path": "/tests/test_compute.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: matrix-profile-foundation/matrixprofile path: /tests/test_compute.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
range = getattr(__builtins__, 'x... | code_fim | hard | {
"lang": "python",
"repo": "matrix-profile-foundation/matrixprofile",
"path": "/tests/test_compute.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: RubensZimbres/millstone path: /genome_designer/main/exceptions.py
"""
Common Exception and Error classes.
"""
class InputError(Exception):
"""Exception raised for errors in the input.
I assume this is what DBG wanted in d922023e8a1d4e7757bfa3e68aba3ace89f2a749.
Attributes:
... | code_fim | medium | {
"lang": "python",
"repo": "RubensZimbres/millstone",
"path": "/genome_designer/main/exceptions.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Attributes:
msg -- explanation of the error
"""
def __init__(self, msg):
self.msg = msg
class ValidationException(Exception):
"""Thrown when validation fails.
"""
pass<|fim_prefix|># repo: RubensZimbres/millstone path: /genome_designer/main/exceptions.py
"""
Com... | code_fim | medium | {
"lang": "python",
"repo": "RubensZimbres/millstone",
"path": "/genome_designer/main/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> I assume this is what DBG wanted in d922023e8a1d4e7757bfa3e68aba3ace89f2a749.
Attributes:
msg -- explanation of the error
"""
def __init__(self, msg):
self.msg = msg
class ValidationException(Exception):
"""Thrown when validation fails.
"""
pass<|fim_prefix|... | code_fim | easy | {
"lang": "python",
"repo": "RubensZimbres/millstone",
"path": "/genome_designer/main/exceptions.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>a = np.arange(min(x), max(x), 0.01).reshape(-1,1) # Aralıklarda prediction yapabilmek için, tier aralıklarında fiyat sabit kalmalı
y_head = tree_reg.predict(a)
# Görselleştirme
plt.scatter(x, y, color = 'red')
plt.plot(a, y_head, color = 'green')
plt.xlabel("Seat Tier")
plt.ylabel("Price")
plt.show()<|f... | code_fim | medium | {
"lang": "python",
"repo": "acanozturk/ml-dl",
"path": "/ML/Regressions/DecisionTree/DecisionTree.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acanozturk/ml-dl path: /ML/Regressions/DecisionTree/DecisionTree.py
# Koltuk seviyesine göre fiyatlandırma
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from sklearn.tree import DecisionTreeRegressor
<|fim_suffix|>a = np.arange(min(x), max(x), 0.01).reshape(-1,1) # Aral... | code_fim | hard | {
"lang": "python",
"repo": "acanozturk/ml-dl",
"path": "/ML/Regressions/DecisionTree/DecisionTree.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>y_head = tree_reg.predict(a)
# Görselleştirme
plt.scatter(x, y, color = 'red')
plt.plot(a, y_head, color = 'green')
plt.xlabel("Seat Tier")
plt.ylabel("Price")
plt.show()<|fim_prefix|># repo: acanozturk/ml-dl path: /ML/Regressions/DecisionTree/DecisionTree.py
# Koltuk seviyesine göre fiyatlandırma
impo... | code_fim | hard | {
"lang": "python",
"repo": "acanozturk/ml-dl",
"path": "/ML/Regressions/DecisionTree/DecisionTree.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jd-webb/SparkAutoMapper path: /spark_auto_mapper/automappers/automapper_base.py
from typing import List, Dict, Optional
from pyspark.sql import DataFrame, Column
from spark_auto_mapper.automappers.check_schema_result import CheckSchemaResult
<|fim_suffix|> def __init__(self) -> None:
... | code_fim | medium | {
"lang": "python",
"repo": "jd-webb/SparkAutoMapper",
"path": "/spark_auto_mapper/automappers/automapper_base.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_column_specs(self, source_df: Optional[DataFrame]) -> Dict[str, Column]:
raise NotImplementedError
def check_schema(
self, parent_column: Optional[str], source_df: Optional[DataFrame]
) -> Optional[CheckSchemaResult]:
return None<|fim_prefix|># repo: jd-webb/Sp... | code_fim | hard | {
"lang": "python",
"repo": "jd-webb/SparkAutoMapper",
"path": "/spark_auto_mapper/automappers/automapper_base.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: alcinos/dps path: /dps/rl/policy.py
elf.val_exploration_schedule)
self.exploration = tf.cond(
tf.logical_or(
tf.equal(self.mode, "train"),
tf.equal(self.mode, "off_policy"),
),
lambda: self.train_e... | code_fim | hard | {
"lang": "python",
"repo": "alcinos/dps",
"path": "/dps/rl/policy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = self._sample(utils, exploration)
return tf.identity(s, name="{}.sample".format(self.__class__.__name__))
def log_probs(self, utils, actions, exploration):
lp = self._log_probs(utils, actions, exploration)
return tf.identity(lp, name="{}.log_probs".format(self.__cla... | code_fim | hard | {
"lang": "python",
"repo": "alcinos/dps",
"path": "/dps/rl/policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Gamma(TensorFlowSelection):
""" alpha, beta """
def __init__(self):
self.action_shape = (1,)
self.param_shape = (2,)
def _dist(self, utils, exploration):
concentration = softplus(utils[..., 0])
rate = softplus(utils[..., 1])
return tf_dists.Gamma... | code_fim | hard | {
"lang": "python",
"repo": "alcinos/dps",
"path": "/dps/rl/policy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># Ensure that TTS behaves correctly when text and language are missing
@patch('api.text_to_speech.ibm.views.ibm_send_request', autospec=True)
def test_speak_missing_text_and_language(mock_ibm_send_request, client):
res = client.post(
url_for('tts_ibm.speak'),
content_type='application/... | code_fim | hard | {
"lang": "python",
"repo": "suricats/surirobot-api-converse",
"path": "/api/text_to_speech/ibm/tests/test_views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suricats/surirobot-api-converse path: /api/text_to_speech/ibm/tests/test_views.py
import json
from mock import patch, Mock
from flask import url_for
from api.exceptions import BadParameterException, MissingParameterException, InvalidCredentialsException, ExternalAPIException, APIException
from a... | code_fim | hard | {
"lang": "python",
"repo": "suricats/surirobot-api-converse",
"path": "/api/text_to_speech/ibm/tests/test_views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.eq(self.project.values.get('test1'), 0)
self.eq(self.project.values.get('test2'), 0)
self.eq(self.project.values.incr('test2'), 1)
self.eq(self.project.values.incr('test2'), 2)
def test_data(self):
self.project.add('test').add(1)
self.project.add('... | code_fim | hard | {
"lang": "python",
"repo": "anton62k/json_explorer",
"path": "/ztest/api/zt_project.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anton62k/json_explorer path: /ztest/api/zt_project.py
# coding: utf8
from jsondb.project import Project
from ztest.test_case import BaseCase
from jsondb.table import Table
from jsondb.pattern import Pattern
class ProjectTest(BaseCase):
def setUp(self):
self.project = Project()
... | code_fim | hard | {
"lang": "python",
"repo": "anton62k/json_explorer",
"path": "/ztest/api/zt_project.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.eq(table.pattern.type, Pattern.DYNAMIC_DICT)
def test_project_values(self):
self.eq(self.project.values.get('test'), 0)
self.eq(self.project.values.incr('test'), 1)
self.eq(self.project.values.get('test'), 1)
self.eq(self.project.values.incr('test'), 2)
... | code_fim | hard | {
"lang": "python",
"repo": "anton62k/json_explorer",
"path": "/ztest/api/zt_project.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def dump_all_results():
datafile = open(DUMP_FILE, 'wb')
titles, abstracts = [], []
for ts_, as_ in corpus:
titles.append([word2idx.get(word, id_unk) for word in ts_])
abstracts.append([word2idx.get(word, id_unk) for word in as_])
pickle.dump((allwords, word2idx, idx2word,... | code_fim | hard | {
"lang": "python",
"repo": "sunny8898/DianJing",
"path": "/scripts/data_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunny8898/DianJing path: /scripts/data_utils.py
# coding utf-8
import redis
import json
import pickle
import numpy as np
import random
import jieba
import multiprocessing
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
word2idx, idx2word, allwords, corpus = None, None, {}, []
DUMP_FILE = ... | code_fim | hard | {
"lang": "python",
"repo": "sunny8898/DianJing",
"path": "/scripts/data_utils.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def build_idx_for_words_tf_df(chars, tf_thres=TF_THRES, df_thres=DF_THRES):
start_idx = id_unk + 1
char2idx = {}
idx2char = {}
char2idx['<eos>'] = id_eos
char2idx['<unk>'] = id_unk
char2idx['<emp>'] = id_emp
char2idx['<beg>'] = id_beg
chars = filter(lambda char: char.tf... | code_fim | hard | {
"lang": "python",
"repo": "sunny8898/DianJing",
"path": "/scripts/data_utils.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @responses.activate
def test_1020(self, gmn_client_v2):
"""Extract all values to stream."""
str_buf = io.StringIO()
d1_gmn.app.sysmeta_extract.extract_values(out_stream=str_buf)
self.sample.assert_equals(str_buf.getvalue(), "all_stream")<|fim_prefix|># repo: DataONE... | code_fim | hard | {
"lang": "python",
"repo": "DataONEorg/d1_python",
"path": "/gmn/src/d1_gmn/tests/test_sysmeta_extract.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @responses.activate
def test_1010(self, gmn_client_v2):
"""Extract single generate based value, filtered to SID containing "cd"."""
sciobj_list = d1_gmn.app.sysmeta_extract.extract_values(
filter_arg_dict={"pid__chainmember_pid__chain__sid__did__contains": "cd"},
... | code_fim | hard | {
"lang": "python",
"repo": "DataONEorg/d1_python",
"path": "/gmn/src/d1_gmn/tests/test_sysmeta_extract.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DataONEorg/d1_python path: /gmn/src/d1_gmn/tests/test_sysmeta_extract.py
#!/usr/bin/env python
# This work was created by participants in the DataONE project, and is
# jointly copyrighted by participating institutions in DataONE. For
# more information on DataONE, see our web site at http://data... | code_fim | medium | {
"lang": "python",
"repo": "DataONEorg/d1_python",
"path": "/gmn/src/d1_gmn/tests/test_sysmeta_extract.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gwappa/bzar-python path: /bzar/codec.py
#
# MIT License
#
# Copyright (c) 2019 Keisuke Sehara
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, inc... | code_fim | hard | {
"lang": "python",
"repo": "gwappa/bzar-python",
"path": "/bzar/codec.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def encode_metadata_dict(metadict):
"""used internally to encode the metadata dictionary into its binary format."""
return _json.dumps(metadict, separators=(',', ':')).encode('ascii')
def decode_metadata_dict(rawbytes):
"""used internally to decode the metadata dictionary from its binary form... | code_fim | hard | {
"lang": "python",
"repo": "gwappa/bzar-python",
"path": "/bzar/codec.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def briefing_action(self, query):
"""this method gets called as part of the briefing functionality of K.A.S.P.A.
@param query mainly needed here to retrieve the communicator"""
raise NotImplementedError()
pass<|fim_prefix|># repo: karim-awad/kaspa path: /Kaspa/modu... | code_fim | medium | {
"lang": "python",
"repo": "karim-awad/kaspa",
"path": "/Kaspa/modules/abstract_modules/abstractBriefingSubmodule.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: karim-awad/kaspa path: /Kaspa/modules/abstract_modules/abstractBriefingSubmodule.py
from Kaspa.modules.abstract_modules.abstractSubmodule import AbstractSubmodule
<|fim_suffix|> """Abstract class for all plugin modules"""
def briefing_action(self, query):
"""this method gets cal... | code_fim | easy | {
"lang": "python",
"repo": "karim-awad/kaspa",
"path": "/Kaspa/modules/abstract_modules/abstractBriefingSubmodule.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Abstract class for all plugin modules"""
def briefing_action(self, query):
"""this method gets called as part of the briefing functionality of K.A.S.P.A.
@param query mainly needed here to retrieve the communicator"""
raise NotImplementedError()
pass<|fim_pr... | code_fim | easy | {
"lang": "python",
"repo": "karim-awad/kaspa",
"path": "/Kaspa/modules/abstract_modules/abstractBriefingSubmodule.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chipsnet/Game-Console-Activity-to-Discord path: /startup.py
import os
import json
if not os.path.exists("./lang/lang.txt"):
input("Can't find lang.txt file. You have to run config.py(config.exe) to config.\nPress enter to exit...")
exit()
else:
with open("./lang/lang.txt", "r", enco... | code_fim | hard | {
"lang": "python",
"repo": "Chipsnet/Game-Console-Activity-to-Discord",
"path": "/startup.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>def create_short_cut(path, sc_file_name, icon=None):
if icon is None:
icon = path
shell = win32com.client.Dispatch("WScript.shell")
sh_cut = shell.CreateShortcut(
os.path.join(f"C:/Users/{os.getlogin()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup",
... | code_fim | medium | {
"lang": "python",
"repo": "Chipsnet/Game-Console-Activity-to-Discord",
"path": "/startup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def create_short_cut(path, sc_file_name, icon=None):
if icon is None:
icon = path
shell = win32com.client.Dispatch("WScript.shell")
sh_cut = shell.CreateShortcut(
os.path.join(f"C:/Users/{os.getlogin()}/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup",
... | code_fim | medium | {
"lang": "python",
"repo": "Chipsnet/Game-Console-Activity-to-Discord",
"path": "/startup.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: webkom/holonet path: /holonet/apps/utils/tests/test_manager.py
from unittest import mock
from django.test import TestCase
from holonet.apps.utils.manager import ServiceManager
class ManagerTestCase(TestCase):
<|fim_suffix|> self.manager.add('mock', service_mock)
self.assertTru... | code_fim | medium | {
"lang": "python",
"repo": "webkom/holonet",
"path": "/holonet/apps/utils/tests/test_manager.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.assertListEqual(self.manager.keys(), [])
self.manager._backends['test'] = None
self.assertListEqual(self.manager.keys(), ['test'])<|fim_prefix|># repo: webkom/holonet path: /holonet/apps/utils/tests/test_manager.py
from unittest import mock
from django.test import TestCase
... | code_fim | hard | {
"lang": "python",
"repo": "webkom/holonet",
"path": "/holonet/apps/utils/tests/test_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
service_mock = mock.Mock()
service_mock.func = lambda: True
self.manager.add('mock', service_mock)
self.assertTrue('mock' in self.manager._backends.keys())
self.assertEqual(self.manager._backends.get('mock'), service_mock)
def test_get_service(self):
... | code_fim | medium | {
"lang": "python",
"repo": "webkom/holonet",
"path": "/holonet/apps/utils/tests/test_manager.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AmreshTripathy/Python path: /Scope.py
def computeDifference(self):
maximum = 0
for i in range(len(self.__element<|fim_suffix|> maximum = absolute
self.maximumDifference = maximum<|fim_middle|>s)):
for j in range(len(self.__elements)):
... | code_fim | hard | {
"lang": "python",
"repo": "AmreshTripathy/Python",
"path": "/Scope.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> maximum = absolute
self.maximumDifference = maximum<|fim_prefix|># repo: AmreshTripathy/Python path: /Scope.py
def computeDifference(self):
maximum = 0
for i in range(len(self.__element<|fim_middle|>s)):
for j in range(len(self.__elements)):
... | code_fim | hard | {
"lang": "python",
"repo": "AmreshTripathy/Python",
"path": "/Scope.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __call__(self, index):
BatchCompletionCallBack.completed[self.parallel] += 1
print("Progress : %s %% " %
str(BatchCompletionCallBack.completed[self.parallel] * 100 / len(obj_instances)))
if self.parallel._original_iterat... | code_fim | hard | {
"lang": "python",
"repo": "kierannp/3dsnet",
"path": "/auxiliary/sampling_and_meshing/O-CNN/pcSamplingInfRayShapeNet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kierannp/3dsnet path: /auxiliary/sampling_and_meshing/O-CNN/pcSamplingInfRayShapeNet.py
import argparse
import os
from os.path import join, basename, relpath, dirname, exists
import glob
import joblib
from joblib import Parallel, delayed
from collections import defaultdict
import numpy as np
from... | code_fim | hard | {
"lang": "python",
"repo": "kierannp/3dsnet",
"path": "/auxiliary/sampling_and_meshing/O-CNN/pcSamplingInfRayShapeNet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> obj_instances = sorted([x for x in next(os.walk(join(args.shapenet_path, obj_class)))[1] if "ply" not in x])
# obj_instances = obj_instances[:min(200, len(obj_instances))] # Keep 200 first
class BatchCompletionCallBack(object):
completed = defaultdict(int)
... | code_fim | hard | {
"lang": "python",
"repo": "kierannp/3dsnet",
"path": "/auxiliary/sampling_and_meshing/O-CNN/pcSamplingInfRayShapeNet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dimagi/commcare-hq path: /corehq/apps/oauth_integrations/migrations/0004_auto_20220304_1139.py
# Generated by Django 2.2.27 on 2022-03-04 11:39
from django.db import migrations, models
import django.db.models.deletion
<|fim_suffix|>
dependencies = [
('oauth_integrations', '0003_liv... | code_fim | medium | {
"lang": "python",
"repo": "dimagi/commcare-hq",
"path": "/corehq/apps/oauth_integrations/migrations/0004_auto_20220304_1139.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='livegooglesheetrefreshstatus',
name='refresh_error_reason',
field=models.CharField(choices=[(None, 'No Error'), ('token', 'Invalid Token'), ('timeout', 'Data Timeout'), ('other', 'Other...')], default=None, m... | code_fim | medium | {
"lang": "python",
"repo": "dimagi/commcare-hq",
"path": "/corehq/apps/oauth_integrations/migrations/0004_auto_20220304_1139.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # We should have filtered out the f = .2 Hz component.
exp_ans = np.sin(4 * t * (2 * np.pi) / float(nsamp))# f = .4 Hz
np.testing.assert_array_almost_equal(tod, exp_ans)
def test_mueller2spin_identity(self):
identity = np.eye(4)
mat_spin = tools.mueller2spin(i... | code_fim | hard | {
"lang": "python",
"repo": "AdriJD/beamconv",
"path": "/tests/test_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> blmE_new, blmB_new = tools.shift_blm(blmE, blmB, 0)
np.testing.assert_almost_equal(blmE_new, blmE)
np.testing.assert_almost_equal(blmB_new, blmB)
def test_shift_blm_shift4(self):
blmp2 = np.array([0, 0, -1j, -1j, -1j, 0, 2, 2, 2, 3, 3, 3, 4, 4, 5],
... | code_fim | hard | {
"lang": "python",
"repo": "AdriJD/beamconv",
"path": "/tests/test_tools.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AdriJD/beamconv path: /tests/test_tools.py
import unittest
import numpy as np
import healpy as hp
from beamconv import tools
class TestTools(unittest.TestCase):
def test_trunc_alm(self):
'''
'''
np.random.seed(39)
self.lmax = 10
self.mmax = 3
... | code_fim | hard | {
"lang": "python",
"repo": "AdriJD/beamconv",
"path": "/tests/test_tools.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bojigu/thoipapy path: /thoipapy/validation/__init__.py
import thoipapy.validation.combine_mult_predictors
import thoipapy.validation.leave_one_out
import thoipapy.validation.random_interface
import thoipapy.validation.testset_trainset
import thoipapy.validation.auc
import thoipapy.validation.feat... | code_fim | medium | {
"lang": "python",
"repo": "bojigu/thoipapy",
"path": "/thoipapy/validation/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>e_predictors
import thoipapy.validation.precision_recall
import thoipapy.validation.roc
import thoipapy.validation.tenfold<|fim_prefix|># repo: bojigu/thoipapy path: /thoipapy/validation/__init__.py
import thoipapy.validation.combine_mult_predictors
import thoipapy.validation.leave_one_out
import thoipap... | code_fim | hard | {
"lang": "python",
"repo": "bojigu/thoipapy",
"path": "/thoipapy/validation/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> @parameterized.parameters(
[
((1,), (1, NUM_CLASSES - 1)),
((3,), (3, NUM_CLASSES - 1)),
((4, 3), (4, 3, NUM_CLASSES - 1)),
((5, 4, 3), (5, 4, 3, NUM_CLASSES - 1)),
((3, 1), (3, NUM_CLASSES - 1)),
((3, 2, 1), (3, 2, NUM_CL... | code_fim | hard | {
"lang": "python",
"repo": "xiaoheilong3112/keras",
"path": "/keras/utils/np_utils_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xiaoheilong3112/keras path: /keras/utils/np_utils_test.py
# Copyright 2017 The TensorFlow 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 copy of the License at
... | code_fim | hard | {
"lang": "python",
"repo": "xiaoheilong3112/keras",
"path": "/keras/utils/np_utils_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atultherajput/A-Way-To-Digital-Immortality-Through-Character-Identification path: /SentimentAnalysis/data_extract.py
from scrap import fb_scrap
<|fim_suffix|>def send_data():
return p<|fim_middle|>datas = fb_scrap()
p=datas['data']
def extract(x):
return (p[x]['id'],p[x]['message']) #id... | code_fim | medium | {
"lang": "python",
"repo": "atultherajput/A-Way-To-Digital-Immortality-Through-Character-Identification",
"path": "/SentimentAnalysis/data_extract.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return (p[x]['id'],p[x]['message']) #id<=>from
def send_data():
return p<|fim_prefix|># repo: atultherajput/A-Way-To-Digital-Immortality-Through-Character-Identification path: /SentimentAnalysis/data_extract.py
from scrap import fb_scrap
datas = fb_scrap()
p=datas['data']
<|fim_middle|>def ext... | code_fim | easy | {
"lang": "python",
"repo": "atultherajput/A-Way-To-Digital-Immortality-Through-Character-Identification",
"path": "/SentimentAnalysis/data_extract.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: one-quaker/imfs path: /web/context_processors.py
import os
import sys
from .models import Photo, Wallet
<|fim_suffix|> ctx = {}
ctx['ip'] = get_ip()
ctx['main_url'] = 'http://{ip}:8000'.format(**ctx)
ctx['wallet'] = Wallet.objects.first()
return ctx<|fim_middle|>def get_ip()... | code_fim | hard | {
"lang": "python",
"repo": "one-quaker/imfs",
"path": "/web/context_processors.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.