text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: hcfilho/uploadExercicioDePolimorfismo path: /exercicio2.py class Pessoa: def __init__(self,nome,sobrenome,idade,): self.__nome = nome self.__sobrenome = sobrenome self.__idade = idade @property def nome(self): return self.__nome @nome.setter ...
code_fim
hard
{ "lang": "python", "repo": "hcfilho/uploadExercicioDePolimorfismo", "path": "/exercicio2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @duracao.setter def duracao(self,nova_duracao): self.__duracao = nova_duracao class Professor(Funcionario): def __init__(self, nome, sobrenome, idade, salario, descricao,competencias): super().__init__(nome, sobrenome, idade, salario, descricao) self.__competencias = c...
code_fim
hard
{ "lang": "python", "repo": "hcfilho/uploadExercicioDePolimorfismo", "path": "/exercicio2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self.__nome @nome.setter def nome(self,novo_nome): self.__nome = novo_nome @property def duracao(self): return self.__duracao @duracao.setter def duracao(self,nova_duracao): self.__duracao = nova_duracao class Professor(Funcionario...
code_fim
hard
{ "lang": "python", "repo": "hcfilho/uploadExercicioDePolimorfismo", "path": "/exercicio2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.slist.append(value) return True def pop(self): if self.is_empty(): return False else: return self.slist.pop() # testing if __name__=='__main__': stack=Stack() print(stack.is_empty()) print(stack.push(2)) print(stack.is_empt...
code_fim
hard
{ "lang": "python", "repo": "ly989264/Python_COMP9021", "path": "/Week11/self_stack.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ly989264/Python_COMP9021 path: /Week11/self_stack.py # Stack class Stack: def __init__(self): self.slist=[] def __len__(self): return len(self.slist) <|fim_suffix|> if self.is_empty(): return None else: return self.slist[-1] de...
code_fim
medium
{ "lang": "python", "repo": "ly989264/Python_COMP9021", "path": "/Week11/self_stack.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: erickmiller/AutomatousSourceCode path: /AutonomousSourceCode/data/raw/sort/5ae99d89-b180-4acd-bafe-b7ec1f91cad0__sorted_list.py # Conor T. Ryan # Week 5 Homework # UW PCE Programming in Python # Fall 2011 (Jacky) from copy import copy def sorted_list(listToSort): sortedList = [] ...
code_fim
medium
{ "lang": "python", "repo": "erickmiller/AutomatousSourceCode", "path": "/AutonomousSourceCode/data/raw/sort/5ae99d89-b180-4acd-bafe-b7ec1f91cad0__sorted_list.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return sortedList if __name__ == '__main__': list1 = ['z', 'x', 'y'] list2 = ['banana', 'pear', 'apple'] newList1 = sorted_list(list1) newList2 = sorted_list(list2) assert list1 == ['z', 'x', 'y'] assert list2 == ['banana', 'pear', 'apple'] print newList1 print new...
code_fim
hard
{ "lang": "python", "repo": "erickmiller/AutomatousSourceCode", "path": "/AutonomousSourceCode/data/raw/sort/5ae99d89-b180-4acd-bafe-b7ec1f91cad0__sorted_list.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for k,v in tr.items( ): result[k]=v*tw for k,v in fr.items( ): result[k]=v*fw return result else: if int(v) in allowed_values: if v>=tree.value: branch=tree.tb else: branch=tree.fb else: if v==tree.value: branch=tree.tb else: branch=tree.fb ...
code_fim
hard
{ "lang": "python", "repo": "ejla-idrizi/programming-collective-intelligence", "path": "/chapter7/exercise2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ejla-idrizi/programming-collective-intelligence path: /chapter7/exercise2.py # EXERCISE 2: modify function modclassify(observation,tree) on p.157 def mdclassify(observation,tree): <|fim_suffix|> else: if int(v) in allowed_values: if v>=tree.value: branch=tree.tb else: branch=...
code_fim
hard
{ "lang": "python", "repo": "ejla-idrizi/programming-collective-intelligence", "path": "/chapter7/exercise2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if len(self.bag_of_words) == 0: printf('Bag-of-Words empty!') return None tweet_words = [word.lower() for word, tag in tweet_message if word not in stopwords and not word.isdigit()] tweet_tags = [tag[:2] for word, tag in tweet_message if word not in stopwo...
code_fim
hard
{ "lang": "python", "repo": "pedrobalage/SemevalTwitterHybridClassifier2013", "path": "/MachineLearningClassifier.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pedrobalage/SemevalTwitterHybridClassifier2013 path: /MachineLearningClassifier.py # -*- coding: utf-8 -*- #### #### Author: Pedro Paulo Balage Filho #### Version: 1.0 #### Date: 12/03/13 #### # Requires Pattern library (http://www.clips.ua.ac.be/pages/pattern) from pattern.vector import SVM, C...
code_fim
hard
{ "lang": "python", "repo": "pedrobalage/SemevalTwitterHybridClassifier2013", "path": "/MachineLearningClassifier.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alopezna5/mASAPP_CI path: /test/unit/test_cli_method.py import unittest from masappcli.__main__ import * import sys import os class TestCLI(unittest.TestCase): def setUp(self): # Restoring of argv and environ sys.argv = sys.argv[0:1] os.environ.clear() def tearD...
code_fim
hard
{ "lang": "python", "repo": "alopezna5/mASAPP_CI", "path": "/test/unit/test_cli_method.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> expected_message = "Riskscore and standard execution can not being thrown simultaneously" with self.assertRaisesRegex(ValueError, expected_message): self._add_fake_key_and_fake_secret() sys.argv.append("-r") sys.argv.append("9.8") sys.argv.a...
code_fim
hard
{ "lang": "python", "repo": "alopezna5/mASAPP_CI", "path": "/test/unit/test_cli_method.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chenshuo666/cs_data_structure_algorithms path: /cs_data_structure_and_algorithms/linkedlist/likedlist_category/double_linkedlist.py #!/usr/bin/python # -*- coding:utf-8 -*- # Author:Sebastian Williams """Initialize the node, the node includes the currently stored content and a pointer to the nex...
code_fim
hard
{ "lang": "python", "repo": "chenshuo666/cs_data_structure_algorithms", "path": "/cs_data_structure_and_algorithms/linkedlist/likedlist_category/double_linkedlist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ List insert operation :param value: The value to be inserted :param index: The position to be inserted :return: None """ if pos <= 0: self.insert_head(data) elif pos > (self.get_length() - 1): self.insert_append(da...
code_fim
hard
{ "lang": "python", "repo": "chenshuo666/cs_data_structure_algorithms", "path": "/cs_data_structure_and_algorithms/linkedlist/likedlist_category/double_linkedlist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """delete node by data""" if self.is_empty(): return else: cur = self.head if cur.data == data: # If the element of the first node is the element to be deleted if cur.next == None: self.head = N...
code_fim
hard
{ "lang": "python", "repo": "chenshuo666/cs_data_structure_algorithms", "path": "/cs_data_structure_and_algorithms/linkedlist/likedlist_category/double_linkedlist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def p_values(p): ''' values : value | value COMMA values ''' if len(p) == 2: p[0] = (p[1],) else: p[0] = (p[1],) + p[3] def p_datum(p): ''' datum : BOOL | INT | FLOAT | STRING ''' p[0] = p[1] def p_v...
code_fim
hard
{ "lang": "python", "repo": "dyzsr/microdb", "path": "/sql/sqlparser.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dyzsr/microdb path: /sql/sqlparser.py TRING', 'ID', 'SEMICOLON', 'DOT', 'COMMA', 'LPAR', 'RPAR', 'LT', 'LTE', 'GT', 'GTE', 'EQ', 'NE', 'PLUS', 'MINUS', 'MUL', 'DIV', ...
code_fim
hard
{ "lang": "python", "repo": "dyzsr/microdb", "path": "/sql/sqlparser.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dyzsr/microdb path: /sql/sqlparser.py OOLTYPE', 'int' : 'INTTYPE', 'float' : 'FLOATTYPE', 'varchar' : 'VARCHAR', 'nvarchar' : 'NVARCHAR', 'primary' : 'PRIMARY', 'key' : 'KEY', 'from' : 'FROM', 'whe...
code_fim
hard
{ "lang": "python", "repo": "dyzsr/microdb", "path": "/sql/sqlparser.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eldenis/PythonG_ex path: /ejemplos/300.py def si_o_no(pregunta): respuesta="" opciones=["si","s","Si","SI","no","n","No","NO"] while <|fim_suffix|> print "OPCION INCORRECTA!\nLas opciones permitidas son:" print " ".join(opciones),"\n" return "S" in respuesta.upper() r=si_o_no("D...
code_fim
medium
{ "lang": "python", "repo": "eldenis/PythonG_ex", "path": "/ejemplos/300.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print "OPCION INCORRECTA!\nLas opciones permitidas son:" print " ".join(opciones),"\n" return "S" in respuesta.upper() r=si_o_no("Desea ingresar algun dato?: ") print "Respuesta:",r<|fim_prefix|># repo: eldenis/PythonG_ex path: /ejemplos/300.py def si_o_no(pregunta): respuesta="" opcione...
code_fim
medium
{ "lang": "python", "repo": "eldenis/PythonG_ex", "path": "/ejemplos/300.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: scottgit/evidential path: /app/models/claim_hit_keys.py from .db import db from sqlalchemy.orm import relationship from .mixins.track_updates import TrackUpdates from .mixins.common_columns import CommonColumns class ClaimHitKeys(db.Model, CommonColumns, TrackUpdates): <|fim_suffix|> return ...
code_fim
hard
{ "lang": "python", "repo": "scottgit/evidential", "path": "/app/models/claim_hit_keys.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # to_dict functions are for javascript, so camel-case keys def to_dict(self): return { "id": self.id, "claimId": self.claim_id, "keyId": self.key_id, "key": self.get_key_name(), "createdBy": self.created_by, "createdAt": self.created_at, }<|fim_prefix|># rep...
code_fim
medium
{ "lang": "python", "repo": "scottgit/evidential", "path": "/app/models/claim_hit_keys.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # for to_history() keys are for python, and must match attribute key names of the model, so snake-case def to_history(self): return { "claim_id": self.claim_id, "key_id": self.key_id, } # to_dict functions are for javascript, so camel-case keys def to_dict(self): return { ...
code_fim
medium
{ "lang": "python", "repo": "scottgit/evidential", "path": "/app/models/claim_hit_keys.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jmeinken/VillageBuilder path: /alerts/models.py from django.db import models from account.models import Participant <|fim_suffix|> EVENT_TYPE_CHOICES = ( ("add friend", "add friend"), ) affected_participant = models.ForeignKey(Participant, on_delete=models.CASCADE) event_typ...
code_fim
medium
{ "lang": "python", "repo": "jmeinken/VillageBuilder", "path": "/alerts/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> EVENT_TYPE_CHOICES = ( ("add friend", "add friend"), ) affected_participant = models.ForeignKey(Participant, on_delete=models.CASCADE) event_type = models.CharField(max_length=30, choices=EVENT_TYPE_CHOICES, db_index=True) viewed = models.BooleanField(db_index=True) active = ...
code_fim
medium
{ "lang": "python", "repo": "jmeinken/VillageBuilder", "path": "/alerts/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexandrenorman/mixeur path: /territories/models/commune.py # -*- coding: utf-8 -*- from django.db import models from djgeojson.fields import PointField from .epci import Epci from .departement import Departement from core.models import MixeurBaseModel class CommuneQuerySet(models.QuerySet): ...
code_fim
medium
{ "lang": "python", "repo": "alexandrenorman/mixeur", "path": "/territories/models/commune.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @property def rich_name(self): to_return = "" if self.epci: to_return += f"{self.epci} - " to_return += f"{self.inseecode} - " to_return += f"{self.name}" return to_return def __str__(self): return self.rich_name<|fim_prefix|># rep...
code_fim
hard
{ "lang": "python", "repo": "alexandrenorman/mixeur", "path": "/territories/models/commune.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: reus0707/crawlproject-gjypjd path: /gjypjd/zytqwbags.py # -*- coding: utf-8 -*- # 中药提取物备案公示 import pickle import re from selenium import webdriver from gjypjd.utils import * import json import time def main(): option=None mysql_db = DataBase() #配置文件中开启是否无头,生产阶段关闭 if if_headless...
code_fim
hard
{ "lang": "python", "repo": "reus0707/crawlproject-gjypjd", "path": "/gjypjd/zytqwbags.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i, v in reg_dict.items(): reg_search = re.search(v, html) if reg_search is not None: result_json[i] = reg_search.group(1) else: result_json[i] = '' return json.dumps(result_json, ensure_ascii=False) if __name__ == '__main__': main()<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "reus0707/crawlproject-gjypjd", "path": "/gjypjd/zytqwbags.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rogeriosilva-ifpi/teaching-tds-course path: /programacao_estruturada/20192_166/converter_horas.py # entrada horas = int(input('horas: ')) minutos = int(input('minutos: ')) <|fim_suffix|># saida print('Minutos totais:', minutos_totais)<|fim_middle|># processamento minutos_totais = (horas*60) + mi...
code_fim
easy
{ "lang": "python", "repo": "rogeriosilva-ifpi/teaching-tds-course", "path": "/programacao_estruturada/20192_166/converter_horas.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># saida print('Minutos totais:', minutos_totais)<|fim_prefix|># repo: rogeriosilva-ifpi/teaching-tds-course path: /programacao_estruturada/20192_166/converter_horas.py # entrada horas = int(input('horas: ')) minutos = int(input('minutos: ')) <|fim_middle|># processamento minutos_totais = (horas*60) + mi...
code_fim
easy
{ "lang": "python", "repo": "rogeriosilva-ifpi/teaching-tds-course", "path": "/programacao_estruturada/20192_166/converter_horas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_librispeech(): """Summary """ prime_length = 6144 total_length = 16000 * 3 batch_size = 32 n_stages = 6 n_layers_per_stage = 9 n_hidden = 32 filter_length = 2 n_skip = 256 onehot = False sequence_length = get_sequence_length(n_stages, n_layers_per...
code_fim
hard
{ "lang": "python", "repo": "muxgt/pycadl", "path": "/cadl/fastwavenet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: muxgt/pycadl path: /cadl/fastwavenet.py """WaveNet Training and Fast WaveNet Decoding. From the following paper ------------------------ Ramachandran, P., Le Paine, T., Khorrami, P., Babaeizadeh, M., Chang, S., Zhang, Y., … Huang, T. (2017). Fast Generation For Convolutional Autoregressive Model...
code_fim
hard
{ "lang": "python", "repo": "muxgt/pycadl", "path": "/cadl/fastwavenet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Residual blocks with skip connections. for i in range(n_stages * n_layers_per_stage): dilation = 2**(i % n_layers_per_stage) # dilated masked cnn d, init, push = wnu.causal_linear( X=h, n_inputs=n_hidden, n_outputs=n_hidden * 2, ...
code_fim
hard
{ "lang": "python", "repo": "muxgt/pycadl", "path": "/cadl/fastwavenet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>class upload_audio(APIView): def post(self,request,format=None): serializer=RecordingSerializer(data=request.data) if serializer.is_valid(): file_type = str(request.data.get('track')).split('.')[-1] file_type = file_type.lower() name=str(request.data...
code_fim
hard
{ "lang": "python", "repo": "ConstanzaJazme/ProyectoCD2019", "path": "/API_REST/API/genders/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def post(self,request,format=None): serializer=RecordingSerializer(data=request.data) if serializer.is_valid(): file_type = str(request.data.get('track')).split('.')[-1] file_type = file_type.lower() name=str(request.data.get('track')).split('/')[-1]...
code_fim
hard
{ "lang": "python", "repo": "ConstanzaJazme/ProyectoCD2019", "path": "/API_REST/API/genders/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ConstanzaJazme/ProyectoCD2019 path: /API_REST/API/genders/views.py from django.shortcuts import render, get_object_or_404 from django.http import Http404,HttpResponse,HttpResponseRedirect, JsonResponse from django.core.exceptions import ObjectDoesNotExist,MultipleObjectsReturned from rest_framewo...
code_fim
hard
{ "lang": "python", "repo": "ConstanzaJazme/ProyectoCD2019", "path": "/API_REST/API/genders/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(FixedRadiusNNGraph, self).__init__() self.radius = radius self.n_neighbor = n_neighbor self.frnn = FixedRadiusNearNeighbors(radius, n_neighbor) def forward(self, pos, centroids, feat=None): dev = pos.device group_idx = self.frnn(pos, centroids) ...
code_fim
hard
{ "lang": "python", "repo": "Liu-yj0335/ML4PIONS_ATLAS", "path": "/modules/fixed_radius_graph.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dev = pos.device group_idx = self.frnn(pos, centroids) B, N, _ = pos.shape glist = [] for i in range(B): center = torch.zeros((N)).to(dev) center[centroids[i]] = 1 src = group_idx[i].contiguous().view(-1) dst = centroi...
code_fim
hard
{ "lang": "python", "repo": "Liu-yj0335/ML4PIONS_ATLAS", "path": "/modules/fixed_radius_graph.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Liu-yj0335/ML4PIONS_ATLAS path: /modules/fixed_radius_graph.py import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Variable import numpy as np import dgl import dgl.function as fn from dgl.geometry.pytorch import FarthestPointSampler ''' Part of the code...
code_fim
hard
{ "lang": "python", "repo": "Liu-yj0335/ML4PIONS_ATLAS", "path": "/modules/fixed_radius_graph.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sophiaas/DeepSparseCoding path: /utils/training.py import matplotlib matplotlib.use("Agg") import numpy as np import tensorflow as tf import json as js import params.param_picker as pp import models.model_picker as mp import data.data_selector as ds def train_mod(data, params, schedule): ##...
code_fim
hard
{ "lang": "python", "repo": "sophiaas/DeepSparseCoding", "path": "/utils/training.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ## Plot weights & gradients if (current_step % model.gen_plot_int == 0 and model.gen_plot_int > 0): model.generate_plots(input_data=input_data, input_labels=input_labels) ## Checkpoint if (current_step...
code_fim
hard
{ "lang": "python", "repo": "sophiaas/DeepSparseCoding", "path": "/utils/training.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sam[loc]=[] sam[loc].append(mir) else: sam[loc].append(mir) n=0 v=0 for i in loci: if i in sam.keys(): n=n+1 g.write(i+"\t"+(":".join(str(p) for p in sam[i])+"\n")) else: v=v+1 g.write(i+"\tnot found\n") print 'mirs found=', n, 'not found=', v<|fim_prefix|># repo: theo-allnutt-bioinfo...
code_fim
hard
{ "lang": "python", "repo": "theo-allnutt-bioinformatics/scripts", "path": "/sam4map.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: theo-allnutt-bioinformatics/scripts path: /sam4map.py #!/usr/bin/env python import sys import re import glob digits = re.compile(r'(\d+)') def tokenize(filename): return tuple(int(token) if match else token for token, match in ((fragment, digits.search(frag...
code_fim
medium
{ "lang": "python", "repo": "theo-allnutt-bioinformatics/scripts", "path": "/sam4map.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> out_images = list() for img, m, s in zip(img_group, self.mean, self.std): if len(m) == 1: img = img - np.array(m) # single channel image img = img / np.array(s) else: img = img - np.array(m)[np.newaxis, np.newaxis, .....
code_fim
hard
{ "lang": "python", "repo": "AigizK/ailia-models", "path": "/image_segmentation/codes-for-lane-detection/erfnet_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gudrunstummer/flash_card_project path: /main.py from tkinter import * import random import pandas BACKGROUND_COLOR = "#B1DDC6" current_card = {} to_learn = {} # -----------------ACCESSING DATA SECTION --------------------------# # Python attempts to open words_to_learn.csv. At first use this d...
code_fim
hard
{ "lang": "python", "repo": "gudrunstummer/flash_card_project", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def flip_card(): canvas.itemconfig(card_title, text="English", fill="white") canvas.itemconfig(card_word, text=current_card["English"], fill="white") canvas.itemconfig(canvas_image, image=back_img) def is_known(): to_learn.remove(current_card) data = pandas.DataFrame(to_learn) d...
code_fim
hard
{ "lang": "python", "repo": "gudrunstummer/flash_card_project", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Sum1=0 Sum2=0 xi = 0 i = 1 dx = float(self.b-self.a)/self.n while i <=self.n-1: xi=self.a+i*(dx) Sum1 = Sum1 + self.fun.evalFunction(xi) Ox = np.arange(self.a+(i-1)*dx,xi+dx, 0.02) Oy = [] for j in Ox: Oy.append(self.px(j,self.a+(i-1)*dx,xi,xi+dx)) self.ax.plot(Ox, Oy,col...
code_fim
medium
{ "lang": "python", "repo": "joalcava/College-projects", "path": "/Metodos Numericos 2012/simpson1_3Compuesto.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: joalcava/College-projects path: /Metodos Numericos 2012/simpson1_3Compuesto.py import function from matplotlib.pyplot import * from pylab import * import numpy as np import math class Simpson13Comp: def __init__(self, fun, xi, xf,n): self.fun = function.Function(fun,'x') self.a,self.b = xi,...
code_fim
medium
{ "lang": "python", "repo": "joalcava/College-projects", "path": "/Metodos Numericos 2012/simpson1_3Compuesto.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hyunjongpark/learningTrade path: /source/util/macd_tester.py # -*- coding: utf-8 -*- from __future__ import division import os, sys import matplotlib.pyplot as plt from sklearn.ensemble import RandomForestClassifier from sklearn.linear_model import LogisticRegression from sklearn.svm import Line...
code_fim
hard
{ "lang": "python", "repo": "hyunjongpark/learningTrade", "path": "/source/util/macd_tester.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def make_best_macd_value_all_kospi(self, start, end, last_day_sell=True): data = load_yaml(services.get('configurator').get('stock_list')) index = 0 for code, value in data: print('%s/%s , code: %s' % (index, len(data), code)) success, profit, fastperi...
code_fim
hard
{ "lang": "python", "repo": "hyunjongpark/learningTrade", "path": "/source/util/macd_tester.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sele = Selector(text=html) results = sele.css('.default-list-item.clearfix') for each in results: print('='*100) url = each.css('a::attr(href)').get() name = each.css('.list-item-desc-top a::text').get() review = each.css('.item-eval-...
code_fim
hard
{ "lang": "python", "repo": "crazyhubox/tools_weather", "path": "/weather/meituan.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: crazyhubox/tools_weather path: /weather/meituan.py #!/usr/local/bin/python3 # encoding:utf-8 import requests import re import time from scrapy.selector import Selector from selenium import webdriver from urllib.parse import urljoin # some = sele.css('#react').get() class Meituan: o...
code_fim
hard
{ "lang": "python", "repo": "crazyhubox/tools_weather", "path": "/weather/meituan.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: base_url = self.enter_city() name= input('哥们,要找什么?') url_0 = f'/s/{name}/' url = 'https:'+urljoin(base_url,url_0) print(url) self.driver.get(url) while True: html = self.driver.page_source ...
code_fim
hard
{ "lang": "python", "repo": "crazyhubox/tools_weather", "path": "/weather/meituan.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>accuracy=clf.score(x_test,y_test) print(accuracy) #0.74025974026<|fim_prefix|># repo: gagicha/machine_learning path: /diabetes classification(KNN).py # https://archive.ics.uci.edu/ml/datasets/pima+indians+diabetes import pandas as pd import numpy as np from sklearn import model_selection, neighbors #to ...
code_fim
hard
{ "lang": "python", "repo": "gagicha/machine_learning", "path": "/diabetes classification(KNN).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x_train, x_test, y_train, y_test= model_selection.train_test_split(x,y,test_size=0.2) clf=neighbors.KNeighborsClassifier() #IF K NOT MENTIONED , AUTOMATICALLY TAKE K AS 5 clf.fit(x_train, y_train) accuracy=clf.score(x_test,y_test) print(accuracy) #0.74025974026<|fim_prefix|># repo: gagicha/machine_learn...
code_fim
medium
{ "lang": "python", "repo": "gagicha/machine_learning", "path": "/diabetes classification(KNN).py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gagicha/machine_learning path: /diabetes classification(KNN).py # https://archive.ics.uci.edu/ml/datasets/pima+indians+diabetes import pandas as pd import numpy as np from sklearn import model_selection, neighbors #to the uci dataset we add the attributes row and then use that in this example. d...
code_fim
medium
{ "lang": "python", "repo": "gagicha/machine_learning", "path": "/diabetes classification(KNN).py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shachar1000/flask-rubix path: /app.py from flask import Flask, send_file, render_template, request, jsonify, make_response, Response, url_for, session import cv2 import base64 import numpy as np import io from PIL import Image from reddit import detect import json #from flask_scss import Scss fro...
code_fim
hard
{ "lang": "python", "repo": "shachar1000/flask-rubix", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'POST': listOfMatrices = request.get_json()['storeColors'] matrixString = ''.join([''.join(''.join(x[0] for x in y) for y in matrix) for matrix in listOfMatrices]) #only first letter passCode = ''.join(random.choice(string.ascii_lowercase) for _ in range(4)...
code_fim
hard
{ "lang": "python", "repo": "shachar1000/flask-rubix", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Daishijun/InterviewAlgorithmCoding path: /kuaishou1.py # -*- coding: utf-8 -*- # @Date : 2019/4/13 # @Time : 16:19 # @Author : Daishijun # @File : kuaishou1.py # Software : PyCharm <|fim_suffix|> m=[[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)] #生成0矩阵,为方便后续计算,比字符串长度多了一列...
code_fim
hard
{ "lang": "python", "repo": "Daishijun/InterviewAlgorithmCoding", "path": "/kuaishou1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def find_lcsubstr(s1, s2): #输出长公共子串,长度. m=[[0 for i in range(len(s2)+1)] for j in range(len(s1)+1)] #生成0矩阵,为方便后续计算,比字符串长度多了一列 mmax=0 #最长匹配的长度 p=0 #最长匹配对应在s1中的最后一位 for i in range(len(s1)): for j in range(len(s2)): if s1[i]==s2[j]: m[i+1][j+1]=m[i][j...
code_fim
hard
{ "lang": "python", "repo": "Daishijun/InterviewAlgorithmCoding", "path": "/kuaishou1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenyuwong1/biosys-analytics path: /assignments/03-python-hello/vowel_counter.py #!/usr/bin/env python3 # Author: wwong3 (Wen Yu Amy Wong) # Date: 2019-Jan-31 # Purpose: 03-python Vowel_Counter Homework """vowel_counter""" import os import sys <|fim_suffix|> count=0 vow...
code_fim
hard
{ "lang": "python", "repo": "wenyuwong1/biosys-analytics", "path": "/assignments/03-python-hello/vowel_counter.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): args = sys.argv[1:] word=args if len(word) == 0: print('Usage: {} STRING'.format(os.path.basename(sys.argv[0]))) sys.exit(1) elif len(word) != 0: word=str(word[0]) ### Used to set the argument word to a string instead of a list def vowe...
code_fim
medium
{ "lang": "python", "repo": "wenyuwong1/biosys-analytics", "path": "/assignments/03-python-hello/vowel_counter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def set_values_from_description(self): matches = self.pattern.findall(self.description) self.name = matches[0][0] self.speed = int(matches[0][1]) self.stamina = int(matches[0][2]) self.rest = int(matches[0][3]) def __str__(self): return "%s can fly ...
code_fim
hard
{ "lang": "python", "repo": "alkemann/advent2015-py3", "path": "/advent/fourteen/Reindeer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alkemann/advent2015-py3 path: /advent/fourteen/Reindeer.py import re class Reindeer: # "Comet can fly 14 km/s for 10 seconds, but then must rest for 127 seconds." pattern = re.compile("(\w+) can fly (\d+) km/s for (\d+) seconds, but then must rest for (\d+) seconds.") def __init__...
code_fim
hard
{ "lang": "python", "repo": "alkemann/advent2015-py3", "path": "/advent/fourteen/Reindeer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.flying: self.distance += self.speed self.stamina_left -= 1 if self.stamina_left == 0: self.flying = False self.rest_left = self.rest else: self.rest_left -= 1 if self.rest_left == 0: ...
code_fim
hard
{ "lang": "python", "repo": "alkemann/advent2015-py3", "path": "/advent/fourteen/Reindeer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: danielf/contest-tools path: /input_gen.py import sys import re import math import random import operator from collections import defaultdict class colors: HEADER = '\033[95m' FAIL = '\033[91m' ENDC = '\033[0m' BOLD = '\033[1m' UNDERLINE = '\033[4m' def err(message): pri...
code_fim
hard
{ "lang": "python", "repo": "danielf/contest-tools", "path": "/input_gen.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert str_type in self.TYPES self.scope, self.name, self.str_type = scope, name, str_type self.length, self.alphabet = re.match(self.SPEC, spec).groups() self.charset = [chr(ch) for ch in xrange(0, 256) if re.match(self.alphabet, chr(ch))] def dependencies(self): ...
code_fim
hard
{ "lang": "python", "repo": "danielf/contest-tools", "path": "/input_gen.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tusharrakshe/Template-Based-OCR path: /API/Accuracy_Evaluation.py from spellchecker import SpellChecker spell = SpellChecker() import spacy import nltk #python -m spacy download en_core_web_sm import en_core_web_sm nlp = en_core_web_sm.load() import re <|fim_suffix|> Text_file = file_name ...
code_fim
medium
{ "lang": "python", "repo": "tusharrakshe/Template-Based-OCR", "path": "/API/Accuracy_Evaluation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Text_file = file_name with open(Text_file, mode='r') as file: Text = file.read() Percentage_Extraction = round(sum([len(word) for word in nltk.word_tokenize(Text)])/len(Text),2) text = re.sub('[^A-Za-z0-9]+', ' ', Text) # misspelled = spell.unknown(preprocessing(Text_Cl...
code_fim
medium
{ "lang": "python", "repo": "tusharrakshe/Template-Based-OCR", "path": "/API/Accuracy_Evaluation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return {'cats': Category.objects.all(), 'act_cat': cat}<|fim_prefix|># repo: KirrageW/ITER path: /rango/templatetags/rango_template_tags.py from django import template from rango.models import Category <|fim_middle|>register = template.Library() @register.inclusion_tag('rango/cats.html'...
code_fim
medium
{ "lang": "python", "repo": "KirrageW/ITER", "path": "/rango/templatetags/rango_template_tags.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KirrageW/ITER path: /rango/templatetags/rango_template_tags.py from django import template from rango.models import Category register = template.Library() <|fim_suffix|> return {'cats': Category.objects.all(), 'act_cat': cat}<|fim_middle|>@register.inclusion_tag('rango/cats.html'...
code_fim
medium
{ "lang": "python", "repo": "KirrageW/ITER", "path": "/rango/templatetags/rango_template_tags.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_hdf5_bool(): """test_hdf5_bool: GitHub issue 1144""" runpath = tempfile.mkdtemp() boolean_data = np.asarray( [True, False, True, False, True, False, True, False, True, False] ) with h5py.File(f"{runpath}/my_data.h5", "w") as h5_obj: h5_obj["my_bool_data"] = ...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/io", "path": "/tests/test_hdf5.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tensorflow/io path: /tests/test_hdf5.py # Copyright 2020 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 # # http://ww...
code_fim
hard
{ "lang": "python", "repo": "tensorflow/io", "path": "/tests/test_hdf5.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nahomiiiie/SFI_2019 path: /run.py # insert parameters for run # wrtie, read file, come from command line # add everythign from file, same sequence of things # plot ot file and add? matplotlib """ import math from enum import Enum import networkx as nx <|fim_suffix|>main = IdeaSpread(100, .18, .7...
code_fim
medium
{ "lang": "python", "repo": "nahomiiiie/SFI_2019", "path": "/run.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>main = IdeaSpread(100, .18, .71, 18, 22) main.run(2)<|fim_prefix|># repo: nahomiiiie/SFI_2019 path: /run.py # insert parameters for run # wrtie, read file, come from command line # add everythign from file, same sequence of things # plot ot file and add? matplotlib """ import math from enum import Enum ...
code_fim
medium
{ "lang": "python", "repo": "nahomiiiie/SFI_2019", "path": "/run.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: a0911802160/ML2018FALL path: /hw3/hw3_test.py import numpy as np import pandas as pd import csv import math from keras.models import load_model from keras import backend as k import sys data = pd.read_csv(sys.argv[1], delimiter=',') x = np.array(data.iloc[:, 1]) test_x = [] for id...
code_fim
medium
{ "lang": "python", "repo": "a0911802160/ML2018FALL", "path": "/hw3/hw3_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for idx in range(len(test_x)): ans.append(str(idx)+',') ans[idx] += str(label[idx][0]) with open(sys.argv[2], 'w+') as pred_file: pred_file.write('id,label\n') for idx in range(len(ans)): pred_file.write(ans[idx]+'\n')<|fim_prefix|># repo: a0911802160/ML2018FALL path: /hw3...
code_fim
hard
{ "lang": "python", "repo": "a0911802160/ML2018FALL", "path": "/hw3/hw3_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ans = [] for idx in range(len(test_x)): ans.append(str(idx)+',') ans[idx] += str(label[idx][0]) with open(sys.argv[2], 'w+') as pred_file: pred_file.write('id,label\n') for idx in range(len(ans)): pred_file.write(ans[idx]+'\n')<|fim_prefix|># repo: a0911802160/ML2018FALL...
code_fim
medium
{ "lang": "python", "repo": "a0911802160/ML2018FALL", "path": "/hw3/hw3_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- file_list : list List of files matching the query. """ authorize_google_drive() query = "'{}' in parents and title contains '{}' and trashed=false".format( parent_id, child_name ) file_list = DRIVE.ListFile( {'q': query} ).GetLis...
code_fim
hard
{ "lang": "python", "repo": "bmcfee/medleydb", "path": "/medleydb/download.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmcfee/medleydb path: /medleydb/download.py #!/usr/bin/env python # -*- coding: utf-8 -*- """Methods for downloading audio from google drive.""" from medleydb import MEDLEYDB_PATH from medleydb import AUDIO_PATH from medleydb import GRDIVE_CONFIG_PATH from medleydb import METADATA_PATH from medle...
code_fim
hard
{ "lang": "python", "repo": "bmcfee/medleydb", "path": "/medleydb/download.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('POST', '0004_auto_20200115_1542'), ] operations = [ migrations.RenameField( model_name='posts', old_name='tittle', new_name='title', ), ]<|fim_prefix|># repo: badilladrian/djangoPractices path: /TODO/djangopr...
code_fim
medium
{ "lang": "python", "repo": "badilladrian/djangoPractices", "path": "/TODO/djangoproject/POST/migrations/0005_auto_20200115_1621.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: badilladrian/djangoPractices path: /TODO/djangoproject/POST/migrations/0005_auto_20200115_1621.py # Generated by Django 3.0 on 2020-01-15 22:21 from django.db import migrations <|fim_suffix|> dependencies = [ ('POST', '0004_auto_20200115_1542'), ] operations = [ mi...
code_fim
easy
{ "lang": "python", "repo": "badilladrian/djangoPractices", "path": "/TODO/djangoproject/POST/migrations/0005_auto_20200115_1621.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ali-rajabli/etinatStakan path: /products_app/migrations/0005_auto_20210525_1124.py # Generated by Django 2.2.23 on 2021-05-25 11:24 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('products_app', '0004_auto_20210525_0857'), ] ...
code_fim
hard
{ "lang": "python", "repo": "ali-rajabli/etinatStakan", "path": "/products_app/migrations/0005_auto_20210525_1124.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> serialize=False, verbose_name='ID')), ('text_ru', models.TextField(verbose_name='Оплата')), ], options={ 'verbose_name': 'Оплата', 'verbose_name_plural': 'Оплата', }, ), migrations.AlterModelOptions( ...
code_fim
hard
{ "lang": "python", "repo": "ali-rajabli/etinatStakan", "path": "/products_app/migrations/0005_auto_20210525_1124.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>me='ID')), ('text_ru', models.TextField(verbose_name='Минимальный заказ')), ], options={ 'verbose_name': 'Минимальный заказ', 'verbose_name_plural': 'Минимальный заказ', }, ), migrations.CreateModel( ...
code_fim
hard
{ "lang": "python", "repo": "ali-rajabli/etinatStakan", "path": "/products_app/migrations/0005_auto_20210525_1124.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: akhlaque-ak/pfun path: /reference files/Reference Files/Lab 3/Exercise_3_1/Exercise_3_1_2__pyde/Exercise_3_1_2__pyde.pyde def setup(): size(500, 500) count = 0 c = 0 x = 0 def draw(): global count global c global x frameRate(3<|fim_suffix|> fill(255) ...
code_fim
medium
{ "lang": "python", "repo": "akhlaque-ak/pfun", "path": "/reference files/Reference Files/Lab 3/Exercise_3_1/Exercise_3_1_2__pyde/Exercise_3_1_2__pyde.pyde", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fill(255) ellipse(250, 250, i, i) count = count + 1 # Extra ''' frameRate(10); if (c%2==0): fill(0); ellipse(250,250,x,x) else: fill(255) ellipse(250,250,x,x) x=x+10 c=c+3 '''<|fim_prefix|># repo: ak...
code_fim
medium
{ "lang": "python", "repo": "akhlaque-ak/pfun", "path": "/reference files/Reference Files/Lab 3/Exercise_3_1/Exercise_3_1_2__pyde/Exercise_3_1_2__pyde.pyde", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: PUT-Motorsport/PUTM_EV_Dataviewer path: /src/generate_testing_csv.py from random import randint with open("/home/czarnobylu/.files/testing.csv",'w') as f: f.write("RISING,FALLING,RANDOM\n") range_size<|fim_suffix|>range_size-i-1)+","+str(randint(0,1000))+"," f.write(a[:-1]+'\n')<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "PUT-Motorsport/PUTM_EV_Dataviewer", "path": "/src/generate_testing_csv.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>range_size-i-1)+","+str(randint(0,1000))+"," f.write(a[:-1]+'\n')<|fim_prefix|># repo: PUT-Motorsport/PUTM_EV_Dataviewer path: /src/generate_testing_csv.py from random import randint with open("/home/czarnobylu/.files/testing.csv",'w') as f: f.write("RISING,FALLING,RANDOM\n") range_size<|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "PUT-Motorsport/PUTM_EV_Dataviewer", "path": "/src/generate_testing_csv.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RaptorPatrolContinuum/An path: /Delta Func/IO Testing.py Testtext = open("IOTest.txt","r+") ''' what do I need: get last line write new lines ''' <|fim_suffix|> """Reads a n lines from f with an offset of offset lines.""" avg_line_length = 74 to_read = n + offset while 1: ...
code_fim
medium
{ "lang": "python", "repo": "RaptorPatrolContinuum/An", "path": "/Delta Func/IO Testing.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Reads a n lines from f with an offset of offset lines.""" avg_line_length = 74 to_read = n + offset while 1: try: f.seek(-(avg_line_length * to_read), 2) except IOError: # woops. apparently file is smaller than what we want # to step ...
code_fim
medium
{ "lang": "python", "repo": "RaptorPatrolContinuum/An", "path": "/Delta Func/IO Testing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": covariance_matrix = torch.tensor( [ [1.0, 0.5, 0.5, 0.5], [0.5, 1.0, 0.5, 0.5], [0.5, 0.5, 1.0, 0.5], [0.5, 0.5, 0.5, 1.0], ] ) gaussian_copula = GaussianCopula(covariance_matrix=covariance_matrix) ...
code_fim
hard
{ "lang": "python", "repo": "ShengGuanWSU/CopulaGNN", "path": "/copula.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": covariance_matrix = torch.tensor( [ [1.0, 0.5, 0.5, 0.5], [0.5, 1.0, 0.5, 0.5], [0.5, 0.5, 1.0, 0.5], [0.5, 0.5, 0.5, 1.0], ] ) gaussian_copula = GaussianCopula(covariance_matrix=covariance_matrix) c...
code_fim
hard
{ "lang": "python", "repo": "ShengGuanWSU/CopulaGNN", "path": "/copula.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ShengGuanWSU/CopulaGNN path: /copula.py import math import torch from torch.distributions import constraints from torch.distributions.distribution import Distribution from torch.distributions.multivariate_normal import ( MultivariateNormal, _batch_mahalanobis, ) def _standard_normal_qu...
code_fim
hard
{ "lang": "python", "repo": "ShengGuanWSU/CopulaGNN", "path": "/copula.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aongenae/leetcode path: /src/set_matrix_zeroes.py #!/usr/bin/env python3 ################################################################################ # # Filename: set_matrix_zeroes.py # # Author: Arnaud Ongenae # # Leetcode.com: problem #73 # # Problem des...
code_fim
hard
{ "lang": "python", "repo": "aongenae/leetcode", "path": "/src/set_matrix_zeroes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> col_has_zeroes = any( r+1 for r in range(0, nb_rows) if matrix[r][0] == 0 ) if nb_rows == 1: if row_has_zeroes: self._nullify_row(matrix, 0) return if nb_cols == 1: if col_has_zeroes: ...
code_fim
hard
{ "lang": "python", "repo": "aongenae/leetcode", "path": "/src/set_matrix_zeroes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Test a a simple foreach statement.""" r = convert_code( "{foreach item=bar from=foo }content{/foreach}") assert r == "{% for bar in foo %}content{% endfor %}" def test_old_for_statement_name(): """Test a more complex foreach statement.""" r = convert_code( "{foreac...
code_fim
hard
{ "lang": "python", "repo": "Osso/smartytotwig", "path": "/tests/test_smarty_grammar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r = convert_code("{if foo($bar1, $bar2)}\nhello\n{/if}") assert r == "{% if foo(bar1, bar2) %}\nhello\n{% endif %}" def test_if_statement_multiple(): """Test an if statement (no else or elseif)""" r = convert_code( "{if !foo or foo.bar or foo|bar:foo['hello']}\nfoo\n{/if}") a...
code_fim
hard
{ "lang": "python", "repo": "Osso/smartytotwig", "path": "/tests/test_smarty_grammar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }