text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>IT', url = 'https://github.com/muntashir/taskrelay', author = 'https://github.com/muntashir', packages = [''], install_requires = ['websockets'] )<|fim_prefix|># repo: muntashir/taskrelay path: /python/setup.py from setuptools import setup setup( name = 'taskrelay', version = '0....
code_fim
medium
{ "lang": "python", "repo": "muntashir/taskrelay", "path": "/python/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: muntashir/taskrelay path: /python/setup.py from setuptools import setup setup( name = 'taskrelay', version = '0.1.0<|fim_suffix|>thub.com/muntashir', packages = [''], install_requires = ['websockets'] )<|fim_middle|>', description = 'A library to run tasks on remote servers',...
code_fim
medium
{ "lang": "python", "repo": "muntashir/taskrelay", "path": "/python/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Check for our .git/packed-refs' file since a `git gc` may have run # https://git-scm.com/book/en/v2/Git-Internals-Maintenance-and-Data-Recovery packed_file = os.path.join(path, ".git", "packed-refs") if os.path.exists(packed_file): with open(packed_file) as fh...
code_fim
hard
{ "lang": "python", "repo": "SpongePowered/SpongeAuth", "path": "/spongeauth/spongeauth/settings/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if head.startswith("ref: "): head = head[5:] revision_file = os.path.join(path, ".git", *head.split("/")) else: return head else: revision_file = os.path.join(path, ".git", "refs", "heads", head) if not os.path.exists(revision_file): ...
code_fim
hard
{ "lang": "python", "repo": "SpongePowered/SpongeAuth", "path": "/spongeauth/spongeauth/settings/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SpongePowered/SpongeAuth path: /spongeauth/spongeauth/settings/utils.py """ Copyright (c) 2015 Functional Software, Inc and individual contributors. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following con...
code_fim
hard
{ "lang": "python", "repo": "SpongePowered/SpongeAuth", "path": "/spongeauth/spongeauth/settings/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MihneaS/ckanext-inventory path: /ckanext/inventory/controllers/inventory_entry.py import unicodecsv from cStringIO import StringIO from ckan.plugins.toolkit import ( c, check_access, NotAuthorized, abort, get_action, render, request, redirect_to, _, response) from ckan import model from...
code_fim
hard
{ "lang": "python", "repo": "MihneaS/ckanext-inventory", "path": "/ckanext/inventory/controllers/inventory_entry.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return render('inventory/entry/edit.html') def read(self, organization_name, inventory_entry_id): context = {'model': model, 'session': model.Session, 'user': c.user or c.author} c.entries = get_action('inventory_entry_list_items')( ...
code_fim
hard
{ "lang": "python", "repo": "MihneaS/ckanext-inventory", "path": "/ckanext/inventory/controllers/inventory_entry.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ### Custom methods def is_live(self, obj): """ This shows WHICH object will be the live object. Returns True/False. This is used in the default list_display. """ most_appropriate_object = get_appropriate_object_from_model(self.model) ...
code_fim
hard
{ "lang": "python", "repo": "WGBH/django-model-gatekeeper", "path": "/gatekeeper/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WGBH/django-model-gatekeeper path: /gatekeeper/admin.py from django.contrib import admin from django.utils.safestring import mark_safe import pytz from datetime import datetime from .utils import get_appropriate_object_from_model def is_in_the_future(dt): """ Is this (UTC) date/time valu...
code_fim
hard
{ "lang": "python", "repo": "WGBH/django-model-gatekeeper", "path": "/gatekeeper/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # then find end nEndOfSilence = nNumFirstSample*self.nNbrChannel # init of the loop while( nEndOfSilence < len(self.data) ): #nFirstSilenceIndex = np.argmax( np.abs(self.data[nEndOfSilence:])<=nLimit ) nFirstSilenceIndex = findFirstFalseV...
code_fim
hard
{ "lang": "python", "repo": "laboratoriumDIBRIS/caresses-opensource", "path": "/CAHRIM/ActionsLib/NAOqi_apps/asr2/lib/abcdk/sound/wav.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: laboratoriumDIBRIS/caresses-opensource path: /CAHRIM/ActionsLib/NAOqi_apps/asr2/lib/abcdk/sound/wav.py e.write( struct.pack( "I", 16 ) ) file.write( struct.pack( "h", 1) ) # self.nWaveTypeFormat file.write( struct.pack( "h", self.nNbrChannel) ) file.write( struct.pack( "i"...
code_fim
hard
{ "lang": "python", "repo": "laboratoriumDIBRIS/caresses-opensource", "path": "/CAHRIM/ActionsLib/NAOqi_apps/asr2/lib/abcdk/sound/wav.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: LeoWshington/Exercicios_CursoEmVideo_Python path: /ex081.py valores = list() cont = 0 while True: n = float(input('Digite um valor: ')) valores.append(n) op = str(input('Deseja continuar [S/N]? ')).strip()[0] cont += 1 if op in 'Nn': break print(f'{"~" * 30}') valo...
code_fim
medium
{ "lang": "python", "repo": "LeoWshington/Exercicios_CursoEmVideo_Python", "path": "/ex081.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ') print('O numero 5 aparece na(s) ', end='') for pos, v in enumerate(valores): if v == 5: print(f'{pos + 1}ª ', end='') print(' posição(es).')<|fim_prefix|># repo: LeoWshington/Exercicios_CursoEmVideo_Python path: /ex081.py valores = list() cont = 0 while True: n = float(input('Digite ...
code_fim
medium
{ "lang": "python", "repo": "LeoWshington/Exercicios_CursoEmVideo_Python", "path": "/ex081.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_all_data(self): self.get_name() self.get_id() self.get_description() self.get_class() self.get_exits() self.get_attributes() #simple test to verify working so far if __name__ == '__main__': from xmlroom import room_xml_pa...
code_fim
hard
{ "lang": "python", "repo": "tehologist/x-venture", "path": "/old/lib/xmlroom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tehologist/x-venture path: /old/lib/xmlroom.py from xml.dom import minidom """This is parser, which parses XML room files and returns data to create classes for use within the mud.""" class room_xml_parse: def __init__(self, dom): self.name = "" self.id = 0 self.descri...
code_fim
hard
{ "lang": "python", "repo": "tehologist/x-venture", "path": "/old/lib/xmlroom.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_attributes(self): try: var = self.dom.getElementsByTagName("attributes")[0] except IndexError: return 0 var = var.getElementsByTagName("label") var2 = {} for elements in var: for items in elements.childNodes: ...
code_fim
hard
{ "lang": "python", "repo": "tehologist/x-venture", "path": "/old/lib/xmlroom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/nouns/_poem.py #calss header class _POEM(): def __init__(self,): <|fim_suffix|> self.specie = 'nouns' def run(self, obj1 = [], obj2 = []): return self.jsondata<|fim_middle|> self.name = "POEM" self.definitions = [u'a piece of writing in which th...
code_fim
hard
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/nouns/_poem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mahedros/jbc path: /block.py import hashlib import os import json import utils from config import * class Block(object): def __init__(self, dictionary): ''' We're looking for index, timestamp, data, prev_hash, nonce ''' for key, value in dictionary.items()...
code_fim
hard
{ "lang": "python", "repo": "Mahedros/jbc", "path": "/block.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def to_dict(self): info = {} info['index'] = str(self.index) info['timestamp'] = str(self.timestamp) info['prev_hash'] = str(self.prev_hash) info['hash'] = str(self.hash) info['data'] = str(self.data).replace("'", '"') info['nonce'] = str(self.no...
code_fim
hard
{ "lang": "python", "repo": "Mahedros/jbc", "path": "/block.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.Height=self.Length=self.Width=0 print("Please set the values of Height, Width, and Length for Prism", self.Id) print("No value can not be under 1.") while self.Height < 1: self.Height=int(input("Height: ")) if self.Height < 1: pr...
code_fim
hard
{ "lang": "python", "repo": "ThomasMorrissey/Chapter_8_Supp", "path": "/Challenge_2.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: ThomasMorrissey/Chapter_8_Supp path: /Challenge_2.py #! usr/bin/python3 # Program Name: Challenge_2.py # Author: Thomas Morrissey # Date Written: 2-18-2015 # Pusedocode: # This challenge is about creating three different prisms and adding attributes for each prism. # I accomplished this by cr...
code_fim
hard
{ "lang": "python", "repo": "ThomasMorrissey/Chapter_8_Supp", "path": "/Challenge_2.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> Prism0=Prism(0) Prism1=Prism(1) Prism2=Prism(2) print("Welcome to Challenge_2.py!") print("The goal of this program is to create three different prisms with the following parimeters: width, length, height, volume, perimter, and surface area.") Prism0.GetLengthHeightWidth() Pris...
code_fim
hard
{ "lang": "python", "repo": "ThomasMorrissey/Chapter_8_Supp", "path": "/Challenge_2.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.asyncio @pytest.mark.usefixtures('ignore_unawaited_request') async def test_twitter_req_to_http_req_post(): tr = TwitterRequest("POST", "http://url.com/", "service", "family") async with aiohttp.ClientSession() as session: req = twitter_req_to_http_req(session, app_cred, clien...
code_fim
hard
{ "lang": "python", "repo": "jbn/brittle_wit", "path": "/tests/unit_tests/executors/test_twitter_req_to_http_req.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jbn/brittle_wit path: /tests/unit_tests/executors/test_twitter_req_to_http_req.py import aiohttp import pytest from brittle_wit_core import TwitterRequest, AppCredentials, ClientCredentials from brittle_wit.executors import twitter_req_to_http_req from tests.helpers import * <|fim_suffix|> # --...
code_fim
medium
{ "lang": "python", "repo": "jbn/brittle_wit", "path": "/tests/unit_tests/executors/test_twitter_req_to_http_req.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path: /tests/unit/game_pkchess/character/obj.py from game.pkchess.character import Character from game.pkchess.utils.character import get_character_template from tests.base import TestCase <|fim_suffix|> self.assertEqual(chara.template, template) self.assertEq...
code_fim
medium
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/tests/unit/game_pkchess/character/obj.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class TestCharacter(TestCase): def test_character_from_template(self): template = get_character_template("Nearnox") chara = Character(template) self.assertEqual(chara.template, template) self.assertEqual(chara.name, template.name) self.assertEqual(chara.HP, t...
code_fim
medium
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/tests/unit/game_pkchess/character/obj.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_convert_data_to_klass_instances(self): self.assertIsInstance(self.apilist[0], rainforest.apibits.ApiResource) self.assertEqual(self.fake_resource, self.apilist[0].json)<|fim_prefix|># repo: rainforestapp/rainforest-python path: /rainforest/test/test_api_list.py import rainfor...
code_fim
hard
{ "lang": "python", "repo": "rainforestapp/rainforest-python", "path": "/rainforest/test/test_api_list.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rainforestapp/rainforest-python path: /rainforest/test/test_api_list.py import rainforest import unittest class TestApiList(unittest.TestCase): def setUp(self): <|fim_suffix|> def test_convert_data_to_klass_instances(self): self.assertIsInstance(self.apilist[0], rainforest.apibits...
code_fim
hard
{ "lang": "python", "repo": "rainforestapp/rainforest-python", "path": "/rainforest/test/test_api_list.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuxiuzhi738/openspeech path: /openspeech/modules/additive_attention.py # MIT License # # Copyright (c) 2021 Soohwan Kim and Sangchun Ha and Soyoung Cho # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Soft...
code_fim
hard
{ "lang": "python", "repo": "wuxiuzhi738/openspeech", "path": "/openspeech/modules/additive_attention.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: dim (int): dimension of model Inputs: query, key, value - **query** (batch_size, q_len, hidden_dim): tensor containing the output features from the decoders. - **key** (batch, k_len, d_model): tensor containing projection vector for encoders. - **value** (bat...
code_fim
hard
{ "lang": "python", "repo": "wuxiuzhi738/openspeech", "path": "/openspeech/modules/additive_attention.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: barberscore/barberscore-api path: /project/apps/adjudication/migrations/0025_outcome_printed.py # Generated by Django 2.2.27 on 2022-05-30 22:19 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('adjudication', '0024_auto_20220530_1454'), ] operation...
code_fim
easy
{ "lang": "python", "repo": "barberscore/barberscore-api", "path": "/project/apps/adjudication/migrations/0025_outcome_printed.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='outcome', name='printed', field=models.BooleanField(default=True, help_text='\n Show this outcome on the OSS.'), ), ]<|fim_prefix|># repo: barberscore/barberscore-api path: /project/apps...
code_fim
medium
{ "lang": "python", "repo": "barberscore/barberscore-api", "path": "/project/apps/adjudication/migrations/0025_outcome_printed.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ NewNode tests behavior of lndmanage under a blank new node without any channels. """ network_definition = test_graphs_paths['empty_graph'] def graph_test(self): self.assertEqual(0, len(self.master_node_graph_view)) def test_empty(self): # LND interface of ...
code_fim
medium
{ "lang": "python", "repo": "bitromortac/lndmanage", "path": "/test/test_lndmanage.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: bitromortac/lndmanage path: /test/test_lndmanage.py """ Integration tests for lndmanage.""" import asyncio from test.testing_common import test_graphs_paths, TestNetwork class NewNode(TestNetwork): """ NewNode tests behavior of lndmanage under a blank new node without any channels....
code_fim
medium
{ "lang": "python", "repo": "bitromortac/lndmanage", "path": "/test/test_lndmanage.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: stdiorion/competitive-programming path: /contests_atcoder/abc159/abc159_f.py from collections import defaultdict MOD = 998244353 n, s = map(int, input().split()) a = list(map(int, input().split())) for <|fim_suffix|> dp[l][a[l]] = 1 for i in range(l + 1, n): dp[i][]<|fim_middle|>l i...
code_fim
medium
{ "lang": "python", "repo": "stdiorion/competitive-programming", "path": "/contests_atcoder/abc159/abc159_f.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> dp[l][a[l]] = 1 for i in range(l + 1, n): dp[i][]<|fim_prefix|># repo: stdiorion/competitive-programming path: /contests_atcoder/abc159/abc159_f.py from collections import defaultdict MOD = 998244353 n, s = map(int, input().split()) a = list(map(int, input().split())) for <|fim_middle|>l i...
code_fim
medium
{ "lang": "python", "repo": "stdiorion/competitive-programming", "path": "/contests_atcoder/abc159/abc159_f.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: DBXhhh/VGCN-PyTorch path: /main.py import os import time import argparse import torch import math import numpy as np import cv2 import torch.optim as optim import torch.optim.lr_scheduler as LS from torch.autograd import Variable from torchvision import models import scipy.io as scio from scipy i...
code_fim
hard
{ "lang": "python", "repo": "DBXhhh/VGCN-PyTorch", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def train(epoch, iteration): model.train() # scheduler.step() end = time.time() log = [0 for _ in range(1)] for batch_idx, batch in enumerate(train_loader): data, label, _, A, wimg = batch data = Variable(data.cuda()) label = Variable(label.cuda()) A = ...
code_fim
hard
{ "lang": "python", "repo": "DBXhhh/VGCN-PyTorch", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model.eval() log = 0 score_list = [] label_list = [] name_list = [] for batch_idx, batch in enumerate(test_loader): data, label, imgname, A, wimg = batch data = Variable(data.cuda()) label = Variable(label.cuda()) A = Variable(A.cuda()) wim...
code_fim
hard
{ "lang": "python", "repo": "DBXhhh/VGCN-PyTorch", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #----------------------------------------------------- #PLOT DATA SAMPLES #----------------------------------------------------- title = "" x_title = "Longitude" y_title = "Latitude" x_axis = lon_list y_axis = lat_list color_list = color_list filename = "doc/visualization/plot.png" fig = plt.f...
code_fim
hard
{ "lang": "python", "repo": "urbanoanderson/ufpe-graduation-thesis", "path": "/src/thesis/experiments/visualization.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: urbanoanderson/ufpe-graduation-thesis path: /src/thesis/experiments/visualization.py #!/usr/bin/python # -*- coding: utf-8 -*- import sys import argparse import numpy as np import matplotlib as mpl import matplotlib.pyplot as plt #Custom Classes sys.dont_write_bytecode = True from modules.erb ...
code_fim
hard
{ "lang": "python", "repo": "urbanoanderson/ufpe-graduation-thesis", "path": "/src/thesis/experiments/visualization.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> user_defined_parameters = { "base_reward": base_reward, "min_other_merchants": min_other_merchants, "token": "0x999999cf1046e68e36E1aA2E0E07105eDDD1f08E", "duration": 43200, } return user_defined_parameters<|fim_prefix|># repo: cardstack/cardstack path: /packag...
code_fim
hard
{ "lang": "python", "repo": "cardstack/cardstack", "path": "/packages/cardpay-reward-programs/streamlit/views/min_other_merchants_paid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def get_user_defined_parameters(): s = st.expander(label="User defined parameters", expanded=True) min_other_merchants = s.number_input( "Min Other Merchants", value=1, step=1, min_value=0, max_value=20 ) base_reward = s.number_input( "Base reward", value=5, step=1, min_val...
code_fim
medium
{ "lang": "python", "repo": "cardstack/cardstack", "path": "/packages/cardpay-reward-programs/streamlit/views/min_other_merchants_paid.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cardstack/cardstack path: /packages/cardpay-reward-programs/streamlit/views/min_other_merchants_paid.py import streamlit as st from cardpay_reward_programs.rules import MinOtherMerchantsPaid def get_rule_class(): <|fim_suffix|> user_defined_parameters = { "base_reward": base_reward, ...
code_fim
hard
{ "lang": "python", "repo": "cardstack/cardstack", "path": "/packages/cardpay-reward-programs/streamlit/views/min_other_merchants_paid.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure/azure-cli path: /src/azure-cli/azure/cli/command_modules/appservice/_github_oauth.py # -------------------------------------------------------------------------------------------- # Copyright (c) Microsoft Corporation. All rights reserved. # Licensed under the MIT License. See License.txt i...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/appservice/_github_oauth.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def load_github_token_from_cache(cmd, repo): repo = repo_url_to_name(repo) secret_store = _get_github_token_secret_store(cmd) cache = secret_store.load() if isinstance(cache, list): for entry in cache: if isinstance(entry, dict) and repo in entry.get("repos", []): ...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/appservice/_github_oauth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> repo = repo_url_to_name(repo) secret_store = _get_github_token_secret_store(cmd) cache = secret_store.load() if isinstance(cache, list): for entry in cache: if isinstance(entry, dict) and repo in entry.get("repos", []): return entry.get("value") re...
code_fim
hard
{ "lang": "python", "repo": "Azure/azure-cli", "path": "/src/azure-cli/azure/cli/command_modules/appservice/_github_oauth.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lista[index], lista[min_index] = lista[min_index], lista[index]<|fim_prefix|># repo: EDAII/Lista2_JoaoVitor_JoaoPedro path: /algoritmos_python/selection_sort.py def selection_sort(lista): """ Realiza ordenacao utilizando selection sort lista: Vetor de inteiros """ for index in...
code_fim
medium
{ "lang": "python", "repo": "EDAII/Lista2_JoaoVitor_JoaoPedro", "path": "/algoritmos_python/selection_sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: EDAII/Lista2_JoaoVitor_JoaoPedro path: /algoritmos_python/selection_sort.py def selection_sort(lista): """ Realiza ordenacao utilizando selection sort lista: Vetor de inteiros """ for index in range(0, len(lista)): min_index = index <|fim_suffix|> lista[index],...
code_fim
medium
{ "lang": "python", "repo": "EDAII/Lista2_JoaoVitor_JoaoPedro", "path": "/algoritmos_python/selection_sort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # # Derive state ################################################################# def player(n_moves): if n_moves % 2 == 0: return ch_x else: return ch_o def player_str(n_moves): if player(n_moves) == ch_x: return 'X' else: return 'O' def turn(game): ...
code_fim
hard
{ "lang": "python", "repo": "whtahy/prototypes", "path": "/tictactoe-ext/src/game.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def player_str(n_moves): if player(n_moves) == ch_x: return 'X' else: return 'O' def turn(game): return 1 + len(game.history) - (winner(game) or tie(game)) def tie(game): return len(game.history) == board_rows * board_cols def winner(game): def check(coords): ...
code_fim
hard
{ "lang": "python", "repo": "whtahy/prototypes", "path": "/tictactoe-ext/src/game.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: whtahy/prototypes path: /tictactoe-ext/src/game.py # Released under CC0: # Summary: https://creativecommons.org/publicdomain/zero/1.0/ # Legal Code: https://creativecommons.org/publicdomain/zero/1.0/legalcode.txt from config import * # # Game state ############################################...
code_fim
hard
{ "lang": "python", "repo": "whtahy/prototypes", "path": "/tictactoe-ext/src/game.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> def auth_user(username, password): """Return wihether user `username` exists with password `password`""" db, c = config.start_db() c.execute( 'SELECT pass_hash, salt FROM users WHERE username=? LIMIT 1', (username,) ) result = c.fetchone() config.end_db(db) if ...
code_fim
hard
{ "lang": "python", "repo": "dkeriazisStuy/Bourbon-Chocolate_Blog", "path": "/util/accounts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def auth_user(username, password): """Return wihether user `username` exists with password `password`""" db, c = config.start_db() c.execute( 'SELECT pass_hash, salt FROM users WHERE username=? LIMIT 1', (username,) ) result = c.fetchone() config.end_db(db) if r...
code_fim
hard
{ "lang": "python", "repo": "dkeriazisStuy/Bourbon-Chocolate_Blog", "path": "/util/accounts.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dkeriazisStuy/Bourbon-Chocolate_Blog path: /util/accounts.py import sqlite3 # Enable control of an sqlite database import csv # Facilitates CSV I/O import os import hashlib import hmac import util.config as config def create_table(): """Creates the SQLite database 'users'""" db, c = c...
code_fim
hard
{ "lang": "python", "repo": "dkeriazisStuy/Bourbon-Chocolate_Blog", "path": "/util/accounts.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rishabhdutta/pylith path: /playpen/finitestrain/plot_soln.py import h5py geom = "topo" # Finite strain sim = "%s-finite" % geom filename = "output/%s-domain.h5" % sim h5 = h5py.File(filename, "r") dispF = h5['vertex_fields/displacement'][:] timeF = h5['time'][:,0,0] h5.close() filename = "out...
code_fim
medium
{ "lang": "python", "repo": "rishabhdutta/pylith", "path": "/playpen/finitestrain/plot_soln.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from pyre.units.time import year timeF /= year.value timeI /= year.value import pylab iPt = 1 pylab.subplot(2,1,1) pylab.plot(timeF, dispF[:,iPt,1], 'r-', timeI, dispI[:,iPt,1], 'b--') pylab.subplot(2,1,2) pylab.plot(timeF, vstrainF[:,:], 'r-', timeI, vstrainI[:,:], 'b--') pylab.show()<|fim_prefix|># r...
code_fim
hard
{ "lang": "python", "repo": "rishabhdutta/pylith", "path": "/playpen/finitestrain/plot_soln.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if not asyncio.iscoroutinefunction(coro_func): raise TypeError(f'Annotated functions should be coroutines. Use \'async def\'.') for event in event_types: if event not in allowed_events: raise RuntimeError(f'Event {eve...
code_fim
hard
{ "lang": "python", "repo": "sousa-andre/lcu-driver", "path": "/lcu_driver/events/managers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Match registered websocket events and create a task with each handler""" for event in connector.ws.registered_uris: if event['uri'] == data['uri'] or ( event['uri'].endswith('/') and data['uri'].startswith(event['uri']) ): if d...
code_fim
hard
{ "lang": "python", "repo": "sousa-andre/lcu-driver", "path": "/lcu_driver/events/managers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sousa-andre/lcu-driver path: /lcu_driver/events/managers.py import asyncio from abc import ABC from typing import Union, Callable, Awaitable, Iterable from lcu_driver.events.responses import WebsocketEventResponse class ConnectorEventManager(ABC): """Connector Events Manager Base Class""" ...
code_fim
hard
{ "lang": "python", "repo": "sousa-andre/lcu-driver", "path": "/lcu_driver/events/managers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> datatype = 'dask' if use_dask else 'pandas' if gridded: datatype = 'xarray' gridded_data = True if kind == 'rgb': if 'bands' in kwds: other_dims = [kwds['bands']] else: ...
code_fim
hard
{ "lang": "python", "repo": "SmartDataProject/hvplot", "path": "/hvplot/converter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SmartDataProject/hvplot path: /hvplot/converter.py gridded = True else: kind = 'hist' datatype = 'dask' if use_dask else 'pandas' if gridded: datatype = 'xarray' gridded_data = True ...
code_fim
hard
{ "lang": "python", "repo": "SmartDataProject/hvplot", "path": "/hvplot/converter.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> import xarray as xr data = self.data if data is None else data z = z or self.kwds.get('z') x = x or self.x y = y or self.y if not (x and y): x, y = list(data.dims)[::-1] if not z: z = list(data.data_vars)[0] if isinstance(dat...
code_fim
hard
{ "lang": "python", "repo": "SmartDataProject/hvplot", "path": "/hvplot/converter.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: rapidsai/xgboost path: /demo/rmm_plugin/rmm_mgpu_with_dask.py import xgboost as xgb from sklearn.datasets import make_classification import dask from dask.distributed import Client from dask_cuda import LocalCUDACluster <|fim_suffix|> X, y = make_classification(n_samples=10000, n_informative=...
code_fim
medium
{ "lang": "python", "repo": "rapidsai/xgboost", "path": "/demo/rmm_plugin/rmm_mgpu_with_dask.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> X, y = make_classification(n_samples=10000, n_informative=5, n_classes=3) # In pratice one should prefer loading the data with dask collections instead of using # `from_array`. X = dask.array.from_array(X) y = dask.array.from_array(y) dtrain = xgb.dask.DaskDMatrix(client, X, label=...
code_fim
medium
{ "lang": "python", "repo": "rapidsai/xgboost", "path": "/demo/rmm_plugin/rmm_mgpu_with_dask.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomturner/django-datatables path: /django/examples/migrations/0004_person_title.py # Generated by Django 2.2.5 on 2020-12-16 14:05 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( model_nam...
code_fim
medium
{ "lang": "python", "repo": "tomturner/django-datatables", "path": "/django/examples/migrations/0004_person_title.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('examples', '0003_tags'), ] operations = [ migrations.AddField( model_name='person', name='title', field=models.IntegerField(choices=[(0, 'Mr'), (1, 'Mrs'), (2, 'Miss')], null=True), ), ]<|fim_prefix|># repo: to...
code_fim
easy
{ "lang": "python", "repo": "tomturner/django-datatables", "path": "/django/examples/migrations/0004_person_title.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>m.save(os.path.join('results', 'Colormaps_2.html')) m # # def my_color_function(feature): # """Maps low values to green and hugh values to red.""" # if unemployment_dict[feature['id']] > 6.5: # return '#ff0000' # else: # return '#008000' # # m = folium.Map([43, -1...
code_fim
hard
{ "lang": "python", "repo": "sduprey/open_data_platform", "path": "/python_dashboard/python_visualization.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sduprey/open_data_platform path: /python_dashboard/python_visualization.py import os import folium import pickle import json import pandas as pd import branca.colormap as cm from collections import defaultdict print(folium.__version__) #us_states = os.path.join('..\\example\\data'...
code_fim
hard
{ "lang": "python", "repo": "sduprey/open_data_platform", "path": "/python_dashboard/python_visualization.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if apo: eu = 1 + e ed = 1 - e else: eu = 1 - e ed = 1 + e aux_m = max(m1, m2) m2 = min(m1, m2) m1 = aux_m aux_p = a * eu / M a...
code_fim
hard
{ "lang": "python", "repo": "Gianuzzi/circumbinary-disc", "path": "/libs/stars.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gianuzzi/circumbinary-disc path: /libs/stars.py from __future__ import print_function from sys import exit from numpy import all, any, sum, cos, sin, pi, sqrt from numpy import array, newaxis, ndarray from numpy import empty, full, where from numpy import transpose, unique from libs.const impo...
code_fim
hard
{ "lang": "python", "repo": "Gianuzzi/circumbinary-disc", "path": "/libs/stars.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Print Final Result openLines(1,"-") result = randomize(age,sign,street,color,hometown)+" from "+hometown #Display and Save Result print(result) file = open("name.txt", "w") file.write(str(result)) file.close()<|fim_prefix|># repo: ianpetrarca/python_examples path: /nick_name.py # Python Project: Nic...
code_fim
hard
{ "lang": "python", "repo": "ianpetrarca/python_examples", "path": "/nick_name.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ianpetrarca/python_examples path: /nick_name.py # Python Project: Nick NAME GENERATOR # CLI Goals: Generate A Nick Name From a User's Data # Python Topics: # - If Statement # - Writing To Files # - Lists # - Functions # Sample Data: # - Broadway # - 25 # - Purple # - 5 # - Brooklyn ...
code_fim
hard
{ "lang": "python", "repo": "ianpetrarca/python_examples", "path": "/nick_name.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> names.append(sign),names.append(street),names.append(color) sampling = random.sample(names,k=2) #return random choice return age + " " + sampling[1] + " " + sampling[0][0] #Print Final Result openLines(1,"-") result = randomize(age,sign,street,color,hometown)+" from "+hometown #Display a...
code_fim
medium
{ "lang": "python", "repo": "ianpetrarca/python_examples", "path": "/nick_name.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: NKM-ML/LLC_Membranes path: /Ben_Manuscripts/transport/figures/msd_bar_chart.py #!/usr/bin/env python import matplotlib.pyplot as plt import sqlite3 as sql import numpy as np import names connection = sql.connect("../../../LLC_Membranes/timeseries/msd.db") crsr = connection.cursor() restrict_by_...
code_fim
hard
{ "lang": "python", "repo": "NKM-ML/LLC_Membranes", "path": "/Ben_Manuscripts/transport/figures/msd_bar_chart.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if time_averaged: ordered_md = np.argsort(md_tamsd)[::-1] md_tamsd = md_tamsd[ordered_md] md_tamsd_lower = md_tamsd_lower[ordered_md] md_tamsd_upper = md_tamsd_upper[ordered_md] #mw = mw[ordered_md] else: ordered_md = np.argsort(md_msd)[::-1] md_msd = md_msd[ordered_md] md_msd_lower = md_msd_low...
code_fim
hard
{ "lang": "python", "repo": "NKM-ML/LLC_Membranes", "path": "/Ben_Manuscripts/transport/figures/msd_bar_chart.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> failing_navet_responses = [ OrderedDict([ (u'OfficialAddress', OrderedDict([(u'Address2', u'\xd6RGATAN 79 LGH 10'), (u'PostalCode', u'12345'), (u'City', u'LANDET')])) ...
code_fim
hard
{ "lang": "python", "repo": "SUNET/eduid-idproofing-letter", "path": "/src/idproofing_letter/tests/test_pdf.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SUNET/eduid-idproofing-letter path: /src/idproofing_letter/tests/test_pdf.py # -*- coding: utf-8 -*- from __future__ import absolute_import import unittest from collections import OrderedDict from idproofing_letter import pdf # We need to add Navet responses that we fail to handle __author__ ...
code_fim
hard
{ "lang": "python", "repo": "SUNET/eduid-idproofing-letter", "path": "/src/idproofing_letter/tests/test_pdf.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> failing_navet_responses = [ OrderedDict([ (u'OfficialAddress', OrderedDict([(u'Address2', u'\xd6RGATAN 79 LGH 10'), (u'PostalCode', u'12345'), (u'City', u'LANDET')])) ...
code_fim
hard
{ "lang": "python", "repo": "SUNET/eduid-idproofing-letter", "path": "/src/idproofing_letter/tests/test_pdf.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def create_demo_accounts(): Account.objects.all().delete() # Create some rows Account.objects.create(year="2004", sales=1000, expenses=400, ceo="Welch") Account.objects.create(year="2005", sales=1170, expenses=460, ceo="Jobs") Acco...
code_fim
hard
{ "lang": "python", "repo": "aburan28/django-graphos", "path": "/demo_project/demo/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: aburan28/django-graphos path: /demo_project/demo/utils.py import pymongo from .models import Account DB_HOST = ["localhost"] DB_PORT = 27017 def get_db(db_name): DB_HOST = ["localhost"] DB_PORT = 27017 db = pymongo.Connection(DB_HOST, DB_PORT)[db_name] return db def get_mon...
code_fim
hard
{ "lang": "python", "repo": "aburan28/django-graphos", "path": "/demo_project/demo/utils.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>candlestick_data = [['Mon', 20, 28, 38, 45], ['Tue', 31, 38, 55, 66], ['Wed', 50, 55, 77, 80], ['Thu', 77, 77, 66, 50], ['Fri', 68, 66, 22, 15]] mongo_series_object_1 = [[440, 39], [488, 29.25], ...
code_fim
hard
{ "lang": "python", "repo": "aburan28/django-graphos", "path": "/demo_project/demo/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdeff/ntds_2016 path: /project/reports/breast_cancer/models.py """ This module contains the function to run the cnn model """ import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import collections import cnn import utils from timeit import default_timer as timer from sklea...
code_fim
hard
{ "lang": "python", "repo": "mdeff/ntds_2016", "path": "/project/reports/breast_cancer/models.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # second convolutional layer KERNEL_2_SIZE = (5,5) KERNEL_2_NUM = 32 MAXPOOL_2_SIZE = (3,3) if strides=='conv': KERNEL_2_STRIDE = (2,2) MAXPOOL_2_STRIDE = (1,1) elif strides=='pool': KERNEL_2_STRIDE = (1,1) MAXPOOL_2_STRIDE = (2,2) else: ...
code_fim
hard
{ "lang": "python", "repo": "mdeff/ntds_2016", "path": "/project/reports/breast_cancer/models.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: laume/dlai path: /dlai/mlai.py import tensorflow as tf from tensorflow import keras import pandas as pd def plot_history(history, contains, skip=0): df = pd.DataFrame(history.history) df[list(df.filter(regex=contains))].iloc[skip:].plot() def categorical_fit_transform(df, cat_cols): ...
code_fim
hard
{ "lang": "python", "repo": "laume/dlai", "path": "/dlai/mlai.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def continuous_fit_transform(df, cont_cols): df = df.copy() cont_features_map = {} df[cont_cols] = df[cont_cols].astype(float) for cont_col in cont_cols: cont_features_map[cont_col] = { "mean": df[cont_col].mean(), "std": df[cont_col].std(), } ...
code_fim
hard
{ "lang": "python", "repo": "laume/dlai", "path": "/dlai/mlai.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>With ``matplotlib>=3.4``, a keyword argument ``transform`` can be given. Particularly when `ax.transTernaryAxes` is given, a line fixed to the triangle can be added by giving the first and the second arguments in the barycentric coordinates. """ import matplotlib.pyplot as plt import mpltern ax = plt.sub...
code_fim
hard
{ "lang": "python", "repo": "yuzie007/mpltern", "path": "/examples/introductory/axline.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yuzie007/mpltern path: /examples/introductory/axline.py """ ====== AxLine ====== An infinitely long straight line can be added using ``ax.axline`` in a similar way as Matplotlib. This may be helpful, e.g., for adding an isoproportion line. .. note:: <|fim_suffix|>ax.axline( [1.0, 0.0, 0.0]...
code_fim
hard
{ "lang": "python", "repo": "yuzie007/mpltern", "path": "/examples/introductory/axline.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert 0 not in solveset_real(sin(x)/x, x) assert 0 not in solveset_complex((exp(x) - 1)/x, x) @XFAIL def test_solve_trig_simplified(): n = Dummy('n') assert dumeq(solveset_real(sin(x), x), imageset(Lambda(n, n*pi), S.Integers)) assert dumeq(solveset_real(cos(x), x), ...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/solvers/tests/test_solveset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sympy/sympy path: /sympy/solvers/tests/test_solveset.py ): n = Dummy('n') assert dumeq(solveset_complex(2**x + 4**x, x),imageset( Lambda(n, I*(2*n*pi + pi)/log(2)), S.Integers)) assert solveset_complex(x**z*y**z - 2, z) == FiniteSet( log(2)/(log(x) + log(y))) asse...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/solvers/tests/test_solveset.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert solveset_real(LambertW(2*x) - y) == FiniteSet( y*exp(y)/2) @XFAIL def test_other_lambert(): a = Rational(6, 5) assert solveset_real(x**a - a**x, x) == FiniteSet( a, -a*LambertW(-log(a)/a)/log(a)) @_both_exp_pow def test_solveset(): f = Function('f') raises(Va...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/solvers/tests/test_solveset.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: EDAII/Arvores_RB-Tree_Lista_04 path: /No.py # No e Cores PRETO = 'PRETO' VERMELHO = 'VERMELHO' NIL = 'NIL' class No: def __init__(self, valor, cor, pai, esquerda=None, direita=None): self.valor = valor self.cor = cor self.pai = pai self.esquerda = esquerda ...
code_fim
medium
{ "lang": "python", "repo": "EDAII/Arvores_RB-Tree_Lista_04", "path": "/No.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.cor == NIL and self.cor == other.cor: return True if self.pai is None or other.pai is None: pais_iguais = self.pai is None and other.pai is None else: pais_iguais = self.pai.valor == other.pai.valor and self.pai.cor == other.pai.cor ...
code_fim
medium
{ "lang": "python", "repo": "EDAII/Arvores_RB-Tree_Lista_04", "path": "/No.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.cor == NIL: return 0 return sum([int(self.esquerda.cor != NIL), int(self.direita.cor != NIL)])<|fim_prefix|># repo: EDAII/Arvores_RB-Tree_Lista_04 path: /No.py # No e Cores PRETO = 'PRETO' VERMELHO = 'VERMELHO' NIL = 'NIL' class No: def __init__(self, valor, cor,...
code_fim
hard
{ "lang": "python", "repo": "EDAII/Arvores_RB-Tree_Lista_04", "path": "/No.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sasasagagaga/Code-examples path: /Python 2 & 3/some ML examples/linear models/multiclass.py class MulticlassStrategy: def __init__(self, classifier, mode, **kwargs): """ Инициализация мультиклассового классификатора classifier - базовый бинарный классификат...
code_fim
hard
{ "lang": "python", "repo": "sasasagagaga/Code-examples", "path": "/Python 2 & 3/some ML examples/linear models/multiclass.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def predict(self, X): """ Выдача предсказаний классификатором """ if self.mode == 'one_vs_all': probs = [classifier.predict_proba(X)[:, 1] for classifier in self.classifiers] return np.argmax(probs, axis=0) else: pred = np.zer...
code_fim
hard
{ "lang": "python", "repo": "sasasagagaga/Code-examples", "path": "/Python 2 & 3/some ML examples/linear models/multiclass.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edkirk30/django-notifications path: /notifications/migrations/0009_notification_full_screen_datetime.py # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-06-05 22:20 from __future__ import unicode_literals <|fim_suffix|> operations = [ migrations.AddField( model...
code_fim
medium
{ "lang": "python", "repo": "edkirk30/django-notifications", "path": "/notifications/migrations/0009_notification_full_screen_datetime.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='notification', name='full_screen_datetime', field=models.DateTimeField(blank=True, null=True), ), ]<|fim_prefix|># repo: edkirk30/django-notifications path: /notifications/migrations/0009_notificat...
code_fim
medium
{ "lang": "python", "repo": "edkirk30/django-notifications", "path": "/notifications/migrations/0009_notification_full_screen_datetime.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> config_expression = snippet_config_language_pb2.Expression( string_value="hello world" ) node = libcst_utils.convert_expression(config_expression) expected_node = libcst.SimpleString(value='"hello world"') assert node.deep_equals(expected_node), (node, expected_node) def tes...
code_fim
hard
{ "lang": "python", "repo": "googleapis/gapic-generator-python", "path": "/tests/unit/configurable_snippetgen/test_libcst_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_convert_py_dict(): key_value_pairs = [("key1", "value1"), ("key2", "value2")] node = libcst_utils.convert_py_dict(key_value_pairs) expected_node = libcst.Dict( [ libcst.DictElement( libcst.SimpleString('"key1"'), libcst.SimpleString('"value1"') ...
code_fim
hard
{ "lang": "python", "repo": "googleapis/gapic-generator-python", "path": "/tests/unit/configurable_snippetgen/test_libcst_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }