text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> if self.isSelected() & self.corner_rect().contains(event.pos().toPoint()): self.setCursor(Qt.SizeFDiagCursor) else: self.setCursor(Qt.ArrowCursor) super().hoverMoveEvent(event) def mousePressEvent(self, event: QMouseEvent): """ override mouse P...
code_fim
hard
{ "lang": "python", "repo": "mdalboni/PySide2-Widgets", "path": "/widgets/resizable_rect_item.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sean-Huang65/NLP-tutorial path: /model.py import torch.nn as nn import torch from torch.nn import functional as F from config import * class EncoderRNN(nn.Module): def __init__(self, input_size, hidden_size, n_layers=1, model_name='rnn'): super(EncoderRNN, self).__init__() ...
code_fim
hard
{ "lang": "python", "repo": "Sean-Huang65/NLP-tutorial", "path": "/model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class biEncoderLSTM(nn.Module): def __init__(self, input_size, hidden_size, n_layers=1): super(biEncoderLSTM, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.n_layers = n_layers self.embedding = nn.Embedding(i...
code_fim
hard
{ "lang": "python", "repo": "Sean-Huang65/NLP-tutorial", "path": "/model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, hidden_size, output_size, n_layers=1, dropout_p=0.1, model_name='rnn'): super(biDecoderLSTM, self).__init__() # Keep parameters for reference self.hidden_size = hidden_size self.output_size = output_size self.n_layers = n_layers ...
code_fim
hard
{ "lang": "python", "repo": "Sean-Huang65/NLP-tutorial", "path": "/model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(f' {fonte.green("Código do aluno:")} {self.codigo}\n' f' {fonte.green("Nome:")} {self.nome}\n' f' {fonte.green("Matrícula:")} {self.matricula}\n' f' {fonte.green("Ano:")} {self.ano}')<|fim_prefix|># repo: senac-repos/Senac_2021-01_ALG2 p...
code_fim
medium
{ "lang": "python", "repo": "senac-repos/Senac_2021-01_ALG2", "path": "/Atividades/Atividade2/Classes/AlunoEnsinoMedio.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: senac-repos/Senac_2021-01_ALG2 path: /Atividades/Atividade2/Classes/AlunoEnsinoMedio.py from Atividades.Atividade2.Classes.Aluno import Aluno from ClassesAuxiliares.FormatFonts import FormatFonts fonte = FormatFonts() <|fim_suffix|> Aluno.__init__(self, codigo, nome, matricula) s...
code_fim
medium
{ "lang": "python", "repo": "senac-repos/Senac_2021-01_ALG2", "path": "/Atividades/Atividade2/Classes/AlunoEnsinoMedio.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class AlunoEnsinoMedio(Aluno): def __init__(self, codigo, nome, matricula, ano): Aluno.__init__(self, codigo, nome, matricula) self.ano = ano def imprimir(self): print(f' {fonte.green("Código do aluno:")} {self.codigo}\n' f' {fonte.green("Nome:")} {self...
code_fim
medium
{ "lang": "python", "repo": "senac-repos/Senac_2021-01_ALG2", "path": "/Atividades/Atividade2/Classes/AlunoEnsinoMedio.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class PatcherCollection: def __init__(self): self.patchers = [] def __enter__(self): for patcher in self.patchers: patcher.__enter__() def __exit__(self, exc_type, exc_value, traceback): for patcher in self.patchers: patcher.__exit__(exc_type, ...
code_fim
medium
{ "lang": "python", "repo": "cloudfoundry/php-buildpack", "path": "/tests/common/dingus_extension.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __enter__(self): for patcher in self.patchers: patcher.__enter__() def __exit__(self, exc_type, exc_value, traceback): for patcher in self.patchers: patcher.__exit__(exc_type, exc_value, traceback) def add_patcher(self, patcher): self.patch...
code_fim
medium
{ "lang": "python", "repo": "cloudfoundry/php-buildpack", "path": "/tests/common/dingus_extension.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloudfoundry/php-buildpack path: /tests/common/dingus_extension.py from dingus import patch def patches(patch_values): patcher_collection = PatcherCollection() for object_path, new_object in patch_values.iteritems(): patcher_collection.add_patcher(patch(object_path, new_object)...
code_fim
hard
{ "lang": "python", "repo": "cloudfoundry/php-buildpack", "path": "/tests/common/dingus_extension.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # net.para = x1 * net2.para + x2 * net.para + b for (k, v) , (k2, v2) in zip( net.collect_params().items() , net2.collect_params().items() ): v.set_data(v2.data() * x1 + v.data() * x2 + b) # train def test(): metric = mx.metric.Accuracy() for data, label in val_data: X...
code_fim
hard
{ "lang": "python", "repo": "bdus/programpractice", "path": "/mxnet/mnist_semi/semi/train_mt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bdus/programpractice path: /mxnet/mnist_semi/semi/train_mt.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Dec 14 12:46:58 2018 @author: bdus baseline: https://github.com/bdus/programpractice/blob/master/mxnet/mnist_semi/supervised/experiments/finetune/train_finetune.py me...
code_fim
hard
{ "lang": "python", "repo": "bdus/programpractice", "path": "/mxnet/mnist_semi/semi/train_mt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#net.load_parameters(os.path.join('symbols','para','%s.params'%(modelname))) # g(x) : stochastic input augmentation function def g(x): return x + nd.random.normal(0,stochastic_ratio,shape=x.shape) # loss function l_logistic = gloss.SoftmaxCrossEntropyLoss() l_l2loss = gloss.L2Loss() metric = mx.me...
code_fim
hard
{ "lang": "python", "repo": "bdus/programpractice", "path": "/mxnet/mnist_semi/semi/train_mt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: freesan44/LeetCode path: /LeetCode_1913.py class Solution: def maxProductDifference(self, nums: List[int]) -> int: <|fim_suffix|>if __name__ == '__main__': nums = [4,2,5,9,7,4,8] ret = Solution().maxProductDifference(nums) print(ret)<|fim_middle|> nums.sort() # prin...
code_fim
medium
{ "lang": "python", "repo": "freesan44/LeetCode", "path": "/LeetCode_1913.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': nums = [4,2,5,9,7,4,8] ret = Solution().maxProductDifference(nums) print(ret)<|fim_prefix|># repo: freesan44/LeetCode path: /LeetCode_1913.py class Solution: def maxProductDifference(self, nums: List[int]) -> int: <|fim_middle|> nums.sort() # prin...
code_fim
medium
{ "lang": "python", "repo": "freesan44/LeetCode", "path": "/LeetCode_1913.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tommydenton/tinkering path: /IOT/weatherDisplay/weatherDisplay.py import os, syslog import pygame import time import datetime import pywapi import string # Weather Icons used with the following permissions: # # VClouds Weather Icons # Created and copyrighted by VClouds - http://vclouds.deviantar...
code_fim
hard
{ "lang": "python", "repo": "tommydenton/tinkering", "path": "/IOT/weatherDisplay/weatherDisplay.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sfn = pygame.font.match_font('freemono') suplargeFont = pygame.font.SysFont( fn, 50) largeFont = pygame.font.SysFont( fn, 44) medFont = pygame.font.Font(fn, 20) smallFont = pygame.font.SysFont( sfn, 18) supsmallFont = pygame.font.SysFont( sfn, 13) forcastFont = pygame.font.Font...
code_fim
hard
{ "lang": "python", "repo": "tommydenton/tinkering", "path": "/IOT/weatherDisplay/weatherDisplay.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strogo/lre path: /python/lre/test/test_serialization.py import unittest import lre # Disable preallocated buffer newlre = lre.LRE(0) lre.dumps = newlre.pack lre.loads = newlre.load class TestOrder(unittest.TestCase): def testTypes(self): l1 = [float('-inf'), -10.5, -1, 0, 1, 10.5, ...
code_fim
hard
{ "lang": "python", "repo": "strogo/lre", "path": "/python/lre/test/test_serialization.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> l1 = [-0.999, -0.995, -0.8001, -0.1234, 0, 0.1, 0.1, 0.101, 0.801] l2 = sorted(l1, key=lre.dumps) self.assertEqual(l1, l2, 'invalid order') def testSortingString(self): l1 = [['00', 2], ['000', 3]] l2 = sorted(l1, key=lre.dumps) self.assertEqual(l1, l2,...
code_fim
hard
{ "lang": "python", "repo": "strogo/lre", "path": "/python/lre/test/test_serialization.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: yjs1210/cardcounting path: /tests/test_hand.py import pytest import os import sys ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "..") sys.path.append(os.path.join(ROOT, "src")) from blackjack import Deck, Hand, Cards, HandTypes def test_hand_basic_functions(): deck = Deck...
code_fim
hard
{ "lang": "python", "repo": "yjs1210/cardcounting", "path": "/tests/test_hand.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> hand.delete_card(Cards.ACE) hand_type, aces, lower_bound, upper_bound = hand.parse_hand() assert hand_type == HandTypes.HARD assert lower_bound == 12 assert upper_bound == 12 hand = Hand([Cards.TWO, Cards.TWO]) hand_type, aces, lower_bound, upper_bound = hand.parse_hand() ...
code_fim
hard
{ "lang": "python", "repo": "yjs1210/cardcounting", "path": "/tests/test_hand.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def welcome(self,friend): print(self.name,"的朋友是",friend) def __gender(self): print("性别是",self.__sex)<|fim_prefix|># repo: Teddy2007/myturtle path: /Person.py class Person: def __init__(self,name,age,sex): self.name=name self.age=age self.__sex="男" ...
code_fim
medium
{ "lang": "python", "repo": "Teddy2007/myturtle", "path": "/Person.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Teddy2007/myturtle path: /Person.py class Person: def __init__(self,name,age,sex): <|fim_suffix|> def myage(self): print("I am",self.age,"years old") def welcome(self,friend): print(self.name,"的朋友是",friend) def __gender(self): print("性别是",self.__sex)<|fim_...
code_fim
medium
{ "lang": "python", "repo": "Teddy2007/myturtle", "path": "/Person.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def myage(self): print("I am",self.age,"years old") def welcome(self,friend): print(self.name,"的朋友是",friend) def __gender(self): print("性别是",self.__sex)<|fim_prefix|># repo: Teddy2007/myturtle path: /Person.py class Person: def __init__(self,name,age,sex): ...
code_fim
medium
{ "lang": "python", "repo": "Teddy2007/myturtle", "path": "/Person.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print sudoku.updateFactor(BOX, 0) sudoku = sudoku.setVariable(0, 0, 8) print sudoku.row(0) print sudoku.updateAllFactors() print sudoku.updateVariableFactors((1, 2)) print sudoku.getSuccessors() solveCSP(Sudoku(boardEasy))<|fim_prefix|># repo: Bryanlee99/CS182 path: /sudoku/Testing.py from sudoku i...
code_fim
easy
{ "lang": "python", "repo": "Bryanlee99/CS182", "path": "/sudoku/Testing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bryanlee99/CS182 path: /sudoku/Testing.py from sudoku import * sudoku = Sudoku(boardHard) sudoku.board print sudoku.box(0) <|fim_suffix|>print sudoku.updateFactor(BOX, 0) sudoku = sudoku.setVariable(0, 0, 8) print sudoku.row(0) print sudoku.updateAllFactors() print sudoku.updateVariab...
code_fim
easy
{ "lang": "python", "repo": "Bryanlee99/CS182", "path": "/sudoku/Testing.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i_code_B_avg = np.mean(np.array(i_code_B), axis=0) #i_code_B_var = np.sqrt(np.var(np.array(i_code_B), axis=0)) #i_code_B_up = i_code_B_avg + i_code_B_var #i_code_B_down = i_code_B_avg - i_code_B_var i_code_B_up = np.ndarray.max(np.array(i_code_B), axis=0) i_code_B_down = np.nd...
code_fim
hard
{ "lang": "python", "repo": "kevin105150/EMG_Analysis", "path": "/analysis_dl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kevin105150/EMG_Analysis path: /analysis_dl.py # -*- coding: utf-8 -*- """ Created on Sat Mar 6 15:19:18 2021 @author: csyu """ import os import numpy as np import csv import dictlearn as dl import matplotlib.pyplot as plt import matplotlib matplotlib.use('Agg') import tkinter as...
code_fim
hard
{ "lang": "python", "repo": "kevin105150/EMG_Analysis", "path": "/analysis_dl.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: duarte28nm/SR1 path: /MMC/server.py # server.py import socket # calcular peso def CalcI(peso, altura): if (altura <= 2.5): # altura menor que 2.5m imc = round(peso / (altura * altura), 1) return imc else: imc = round(peso * 10000 / (altura * altura), 1) <|fi...
code_fim
medium
{ "lang": "python", "repo": "duarte28nm/SR1", "path": "/MMC/server.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># obter o nome da máquina local host = socket.gethostname() port = 9999 # vincular à porta serversocket.bind((host, port)) # enfileira até 5 solicitações serversocket.listen(5) while True: # estabelecer valores print(entrada) try: peso = float(entrada[0]) altura = float(entr...
code_fim
medium
{ "lang": "python", "repo": "duarte28nm/SR1", "path": "/MMC/server.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Press the green button in the gutter to run the script. if __name__ == '__main__': print_hi('PyCharm') # See PyCharm help at https://www.jetbrains.com/help/pycharm/<|fim_prefix|># repo: monmokk/pyStudy path: /main.py # coding=utf-8 # This is a sample Python script. # Press ⌃R to execute it or ...
code_fim
hard
{ "lang": "python", "repo": "monmokk/pyStudy", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: monmokk/pyStudy path: /main.py # coding=utf-8 # This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. <|fim_suffix|> # Press the green button in the gutter to run t...
code_fim
hard
{ "lang": "python", "repo": "monmokk/pyStudy", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.RenameField( model_name='review', old_name='body', new_name='general_info', ), migrations.AddField( model_name='review', name='payment_methods', field=models.ManyToManyField(blank=...
code_fim
medium
{ "lang": "python", "repo": "urosmarolt/dj_blog", "path": "/blog/migrations/0008_auto_20160507_1744.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: urosmarolt/dj_blog path: /blog/migrations/0008_auto_20160507_1744.py # -*- coding: utf-8 -*- # Generated by Django 1.9.6 on 2016-05-07 17:44 from __future__ import unicode_literals import datetime from django.db import migrations, models from django.utils.timezone import utc class Migration(mi...
code_fim
medium
{ "lang": "python", "repo": "urosmarolt/dj_blog", "path": "/blog/migrations/0008_auto_20160507_1744.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data=codecs.open("data/dict/english.txt",'rb','utf-8') wordList=data.readlines() data=codecs.open("data/dict/indon.txt",'rb','utf-8') indonList=data.readlines() def start(appid,threadID): print("======Starting Filtering=======") msg='Initiate filtering for %s' ...
code_fim
hard
{ "lang": "python", "repo": "hazimhanif/OpiClass", "path": "/OpiClass_filter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def isEnglish(wordEng): if wordEng in map(str.lower,[x.strip("\r\n\t") for x in wordList]): #print("English: "+wordEnglish) return 1 return 0 def getReviews(data,threadID,appid): global english_count global indon_count global total_count ...
code_fim
hard
{ "lang": "python", "repo": "hazimhanif/OpiClass", "path": "/OpiClass_filter.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ultimitech/tranai_site3 path: /tranai/models.py from django.db import models from django.core.validators import RegexValidator from django.utils.translation import gettext_lazy as _ # from rest_framework import serializers # from django.utils.translation import gettext as _ from django.core.valid...
code_fim
hard
{ "lang": "python", "repo": "ultimitech/tranai_site3", "path": "/tranai/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># class TranslationSerializer(serializers.ModelSerializer): # class Meta: # model = Translation # fields = ('id', 'lan', 'tran_title', 'descrip', 'blkc', 'subc', 'senc', 'xcrip', 'li', 'pubdate', 'version', 'document', 'eng_tran') # class Task(models.Model): # role = # attendees = models.Ma...
code_fim
hard
{ "lang": "python", "repo": "ultimitech/tranai_site3", "path": "/tranai/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> admin.site.register(Weather) admin.site.register(UpdateDay)<|fim_prefix|># repo: DollaR84/elrusapps path: /weather/admin.py from django.contrib import admin <|fim_middle|># Register your models here. from .models import Weather from .models import UpdateDay
code_fim
medium
{ "lang": "python", "repo": "DollaR84/elrusapps", "path": "/weather/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from .models import Weather from .models import UpdateDay admin.site.register(Weather) admin.site.register(UpdateDay)<|fim_prefix|># repo: DollaR84/elrusapps path: /weather/admin.py from django.contrib import admin <|fim_middle|># Register your models here.
code_fim
easy
{ "lang": "python", "repo": "DollaR84/elrusapps", "path": "/weather/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DollaR84/elrusapps path: /weather/admin.py from django.contrib import admin <|fim_suffix|>from .models import Weather from .models import UpdateDay admin.site.register(Weather) admin.site.register(UpdateDay)<|fim_middle|># Register your models here.
code_fim
easy
{ "lang": "python", "repo": "DollaR84/elrusapps", "path": "/weather/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>10-mbps", 1), ("speed-100-mbps", 2), ("not-applicable", 3)))).setMaxAccess("readonly") if mibBuilder.loadTexts: aniDevEthernetCurrentSpeed.setStatus('current') if mibBuilder.loadTexts: aniDevEthernetCurrentSpeed.setDescription('Displays the current ethernet speed of the device ') aniDevEthernetCurrentDupl...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/DEVETHERNET-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>t(1, 2, 3, 4, 5))).clone(namedValues=NamedValues(("auto-negotiate", 1), ("speed-100mbps-full", 2), ("speed-100mbps-half", 3), ("speed-10mbps-full", 4), ("speed-10mbps-half", 5))).clone('auto-negotiate')).setMaxAccess("readwrite") if mibBuilder.loadTexts: aniDevEthernetConfigMode.setStatus('current') if mi...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/DEVETHERNET-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp-with-texts/DEVETHERNET-MIB.py # # PySNMP MIB module DEVETHERNET-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/DEVETHERNET-MIB # Produced by pysmi-0.3.4 at Wed May 1 12:41:52 2019 # On host DAVWANG4-M-...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp-with-texts/DEVETHERNET-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: udaloff22/django_movie path: /testsite/main/migrations/0001_initial.py # Generated by Django 3.1.5 on 2021-02-12 08:20 import datetime from django.db import migrations, models import django.db.models.deletion import django.db.models.fields class Migration(migrations.Migration): initial = ...
code_fim
hard
{ "lang": "python", "repo": "udaloff22/django_movie", "path": "/testsite/main/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='main.review', verbose_name='Parent')), ], options={ 'verbose_name': 'Review', 'verbose_name_plural': 'Reviews', }, ), migrations.CreateM...
code_fim
hard
{ "lang": "python", "repo": "udaloff22/django_movie", "path": "/testsite/main/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ 硬编码音频素材文件 先暂时这样以后有空再改 """ super().__init__() self.VoicesFiles = { '表演绝活': { 'file': '0.mp3', 'tag': '普通' }, 'iloveyou': { 'file': '1.mp3', 'tag': '卖萌' ...
code_fim
hard
{ "lang": "python", "repo": "hailong-z/nonebot2_miya", "path": "/omega_miya/plugins/miya_button/resources/__init__.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hailong-z/nonebot2_miya path: /omega_miya/plugins/miya_button/resources/__init__.py import os import random class Voice(object): def __init__(self): self.VoicesFiles = dict() def get_voice_filepath(self, voice: str) -> str: plugin_path = os.path.dirname(os.path.abspath(...
code_fim
hard
{ "lang": "python", "repo": "hailong-z/nonebot2_miya", "path": "/omega_miya/plugins/miya_button/resources/__init__.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> nodeDF, edgeDF = util.buildCoauthorNodesEdges(authorNet) nodeDF.to_csv('{0}/{1}_{2}_OneDegreeNodes.csv'.format(resultDir, fileFirstName, fileLastName)) edgeDF.to_csv('{0}/{1}_{2}_OneDegreeEdges.csv'.format(resultDir, fileFirstName, fileLastName)) except Exception a...
code_fim
medium
{ "lang": "python", "repo": "srhoades10/CollaborationNetworks", "path": "/citationsAndcollaborations.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: srhoades10/CollaborationNetworks path: /citationsAndcollaborations.py """ Query pubmed and Arxiv to generate citation/collaboration networks. Examples herein include Albert-Laszlo Barabasi, my (much sparser) network Default parameters are to limit the number of citations, and keep to wi...
code_fim
hard
{ "lang": "python", "repo": "srhoades10/CollaborationNetworks", "path": "/citationsAndcollaborations.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if ('{0}_{1}_ColabNet.json'.format(fileFirstName, fileLastName) not in os.listdir(resultDir) or overwrite == True): with open('{0}/{1}_{2}_Papers.json'.format(resultDir, fileFirstName, fileLastName), 'r') as fin: authorDict = json.load(fin) ...
code_fim
hard
{ "lang": "python", "repo": "srhoades10/CollaborationNetworks", "path": "/citationsAndcollaborations.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>uito perto') if d>=102: print('Muito longe') else: print('Acertou!')<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_086/ch30_2019_08_21_18_30_32_558782.py import math velocidade=float(input('Qual a velocidade da sua jaca? '<|fim_middle|>)) angulo=float(input('Qual é o ân...
code_fim
medium
{ "lang": "python", "repo": "gabriellaec/desoft-analise-exercicios", "path": "/backup/user_086/ch30_2019_08_21_18_30_32_558782.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_086/ch30_2019_08_21_18_30_32_558782.py import math velocidade=float(input('Qual a velocidade da sua jaca? '<|fim_suffix|>uito perto') if d>=102: print('Muito longe') else: print('Acertou!')<|fim_middle|>)) angulo=float(input('Qual é o ân...
code_fim
medium
{ "lang": "python", "repo": "gabriellaec/desoft-analise-exercicios", "path": "/backup/user_086/ch30_2019_08_21_18_30_32_558782.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ')) g=9.8 d=(velocidade**2*math.sin(2*angulo))/g if d<=98: print('Muito perto') if d>=102: print('Muito longe') else: print('Acertou!')<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_086/ch30_2019_08_21_18_30_32_558782.py import math velocidade=float(input('Qual a velo...
code_fim
medium
{ "lang": "python", "repo": "gabriellaec/desoft-analise-exercicios", "path": "/backup/user_086/ch30_2019_08_21_18_30_32_558782.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BongoHive/magriculture path: /magriculture/fncs/management/commands/fncs_users_find_bad_lengths.py from django.contrib.auth.models import User from django.core.management.base import BaseCommand # Example usage: # python manage.py fncs_users_find_bad_lengths class Command(BaseCommand): <|fim_s...
code_fim
hard
{ "lang": "python", "repo": "BongoHive/magriculture", "path": "/magriculture/fncs/management/commands/fncs_users_find_bad_lengths.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> for user in users: stripped = user.username.replace(' ', '') length = len(stripped) if length > expected_length: self.stdout.write(user.username + '\n')<|fim_prefix|># repo: BongoHive/magriculture path: /magriculture/fncs/management/commands/fnc...
code_fim
hard
{ "lang": "python", "repo": "BongoHive/magriculture", "path": "/magriculture/fncs/management/commands/fncs_users_find_bad_lengths.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> help = "Search for too long and too short numbers (+260 numbers only)" def handle(self, *args, **options): users = User.objects.filter(username__startswith='+260') total = len(users) expected_length = 13 if total == 0: self.stdout.write('No users start...
code_fim
medium
{ "lang": "python", "repo": "BongoHive/magriculture", "path": "/magriculture/fncs/management/commands/fncs_users_find_bad_lengths.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>###################################### # Residual Calculation for least squares def res(p, y, x): Gam, Del, Sca = p y_fit = inversegaussian(x, Gam, Del, Sca) err = y - y_fit return err ######################################<|fim_prefix|># repo: hdrake/so_lagrangian_upwelling path: /inver...
code_fim
hard
{ "lang": "python", "repo": "hdrake/so_lagrangian_upwelling", "path": "/inversegaussian.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hdrake/so_lagrangian_upwelling path: /inversegaussian.py import numpy as np ###################################### # Inverse Gaussian (scaled) def inversegaussian(x, Gamma, Delta, Scaling): inversegaussian = [] for i in range(x.size): inversegaussian += [Scaling*(((Gamma**3)/(4 *...
code_fim
medium
{ "lang": "python", "repo": "hdrake/so_lagrangian_upwelling", "path": "/inversegaussian.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jankowskipawel/PZ-NETTOM path: /python/script2.py #!/var/www/html/cgi-enabled/env/bin/python3 from MySQLdb import _mysql from config import * import datetime import math import random ram = "1GB" print("Content-type: text/html\n\n") print("<html>\n<body>") print( "<div style=\"width: 100%; font-...
code_fim
hard
{ "lang": "python", "repo": "jankowskipawel/PZ-NETTOM", "path": "/python/script2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#data = EmptyToPi(data) data = EmptyToRandom(data, 1, 10, 1) data = CiezkiSkrypt(data) #print(data) ################################ dateend = datetime.datetime.now() elapsedTime=dateend-datestart totalTime+=elapsedTime print(f"<br>Elapsed time (script execution): {elapsedTime} (Started: {datestart}, ...
code_fim
hard
{ "lang": "python", "repo": "jankowskipawel/PZ-NETTOM", "path": "/python/script2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def CiezkiSkrypt(dataset): #dataset = list(dataset) for row in range(len(dataset)): dataset[row] = list(dataset[row]) for col in range(len(dataset[row])): if(isinstance(dataset[row][col], (float))): dataset[row][col] = math.log((dataset[row][col]**(1/flo...
code_fim
hard
{ "lang": "python", "repo": "jankowskipawel/PZ-NETTOM", "path": "/python/script2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_func(self): return self.request.user.is_staff<|fim_prefix|># repo: codeforamerica/intake path: /user_accounts/base_views.py from django.contrib.auth.mixins import UserPassesTestMixin <|fim_middle|> class StaffOnlyMixin(UserPassesTestMixin):
code_fim
easy
{ "lang": "python", "repo": "codeforamerica/intake", "path": "/user_accounts/base_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: codeforamerica/intake path: /user_accounts/base_views.py from django.contrib.auth.mixins import UserPassesTestMixin class StaffOnlyMixin(UserPassesTestMixin): <|fim_suffix|> return self.request.user.is_staff<|fim_middle|> def test_func(self):
code_fim
easy
{ "lang": "python", "repo": "codeforamerica/intake", "path": "/user_accounts/base_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Robbybp/IDAES-CLC path: /idaes_models/unit/MB_CLC_dynamic/ss_sim.py "\nH20: ", value(fs.MB_fuel.Gas_M[0,'H2O']), "kg/s", "\nCH4: ", value(fs.MB_fuel.Gas_M[0,'CH4']), "kg/s") print("\nOutlet gas: ", "\nCO2: ", value(fs.MB_fuel.F[1,'CO2']), "mol/s", ...
code_fim
hard
{ "lang": "python", "repo": "Robbybp/IDAES-CLC", "path": "/idaes_models/unit/MB_CLC_dynamic/ss_sim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Robbybp/IDAES-CLC path: /idaes_models/unit/MB_CLC_dynamic/ss_sim.py "\nFe2O3: ", value(fs.MB_fuel.Solid_M[1,'Fe2O3']), "kg/s", "\nFe3O4: ", value(fs.MB_fuel.Solid_M[1,'Fe3O4']), "kg/s", "\nAl: ", value(fs.MB_fuel.Solid_M[1,'Al2O3']), "kg/s") print("\nOutle...
code_fim
hard
{ "lang": "python", "repo": "Robbybp/IDAES-CLC", "path": "/idaes_models/unit/MB_CLC_dynamic/ss_sim.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("\n") print("----------------------------------------------------------") print('Total simulation time: ', value(time.time() - ts), " s") print("----------------------------------------------------------") # Print some variables #print_summary_fuel_reactor(flowsheet) ...
code_fim
hard
{ "lang": "python", "repo": "Robbybp/IDAES-CLC", "path": "/idaes_models/unit/MB_CLC_dynamic/ss_sim.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print("Tuned: {}".format(clf_.best_params_)) print("Mean of the cv scores is {:.6f}".format(clf_.best_score_)) print("Train Score {:.6f}".format(clf_.score(X_train,y_train))) print("Test Score {:.6f}".format(clf_.score(X_test,y_test))) #%% #Evaluate your result on both train and test set. #Analyse...
code_fim
hard
{ "lang": "python", "repo": "egeakyol/GlobalAl-Homework-and-final-project", "path": "/Homework3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>X_train, X_test, y_train, y_test = train_test_split(data, y ,test_size=0.3, random_state=0) clf = DecisionTreeClassifier() #we have to define max_depth to prevent overfitting clf.fit(X_train,y_train) print("Train Accuracy of clf:",clf.score(X_train,y_train)) print("Test Accuracy of clf",clf.score...
code_fim
hard
{ "lang": "python", "repo": "egeakyol/GlobalAl-Homework-and-final-project", "path": "/Homework3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: egeakyol/GlobalAl-Homework-and-final-project path: /Homework3.py # -*- coding: utf-8 -*- """ Created on Fri Jan 8 00:45:04 2021 @author: Asus """ import pandas as pd import numpy as np import matplotlib.pyplot as plt from sklearn.datasets import make_blobs from sklearn.model_selectio...
code_fim
hard
{ "lang": "python", "repo": "egeakyol/GlobalAl-Homework-and-final-project", "path": "/Homework3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from Adafruit_BNO055 import BNO055 from time import time from time import sleep from sensor_msgs.msg import Imu, Temperature, MagneticField from tf.transformations import quaternion_from_euler from dynamic_reconfigure.server import Server from diagnostic_msgs.msg import DiagnosticArray, DiagnosticStatus...
code_fim
hard
{ "lang": "python", "repo": "betaupsx86/medbot", "path": "/bosch_imu_node/scripts/calibrate_bosch_imu.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if not bno.begin(): raise RuntimeError('Failed to initialize BNO055! Is the sensor connected?') # Print system status and self test result. status, self_test, error = bno.get_system_status() print('System status: {0}'.format(status)) print('Self test result (0x0F is normal): 0x{0...
code_fim
hard
{ "lang": "python", "repo": "betaupsx86/medbot", "path": "/bosch_imu_node/scripts/calibrate_bosch_imu.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: betaupsx86/medbot path: /bosch_imu_node/scripts/calibrate_bosch_imu.py #!/usr/bin/env python ##################################################################### # Software License Agreement (BSD License) # # Copyright (c) 2016, Michal Drwiega # All rights reserved. # # Redistribution and use i...
code_fim
hard
{ "lang": "python", "repo": "betaupsx86/medbot", "path": "/bosch_imu_node/scripts/calibrate_bosch_imu.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03273/s197165929.py h,w=map(int,input().split()) a=[] data=[0]*w for i in range(h): a_=input<|fim_suffix|>ange(w): if data[j]!=n: ans.append(a[i][j]) print(*ans,sep='')<|fim_middle|>() if a_!='.'*w: a.append(a_) for j in range(w):...
code_fim
medium
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03273/s197165929.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ange(w): if data[j]!=n: ans.append(a[i][j]) print(*ans,sep='')<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03273/s197165929.py h,w=map(int,input().split()) a=[] data=[0]*w for i in range(h): a_=input() if a_!='.'*w: a.append(a_) for j in range(w): if a_[j...
code_fim
medium
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03273/s197165929.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>='.': data[j]+=1 n=len(a) for i in range(n): ans=[] for j in range(w): if data[j]!=n: ans.append(a[i][j]) print(*ans,sep='')<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03273/s197165929.py h,w=map(int,input().split()) a=[] data=[0]*w for i in range(h): a_=inp...
code_fim
medium
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03273/s197165929.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def get_sum(): running_sum = 0 for i in range(2, 10**6+1): if primes[i] == True: running_sum += i sum_[i] = running_sum get_sum() for _ in range(T): N = int(input()) print(sum_[N])<|fim_prefix|># repo: skubatur/euler_prime_sum pa...
code_fim
hard
{ "lang": "python", "repo": "skubatur/euler_prime_sum", "path": "/prime_sum.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: skubatur/euler_prime_sum path: /prime_sum.py from bisect import bisect_left T = int(input()) primes = [True for i in range(10**6+1)] def get_primes(): p = 2 <|fim_suffix|>def get_sum(): running_sum = 0 for i in range(2, 10**6+1): if primes[i] == True: r...
code_fim
hard
{ "lang": "python", "repo": "skubatur/euler_prime_sum", "path": "/prime_sum.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self.school_name class HighSchoolStudent(Student): school_name = "Patrick Henry Hight" def get_school_name(self): return 'This is a hight School student' def get_name_capitalize(self): original_value = super().get_name_capitalize() return original_val...
code_fim
medium
{ "lang": "python", "repo": "jerrylee09/pythonStudentApp", "path": "/classes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_school_name(self): return self.school_name class HighSchoolStudent(Student): school_name = "Patrick Henry Hight" def get_school_name(self): return 'This is a hight School student' def get_name_capitalize(self): original_value = super().get_name_capitaliz...
code_fim
medium
{ "lang": "python", "repo": "jerrylee09/pythonStudentApp", "path": "/classes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jerrylee09/pythonStudentApp path: /classes.py students = [] class Student: # static varible school_name = "Patrick Henry" def __init__ (self, name, student_id = 1): self.name = name self.student = student_id students.append(self) def __str__(self): ...
code_fim
hard
{ "lang": "python", "repo": "jerrylee09/pythonStudentApp", "path": "/classes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jionie/Joint-Learning-3-Probalistic-Models path: /CoopNets/main.py from model import CoopNets from opts import opts <|fim_suffix|> opt=opts().parse() model=CoopNets(opt) if opt.test: model.test() else: model.train() if __name__=='__main__': main()<|fim_middle|...
code_fim
easy
{ "lang": "python", "repo": "jionie/Joint-Learning-3-Probalistic-Models", "path": "/CoopNets/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__=='__main__': main()<|fim_prefix|># repo: jionie/Joint-Learning-3-Probalistic-Models path: /CoopNets/main.py from model import CoopNets from opts import opts def main(): <|fim_middle|> opt=opts().parse() model=CoopNets(opt) if opt.test: model.test() else: mo...
code_fim
medium
{ "lang": "python", "repo": "jionie/Joint-Learning-3-Probalistic-Models", "path": "/CoopNets/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.category is None: category = self.categories.all()[0] return reverse('category_content_detail', args=[CategoryContent.get_path(category), self.slug])<|fim_prefix|># repo: ikresoft/django-category-content path: /category_content/models.py from django.db import models fr...
code_fim
hard
{ "lang": "python", "repo": "ikresoft/django-category-content", "path": "/category_content/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikresoft/django-category-content path: /category_content/models.py from django.db import models from django.core.urlresolvers import reverse from django.utils.encoding import force_unicode from categories.fields import CategoryM2MField from content.models import Content from django.utils.transla...
code_fim
medium
{ "lang": "python", "repo": "ikresoft/django-category-content", "path": "/category_content/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Third block flatten = tf.keras.layers.Flatten()(maxpool2) dense1 = tf.keras.layers.Dense(400, activation='relu', kernel_initializer='he_uniform')(flatten) dense2 = tf.keras.layers.Dense(120, activation='relu', kernel_i...
code_fim
hard
{ "lang": "python", "repo": "surajkarki66/Image-Classification-Deep-Learning", "path": "/LeNet-5/Tensorflow/functional_api/model/model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: surajkarki66/Image-Classification-Deep-Learning path: /LeNet-5/Tensorflow/functional_api/model/model.py import tensorflow as tf def LeNet5(input_shape=None): """ Building LeNet-5 Model using Functional API """ input_data = tf.keras.layers.Input(shape=input_shape) # First block c...
code_fim
hard
{ "lang": "python", "repo": "surajkarki66/Image-Classification-Deep-Learning", "path": "/LeNet-5/Tensorflow/functional_api/model/model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return render(request,'orderdetails.html',{"dump": objectlist}) def addwishlist(request): wishlist = wishlistmodel.objects.all() productid = request.GET['id'] price = request.GET['price'] qty = 1 userid=request.user.id retval = chekwishproductid(productid,price,userid) if ...
code_fim
hard
{ "lang": "python", "repo": "Hariharan1305/E-pharmacy", "path": "/product/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hariharan1305/E-pharmacy path: /product/views.py from django.shortcuts import render, redirect from django.shortcuts import get_list_or_404, get_object_or_404 from django.http import JsonResponse from .forms import MedicineForm,AddtocartForm,OrderdetailForm,WishlistForm from django.core import se...
code_fim
hard
{ "lang": "python", "repo": "Hariharan1305/E-pharmacy", "path": "/product/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmitry-petrov-dev/python-algorithm path: /lesson3/task9.py # 9. Найти максимальный элемент среди минимальных элементов столбцов матрицы. from random import randint <|fim_suffix|>max_element = min_column[0] for item in min_column[1:]: if max_element < item: max_element = item print(f"...
code_fim
hard
{ "lang": "python", "repo": "dmitry-petrov-dev/python-algorithm", "path": "/lesson3/task9.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>max_element = min_column[0] for item in min_column[1:]: if max_element < item: max_element = item print(f"\nList of minimum values by columns: {min_column}") print(f"Maximum - {max_element}")<|fim_prefix|># repo: dmitry-petrov-dev/python-algorithm path: /lesson3/task9.py # 9. Найти максимальн...
code_fim
hard
{ "lang": "python", "repo": "dmitry-petrov-dev/python-algorithm", "path": "/lesson3/task9.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>outim=Image.new(fontfile.mode,(width,outy+box[1])) outim.paste(fontfile,(0,0)) for name,im,x,y in placements: outim.paste(im,(x,y)) print """ "{}": {{ "x": {}, "y": {}, "w": {}, "h": {} }},""".format(name,x,y,im.size[0],im.size[1]) outfile=os.path.splitext(sys.argv[1])[0]+'-a...
code_fim
hard
{ "lang": "python", "repo": "iokaravas/SierraDeathGenerator", "path": "/tools/portraitpacker.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iokaravas/SierraDeathGenerator path: /tools/portraitpacker.py import sys,os,glob from PIL import Image files = sorted(glob.glob('atlas/*.png')) fontfile=Image.open(sys.argv[1]) width=fontfile.size[0] images = {} for path in files: im=Image.open(path) name=os.path.splitext(os.path.basename(path)...
code_fim
hard
{ "lang": "python", "repo": "iokaravas/SierraDeathGenerator", "path": "/tools/portraitpacker.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ysu-Wzy/mamlCNN path: /train.py import torch import numpy as np import argparse from fewshot_re_kit.data_loader import glove_getloader, bert_getloader from fewshot_re_kit.tokenizer import Berttokenizer, GloveTokenizer, Alberttokenizer import json from meta import Meta import time import os from d...
code_fim
hard
{ "lang": "python", "repo": "ysu-Wzy/mamlCNN", "path": "/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pred = maml.evaluate(x_spt_one, y_spt_one, x_qry_one).cpu().numpy() acc = (y_qry_one.numpy() == pred).mean() accs.append(acc) accs = np.array(accs).mean(axis=0).astype(np.float16) l.append(accs)...
code_fim
hard
{ "lang": "python", "repo": "ysu-Wzy/mamlCNN", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaitanya9899/mestro_invoice path: /src/invoice_scripts/kalmar_energi.py from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support.expected_conditions import presence_of_element_located from selenium.webdriver.common.by import By from s...
code_fim
hard
{ "lang": "python", "repo": "chaitanya9899/mestro_invoice", "path": "/src/invoice_scripts/kalmar_energi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> table=driver.find_elements_by_xpath('//tbody/tr/td[7]') print(len(table)) time.sleep(3) try: driver.find_element_by_class_name("notification-close").click() except: print("no pop element") x=100 time.sleep(5) log.job(c...
code_fim
hard
{ "lang": "python", "repo": "chaitanya9899/mestro_invoice", "path": "/src/invoice_scripts/kalmar_energi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (lst[i]+lst[j]==num): print("\n(",lst[i],",",lst[j],")")<|fim_prefix|># repo: Aswani-kolloly/luminarPython path: /collections/list_pgm2.py lst=list() r=int(input("enter range of list")) print("Enter elements") for i in range(0,r): lst.append(int(input())) print("\nList\n",lst)...
code_fim
medium
{ "lang": "python", "repo": "Aswani-kolloly/luminarPython", "path": "/collections/list_pgm2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aswani-kolloly/luminarPython path: /collections/list_pgm2.py lst=list() r=int(input("enter range of list")) print("Enter elements") for i in <|fim_suffix|>ter number")) print("\n 'pairs") for i in range(0,r): for j in range(i+1,r): if (lst[i]+lst[j]==num): print("\n(",lst[...
code_fim
medium
{ "lang": "python", "repo": "Aswani-kolloly/luminarPython", "path": "/collections/list_pgm2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>counter = 1 for code in ptr: counter += 1 code = int(code[:-1]) #print "code received " , code , " " , if code not in dic.keys(): rcvd = previous_char + previous_char[0] else: rcvd = dic[code] #print rcvd fptr.write(rcvd) dic[pointer] = previous_char + rcvd[0] pointer += 1 previous_char ...
code_fim
medium
{ "lang": "python", "repo": "snehasinghania/compression-algorithms", "path": "/lzwdecoding.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }