text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>./bin/ffmpeg -v 0 -i %s -r 1 ../data/iqiyi/%s/%s_%s.jpg' % (video_dir, video_id, video_id, '%5d') os.system(decode_cmd)<|fim_prefix|># repo: stella-shen/bilibili path: /depart_videos.py # encoding=utf-8 import os root_dir = '../data/iqiyi/' for video_path in os.listdir(root_dir): video_dir ...
code_fim
medium
{ "lang": "python", "repo": "stella-shen/bilibili", "path": "/depart_videos.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dhariskov/python-advanced path: /Advanced/Multidimensional Arrays/6. Knight Game.py n = int(input()) matrix = [] for _ in range(n): matrix.append([each for each in input()]) possible_hit_coordinates = [[-2, -1], [-2, 1], [-1, -2], [-1, 2], [1, -2], [1, 2], [2, -1], [2, 1]] <|fim_suffix|> ...
code_fim
hard
{ "lang": "python", "repo": "dhariskov/python-advanced", "path": "/Advanced/Multidimensional Arrays/6. Knight Game.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if matrix[k][v] == "K": matrix[k][v] = "0" counter += 1 break print(counter)<|fim_prefix|># repo: dhariskov/python-advanced path: /Advanced/Multidimensional Arrays/6. Knight Game.py n = int(input()) matrix = [] for _ in range(n): matrix.append(...
code_fim
hard
{ "lang": "python", "repo": "dhariskov/python-advanced", "path": "/Advanced/Multidimensional Arrays/6. Knight Game.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fileName=FileField("Upload your Video here",validators=[DataRequired()]) submit=SubmitField('Upload')<|fim_prefix|># repo: hemasenthilkumar/snakechain path: /forms.py from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, IntegerField,FileField,SubmitField, TextAreaField,...
code_fim
easy
{ "lang": "python", "repo": "hemasenthilkumar/snakechain", "path": "/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hemasenthilkumar/snakechain path: /forms.py from flask_wtf import FlaskForm from wtforms import StringField, PasswordField, IntegerField,FileField,SubmitField, TextAreaField,validators,SelectField,SelectMultipleField from wtforms.widgets import TextArea, html5 from wtforms.fields.html5 import Dat...
code_fim
easy
{ "lang": "python", "repo": "hemasenthilkumar/snakechain", "path": "/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def main(path): audiofile = eyed3.load(path) query = path.split('/')[-1] query = parse_query(query) # prepare the option for the chrome driver options = webdriver.ChromeOptions() options.add_argument('headless') # start chrome browser driver = webdriver.Chrome(options=opt...
code_fim
hard
{ "lang": "python", "repo": "noahbaxter/sc-tag", "path": "/sc_tag.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: noahbaxter/sc-tag path: /sc_tag.py import html import os import sys import time import eyed3 import urllib from selenium import webdriver from selenium.webdriver.common.by import By def scroll (driver): # stolen from OWADVL and sbha on stack exchange SCROLL_PAUSE_TIME = 0.5 last_he...
code_fim
hard
{ "lang": "python", "repo": "noahbaxter/sc-tag", "path": "/sc_tag.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ation that next entry is human confirmed_human = False # Clear the data buffer for the next entry data_buffer = [] elif row[0] == 'OS' and row[1] == 'Homo sapiens (Human).': # The current entry is human, flush when finished confirmed_human = True # Store the row in the data buffer in ca...
code_fim
medium
{ "lang": "python", "repo": "CapraLab/pdbmap", "path": "/data/uniprot/swissprot/filter_uniprot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CapraLab/pdbmap path: /data/uniprot/swissprot/filter_uniprot.py #!/usr/bin/python27 import sys,gzip unp_file = sys.argv[1] with gzip.open(unp_file,'r') as fin: data_buffer = [] confirmed_human=False for line in fin: row = line.strip().split(' <|fim_suffix|> # The current entry is human, f...
code_fim
hard
{ "lang": "python", "repo": "CapraLab/pdbmap", "path": "/data/uniprot/swissprot/filter_uniprot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # The current entry is human, flush when finished confirmed_human = True # Store the row in the data buffer in case it is # human and needs to be printed data_buffer.append(line)<|fim_prefix|># repo: CapraLab/pdbmap path: /data/uniprot/swissprot/filter_uniprot.py #!/usr/bin/python27 import sys,...
code_fim
hard
{ "lang": "python", "repo": "CapraLab/pdbmap", "path": "/data/uniprot/swissprot/filter_uniprot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> number = get("number") if number: number = int(number) print(type(number), number) professors = professors.filter(fcqs__course__course_subject=number) # profList = fcq_obj.order_by().values_list("professor").distinct() # professors = Professor.objects.filter(id__in...
code_fim
hard
{ "lang": "python", "repo": "jacobfelknor/schedulecu", "path": "/fcq/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rakumairu/wakeword-google-assistant path: /wakeword.py import pvporcupine import struct import pyaudio import assistant.pushtotalk as pushtotalk PROJECT_ID = 'hey-lumi' DEVICE_MODEL_ID = 'hey-lumi-hey-lumi-e75s95' CREDENTIALS_PATH = './credentials.json' MODEL_PATH = './hey_lumi.ppn' <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "rakumairu/wakeword-google-assistant", "path": "/wakeword.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>try: print('started') while True: pcm = audio_stream.read(handle.frame_length) pcm = struct.unpack_from("h" * handle.frame_length, pcm) keyword_index = handle.process(pcm) if keyword_index >= 0: # detected pushtotalk.main( pro...
code_fim
hard
{ "lang": "python", "repo": "rakumairu/wakeword-google-assistant", "path": "/wakeword.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 데이터가 남아있으면 반복동작 while True: data = f.readline() #list(map(int, f.readline().split())) if(data==""): break data1 = list(map(int, data.split())) # 입력받은 한 줄의 데이터를 각각 분리하여 정수형 리스트에 넣음 data2 = list(map(int, f.readline().split())) #문제풀이 num, target = data1 #첫째줄의 값을 각각 카드 갯수...
code_fim
medium
{ "lang": "python", "repo": "sehuns/FC_Practice", "path": "/03_유형별 문제 풀이/085_2_블랙잭/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sum, result = 0, 0 for i in range (0, num): for j in range (i+1, num): for k in range (j+1, num): sum = cards[i] + cards[j] + cards[k] if sum <= target: if sum > result: result = sum print(result) # 원래 내림차순 정렬하고 각 for문...
code_fim
hard
{ "lang": "python", "repo": "sehuns/FC_Practice", "path": "/03_유형별 문제 풀이/085_2_블랙잭/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sehuns/FC_Practice path: /03_유형별 문제 풀이/085_2_블랙잭/main.py #https://www.acmicpc.net/problem/2798 # 백준 2798 : 블랙잭 #테스트용 입력 #import os #f = open(os.path.join(os.path.dirname(__file__), 'data.txt'), 'r') #제출용 입력 import sys f = sys.stdin <|fim_suffix|> sum, result = 0, 0 for i in range (0...
code_fim
hard
{ "lang": "python", "repo": "sehuns/FC_Practice", "path": "/03_유형별 문제 풀이/085_2_블랙잭/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: deniskorobicyn/kozmic-ci path: /migrations/versions/4bbfdf089fbc_.py """empty message Revision ID: 4bbfdf089fbc Revises: 2cc431e5815b Create Date: 2014-01-07 23:46:14.694649 """ # revision identifiers, used by Alembic. revision = '4bbfdf089fbc' down_revision = '2cc431e5815b' from alembic impo...
code_fim
medium
{ "lang": "python", "repo": "deniskorobicyn/kozmic-ci", "path": "/migrations/versions/4bbfdf089fbc_.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def downgrade(): op.alter_column('membership', 'user_id', existing_type=mysql.INTEGER(display_width=11), nullable=True) op.alter_column('membership', 'project_id', existing_type=mysql.INTEGER(display_width=11), nullable=True) op.drop_...
code_fim
hard
{ "lang": "python", "repo": "deniskorobicyn/kozmic-ci", "path": "/migrations/versions/4bbfdf089fbc_.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aycatuzmen/Comp125-Projects path: /Functions/FunctionsDemo.py def my_function(): x = 2 y = 3 return y <|fim_suffix|>if __name__ == "__main__": print ("Executed when invoked directly") else: print ("Executed when imported")<|fim_middle|>####### DO NOT EDIT CODE BELOW THIS LIN...
code_fim
easy
{ "lang": "python", "repo": "aycatuzmen/Comp125-Projects", "path": "/Functions/FunctionsDemo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": print ("Executed when invoked directly") else: print ("Executed when imported")<|fim_prefix|># repo: aycatuzmen/Comp125-Projects path: /Functions/FunctionsDemo.py def my_function(): x = 2 y = 3 return y <|fim_middle|>####### DO NOT EDIT CODE BELOW THIS LIN...
code_fim
easy
{ "lang": "python", "repo": "aycatuzmen/Comp125-Projects", "path": "/Functions/FunctionsDemo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ageDifference = relativedelta(childBirthDate, motherBirthDate).years if ageDifference >= 60: return False else: return True<|fim_prefix|># repo: karell/stevens_cs555 path: /src/parents_not_to_old.py ''' Created on Feb 20, 2018 @author: esthe ''' ##US12 - Pair Programming ##Mo...
code_fim
medium
{ "lang": "python", "repo": "karell/stevens_cs555", "path": "/src/parents_not_to_old.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ageDifference = relativedelta(childBirthDate, fatherBirthDate).years if ageDifference >= 80: return False else: return True def isValidMotherAge(childBirthDate, motherBirthDate): ageDifference = relativedelta(childBirthDate, motherBirthDate).years if ageDifference >= 6...
code_fim
medium
{ "lang": "python", "repo": "karell/stevens_cs555", "path": "/src/parents_not_to_old.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: karell/stevens_cs555 path: /src/parents_not_to_old.py ''' Created on Feb 20, 2018 @author: esthe ''' ##US12 - Pair Programming ##Mother less than 60 Father less than 80 <|fim_suffix|>def isValidFatherAge(childBirthDate, fatherBirthDate): ageDifference = relativedelta(childBirthDate, fatherB...
code_fim
medium
{ "lang": "python", "repo": "karell/stevens_cs555", "path": "/src/parents_not_to_old.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # OUTPUT LAYER self.conv_block_7 = nn.Sequential(nn.Conv2d(in_channels=16, out_channels=10, kernel_size=1, stride=1, ...
code_fim
hard
{ "lang": "python", "repo": "prarthananbhat/tsai", "path": "/S12/tsai_repo/models/mnist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prarthananbhat/tsai path: /S12/tsai_repo/models/mnist.py import torch.nn as nn import torch.nn.functional as F class Net(nn.Module): def __init__(self): super(Net, self).__init__() # FIRST LAYER self.conv_block_1 = nn.Sequential(nn.Conv2d(in_channels=1, ...
code_fim
hard
{ "lang": "python", "repo": "prarthananbhat/tsai", "path": "/S12/tsai_repo/models/mnist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Microchip-MPLAB-Harmony/wireless path: /apps/wifi_touch_demo/pic32mzw1_qt7_sim.py import tkinter as Tk import socket import threading import json class ClientGui: def __init__(self, master, cmd_start, cmd_stop): self.start_button_val = Tk.IntVar() self.serverIP = Tk.String...
code_fim
hard
{ "lang": "python", "repo": "Microchip-MPLAB-Harmony/wireless", "path": "/apps/wifi_touch_demo/pic32mzw1_qt7_sim.py", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> self.clientFrame.grid(padx=5, pady=5, sticky="ew") self.guiClient = ClientGui(self.clientFrame, self.clientStartCmd, self.clientStopCmd) def clientStartCmd(self): if (False == self.isClientRunning): if self.guiClient.serverIP.get() != "" and self.g...
code_fim
hard
{ "lang": "python", "repo": "Microchip-MPLAB-Harmony/wireless", "path": "/apps/wifi_touch_demo/pic32mzw1_qt7_sim.py", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> def writeVerticalsAndHorizontals(self, verticals, horizontals): for v in verticals: self.file.write(str(v[0]) + " " + str(v[1]) + "\n") for h in horizontals: self.file.write(str(h) + "\n") def close(self): self.file.close() if __name__ == '__main_...
code_fim
hard
{ "lang": "python", "repo": "Sarps/Google-Hashcode-Collection", "path": "/2019/FileHelper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sarps/Google-Hashcode-Collection path: /2019/FileHelper.py import numpy as np class BaseLoader: def __init__(self, filename): self.file = open(filename, "r") self.parse() self.close() def _readline(self): return self.file.readline().rstrip('\n') de...
code_fim
hard
{ "lang": "python", "repo": "Sarps/Google-Hashcode-Collection", "path": "/2019/FileHelper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # TODO May the force be with you x = sum(map(lambda w: 1 if w == True else 0, sheep)) return(x)<|fim_prefix|># repo: detcitty/100DaysOfCode path: /python/unfinshed/countingSheep.py # https://www.codewars.com/kata/54edbc7200b811e956000556/train/python <|fim_middle|>def count_sheeps(sheep):
code_fim
easy
{ "lang": "python", "repo": "detcitty/100DaysOfCode", "path": "/python/unfinshed/countingSheep.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: detcitty/100DaysOfCode path: /python/unfinshed/countingSheep.py # https://www.codewars.com/kata/54edbc7200b811e956000556/train/python <|fim_suffix|> # TODO May the force be with you x = sum(map(lambda w: 1 if w == True else 0, sheep)) return(x)<|fim_middle|>def count_sheeps(sheep):
code_fim
easy
{ "lang": "python", "repo": "detcitty/100DaysOfCode", "path": "/python/unfinshed/countingSheep.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # pretty(response) returnClient(client) if response: for ident, item in response.items(): if threadsExitFlag[0]: return fbProfile = FBProfile.objects.get(_ident=ident) fbProfile.update(item) for fbProfile in fb...
code_fim
hard
{ "lang": "python", "repo": "GRCP-Ulaval/Social-Network-Harvester", "path": "/SocialNetworkHarvester/Facebook/management/commands/harvest/fbProfileUpdater.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GRCP-Ulaval/Social-Network-Harvester path: /SocialNetworkHarvester/Facebook/management/commands/harvest/fbProfileUpdater.py from Facebook.models import FBProfile from .commonThread import * class FBProfileUpdater(CommonThread): batchSize = 50 workQueueName = 'profileUpdateQueue' # ...
code_fim
hard
{ "lang": "python", "repo": "GRCP-Ulaval/Social-Network-Harvester", "path": "/SocialNetworkHarvester/Facebook/management/commands/harvest/fbProfileUpdater.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.warning_set.setText('') self.ch_word_input.setMaxLength(len(model_text)) if model_text == input_text: self.word_count+=1 if self.word_count == len(self.data): self.save_rank() self.thread.wait() r = QMessageBox.information(self,('Congradulations!'),('\n\n\t恭喜你通关了一次单词练习...
code_fim
hard
{ "lang": "python", "repo": "ricew4ng/Slim-Typer-v1.0", "path": "/code/class_ui_ch_wordwindow.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ricew4ng/Slim-Typer-v1.0 path: /code/class_ui_ch_wordwindow.py #coding:utf8 #英文单词练习模式 from ui_ch_wordwindow import Ui_ch_wordwindow from PyQt5 import QtWidgets,QtCore from PyQt5.QtWidgets import QMessageBox from class_thread_show_time_speed import thread_show_time_speed import datetime import o...
code_fim
hard
{ "lang": "python", "repo": "ricew4ng/Slim-Typer-v1.0", "path": "/code/class_ui_ch_wordwindow.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @app.get('/') def index(): image_manager = models.ImageORM() return views.HomeView().render_GET(images=image_manager.images()) @app.get('/error') def uh_oh(): return views.ErrorView().render(bottle.request.query) if __name__ == '__main...
code_fim
hard
{ "lang": "python", "repo": "scottsexton/mungy", "path": "/controller.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: scottsexton/mungy path: /controller.py #!/usr/bin/env python import bottle import models import os.path import settings import views class Server(object): def __init__(self, init_db=False): self.app = bottle.Bottle() Routes.setup_routing(self.app) if init_db: ...
code_fim
hard
{ "lang": "python", "repo": "scottsexton/mungy", "path": "/controller.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: amulmgr/High-Performance-Distributed-Computing-on-Big-Data-using-Hadoop-Framework path: /Code/cgi-bin/forgot.py #!/usr/bin/python import cgi import MySQLdb as mariadb print "Content-type:text/html" x=cgi.FieldStorage() uid=x.getvalue('uid') ctc=x.getvalue('ctc') pass1=x.getvalue('pass1') pass2=...
code_fim
medium
{ "lang": "python", "repo": "amulmgr/High-Performance-Distributed-Computing-on-Big-Data-using-Hadoop-Framework", "path": "/Code/cgi-bin/forgot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if( pass1 != pass2 ): print "location:http://192.168.43.63/cgi-bin/forg.py?q=perror" print "" if((uid =="")| (ctc == "")| (pass1 == "")| (pass2 == "")): print "location:http://192.168.43.63/cgi-bin/forg.py?q=ferror" print "" elif((len(uid) > 30)| (len(pass1)<6)| (len(pass2)<6)| (len(pass1)>30)| (len(...
code_fim
medium
{ "lang": "python", "repo": "amulmgr/High-Performance-Distributed-Computing-on-Big-Data-using-Hadoop-Framework", "path": "/Code/cgi-bin/forgot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='TagVariant', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('variant', models.CharField(max_length=255)), ('tag', m...
code_fim
medium
{ "lang": "python", "repo": "simo97/freelancefinder", "path": "/freelancefinder/jobs/migrations/0009_tagvariant.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: simo97/freelancefinder path: /freelancefinder/jobs/migrations/0009_tagvariant.py # -*- coding: utf-8 -*- # Generated by Django 1.10.6 on 2017-03-15 20:03 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion class Migration(migrations...
code_fim
medium
{ "lang": "python", "repo": "simo97/freelancefinder", "path": "/freelancefinder/jobs/migrations/0009_tagvariant.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pygame.init() for i in range(t): window = pygame.display.set_mode([1200,800]) pygame.display.set_caption("") window.fill([0,0,0]) font = pygame.font.Font(None, 36) goal = 'Your objective is to ' + self.getAbilityDefinition() ...
code_fim
hard
{ "lang": "python", "repo": "flastest/CatapultNetworkingPractice", "path": "/Hacker.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: flastest/CatapultNetworkingPractice path: /Hacker.py import Character import pygame, random, time from pygame.locals import * class Hacker(Character.Character): className = 'Hacker' goal = 'hack into the interwebs and steal digital information.' abilityDefinition = 'break through t...
code_fim
hard
{ "lang": "python", "repo": "flastest/CatapultNetworkingPractice", "path": "/Hacker.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @app.route('/') def index(): return render_template("index.html") @app.route('/credits') def credits(): return render_template("credits.html") @app.route('/api/albumData') def albumData(): albums = list(db.albums.find()) return dumps(albums) if __name__ == "__main__": app.run(de...
code_fim
medium
{ "lang": "python", "repo": "benjamenalford/HipHopTop100", "path": "/2. Application/webApp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: benjamenalford/HipHopTop100 path: /2. Application/webApp.py import os from flask import ( Flask, render_template, jsonify, request, redirect) from bson import Binary, Code from bson.json_util import dumps import pymongo <|fim_suffix|>@app.route('/credits') def credits(): ...
code_fim
medium
{ "lang": "python", "repo": "benjamenalford/HipHopTop100", "path": "/2. Application/webApp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>conn = 'mongodb://localhost:27017' client = pymongo.MongoClient(conn) db = client.HipHop100 @app.route('/') def index(): return render_template("index.html") @app.route('/credits') def credits(): return render_template("credits.html") @app.route('/api/albumData') def albumData(): albums ...
code_fim
medium
{ "lang": "python", "repo": "benjamenalford/HipHopTop100", "path": "/2. Application/webApp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xcode2010/attacking_anti_tamper path: /taint/analyze.py #!/usr/bin/env python2 from __future__ import print_function import struct import sys from .run_taint import registers, Trace, Module, saved_context_t, saved_memory_t from .create_patch import SavedInstruction from triton import * try: ...
code_fim
hard
{ "lang": "python", "repo": "xcode2010/attacking_anti_tamper", "path": "/taint/analyze.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(addr, addr + size, 8): print("[C] {:#018x} : {:#018x}".format(i, u64(ctx.getConcreteMemoryAreaValue(i, 8)))) def print_triton_memory_at_register(ctx, reg, size=0x40): reg_val = ctx.getConcreteRegisterValue(getattr(ctx.registers, reg)) print("[C] {}".format(reg)) pri...
code_fim
hard
{ "lang": "python", "repo": "xcode2010/attacking_anti_tamper", "path": "/taint/analyze.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pgavigan/D4PG-Phase-3 path: /analyze_experiment.py """ This script loads the deep guidance data logged from an experiment (specifically, logged by use_deep_guidance_arm.py) renders a few plots, and animates the motion. It should be run from the folder where use_deep_guidance_arm.py was run from ...
code_fim
hard
{ "lang": "python", "repo": "pgavigan/D4PG-Phase-3", "path": "/analyze_experiment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>environment_file = __import__('environment_' + Settings.ENVIRONMENT) # importing the environment def make_C_bI(angle): C_bI = np.array([[ np.cos(angle), np.sin(angle)], [-np.sin(angle), np.cos(angle)]]) # [2, 2] return C_bI # Generate a virtual display for ...
code_fim
hard
{ "lang": "python", "repo": "pgavigan/D4PG-Phase-3", "path": "/analyze_experiment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ########################## ### Animate the motion ### ########################## # Generate an Environment to use for reward logging environment = environment_file.Environment() environment.reset(False) # Process the data. Need to make the raw total state log # [relative_x, relative_y, relative_vx, rela...
code_fim
hard
{ "lang": "python", "repo": "pgavigan/D4PG-Phase-3", "path": "/analyze_experiment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print(len(data)) with open("url_output.py", "w") as f: f.seek(0) f.write("urls = " + str(data))<|fim_prefix|># repo: AgraDev101/Indian-Member-of-Parliament-Database-Creation path: /url_scrap_selenium.py from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common...
code_fim
medium
{ "lang": "python", "repo": "AgraDev101/Indian-Member-of-Parliament-Database-Creation", "path": "/url_scrap_selenium.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(len(data)) with open("url_output.py", "w") as f: f.seek(0) f.write("urls = " + str(data))<|fim_prefix|># repo: AgraDev101/Indian-Member-of-Parliament-Database-Creation path: /url_scrap_selenium.py from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.commo...
code_fim
medium
{ "lang": "python", "repo": "AgraDev101/Indian-Member-of-Parliament-Database-Creation", "path": "/url_scrap_selenium.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AgraDev101/Indian-Member-of-Parliament-Database-Creation path: /url_scrap_selenium.py from selenium import webdriver from selenium.webdriver.common.keys import Keys from selenium.common.exceptions import NoSuchElementException from bs4 import BeautifulSoup import requests import io import time d...
code_fim
hard
{ "lang": "python", "repo": "AgraDev101/Indian-Member-of-Parliament-Database-Creation", "path": "/url_scrap_selenium.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mpc = MainProductsCategorie.objects.all() psc = ProductsSubCategorie.objects.all() output = 'Доступные категории:\n' for mc in mpc: output += mc.name + "\n\n" for sc in psc: if sc.parent == mc: ou...
code_fim
medium
{ "lang": "python", "repo": "AIexBondar/my_works", "path": "/projectamber/botapp/tasks.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: AIexBondar/my_works path: /projectamber/botapp/tasks.py from __future__ import absolute_import, unicode_literals import logging from products.models import MainProductsCategorie, ProductsSubCategorie, Product from django.urls import reverse from celery import shared_task import telebot <|fi...
code_fim
hard
{ "lang": "python", "repo": "AIexBondar/my_works", "path": "/projectamber/botapp/tasks.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """ Sets the axis2 limits """ if start > end: raise ValueError("Start point over end for this view.") self.axis2_limits = start, end def clear_limits(self): """ Clears all limits """ self.axis1_limits = None ...
code_fim
hard
{ "lang": "python", "repo": "PaNOSC-ViNYL/McStasScript", "path": "/mcstasscript/instrument_diagnostics/view.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if packet.haslayer(scapy.Raw): text = packet[scapy.Raw].load text = text.decode('utf-8') for keyword in self.keywords: if keyword in text: if not text == self.login_text: self.classPrint("LOGIN : " + te...
code_fim
hard
{ "lang": "python", "repo": "1nfos3c/GG-HTTP", "path": "/mitmkit/packet_sniffer_class.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #Adds a class name to the printed messages. msg = "{} {} -> \t{}".format(icon,self.print_name,text) self.logger.info(msg) def join(self, timeout=None): #for joining the thread / stopping the sniffing self.stop_sniffing.set() self.classPrint("Stopping."...
code_fim
hard
{ "lang": "python", "repo": "1nfos3c/GG-HTTP", "path": "/mitmkit/packet_sniffer_class.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 1nfos3c/GG-HTTP path: /mitmkit/packet_sniffer_class.py # -*- coding: utf-8 -*- # Sniffs HTTPRequest packages using scapy # the script tries to filter out useless info and duplicates import scapy.all as scapy from scapy_http import http from threading import Thread, Event import argparse import l...
code_fim
hard
{ "lang": "python", "repo": "1nfos3c/GG-HTTP", "path": "/mitmkit/packet_sniffer_class.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.normalize == True: distance_from_min = y - (-0.5) total_distance = (self.original_y_max - self.original_y_min) output = self.original_y_min + (distance_from_min * total_distance) else: output=y #print("-exit bartpy/bartpy/data...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/bartpy/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Encapsulates the data within a split of feature space. Primarily used to cache computations on the data for better performance Parameters ---------- X: np.ndarray The subset of the covariate matrix that falls into the split y: np.ndarray The subset of the t...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/bartpy/data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: odchavez/CausalDART path: /bartpy/bartpy/data.py self._splittable_variables = [x if x is False else None for x in splittable_variables] else: self._splittable_variables = [None for _ in range(self._n_features)] self._max_values = [None] * self._n_features ...
code_fim
hard
{ "lang": "python", "repo": "odchavez/CausalDART", "path": "/bartpy/bartpy/data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 打开数据库连接 db = pymysql.connect(host="192.168.0.168", port=3306, user="root", passwd='001233', db="kuaik", charset="utf8") # 使用cursor()方法获取游标对象 cursor = db.cursor() # 使用预处理语句创建表 try: # 执行sql sql = "INSERT INTO resource (`id`, `subject`, `publish`, `version`, `grade`,...
code_fim
medium
{ "lang": "python", "repo": "kuaikang/python3", "path": "/基础知识/数据库存储/Redis/connection.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kuaikang/python3 path: /基础知识/数据库存储/Redis/connection.py import pymysql def get_list(): with open("语文湘教版二上(标准版).txt",mode="r",encoding="utf-8") as f: data = f.read() print(data) <|fim_suffix|> # 打开数据库连接 db = pymysql.connect(host="192.168.0.168", port=3306, user="root", ...
code_fim
medium
{ "lang": "python", "repo": "kuaikang/python3", "path": "/基础知识/数据库存储/Redis/connection.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if genderNum == "1": print('male') elif genderNum == "2": print('female') decideGender(genderNum)<|fim_prefix|># repo: crazywook/start-python path: /quiz-base/string/quiz1.py pin="881120-1068234" splitted = pin.split("-") yyyymmdd = splitted[0] num = splitted[1] <|fim_middle|>print(yyyymmdd...
code_fim
medium
{ "lang": "python", "repo": "crazywook/start-python", "path": "/quiz-base/string/quiz1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: crazywook/start-python path: /quiz-base/string/quiz1.py pin="881120-1068234" splitted = pin.split("-") yyyymmdd = splitted[0] num = splitted[1] <|fim_suffix|>def decideGender(num): if genderNum == "1": print('male') elif genderNum == "2": print('female') decideGender(genderNum)<|fim...
code_fim
easy
{ "lang": "python", "repo": "crazywook/start-python", "path": "/quiz-base/string/quiz1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 4teamwork/opengever.core path: /opengever/task/tests/test_transition_extender.py from ftw.builder import Builder from ftw.builder import create from opengever.base.transition import ITransitionExtender from opengever.testing import FunctionalTestCase from plone import api from zope.component impo...
code_fim
hard
{ "lang": "python", "repo": "4teamwork/opengever.core", "path": "/opengever/task/tests/test_transition_extender.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> wftool = api.portal.get_tool("portal_workflow") chain = wftool.getChainForPortalType("opengever.task.task")[0] workflow = wftool.get(chain) for transition_name in list(workflow.transitions): extender = queryMultiAdapter( (task, self.request), ...
code_fim
hard
{ "lang": "python", "repo": "4teamwork/opengever.core", "path": "/opengever/task/tests/test_transition_extender.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def getQueryBus(self): if self._query_bus is None: self._query_bus = self._make_default_querybus({ RequestScheduledTasksHandler: RequestScheduledJobs, RequestTaskInfoHandler: RequestJobInfo, FindNodeWithAvailableResourcesH...
code_fim
hard
{ "lang": "python", "repo": "bigr-erasmusmc/StrongR", "path": "/strongr/schedulerdomain/service/schedulerservice.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: bigr-erasmusmc/StrongR path: /strongr/schedulerdomain/service/schedulerservice.py from strongr.core.abstracts.abstractservice import AbstractService from strongr.schedulerdomain.command import ScheduleJob, RunEnqueuedJobs,\ StartJobOnVm, CheckJobsRunni...
code_fim
hard
{ "lang": "python", "repo": "bigr-erasmusmc/StrongR", "path": "/strongr/schedulerdomain/service/schedulerservice.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OscarMaestre/pruebas_proceso path: /utilidades/src/utilidades/basedatos/GestorBD.py #!/usr/bin/env python3 # coding=utf-8 import sqlite3 import os import platform import tempfile from .ConstantesBaseDatosSQLite import * class GestorBD(object): def __init__(self, archivo_db): s...
code_fim
hard
{ "lang": "python", "repo": "OscarMaestre/pruebas_proceso", "path": "/utilidades/src/utilidades/basedatos/GestorBD.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def ejecutar_sentencias(self, lista_sentencias): for sql in lista_sentencias: if self.debug: print("-"*20) print (sql) print("-"*20) try: self.cursor.execute(sql) except: print("...
code_fim
hard
{ "lang": "python", "repo": "OscarMaestre/pruebas_proceso", "path": "/utilidades/src/utilidades/basedatos/GestorBD.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.cursor.close() def get_descripcion(self): return self.cursor.description def get_nombres_columnas(self): descripciones=self.cursor.description nombres_columnas=[] for d in descripciones: nombres_columnas.append ( d[0] ) retu...
code_fim
hard
{ "lang": "python", "repo": "OscarMaestre/pruebas_proceso", "path": "/utilidades/src/utilidades/basedatos/GestorBD.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AuyLocks/PycharmProjects path: /Franky/Chapter 4/methods.py # # Finding a Value in a List with the .index() Method # # spam = ['hello', 'hi', 'howdy', 'heyas'] # print(spam.index('hello')) # results would be 0 # print(spam.index('heyas')) # results would be 3 # print(spam.index('howdy howdy h...
code_fim
hard
{ "lang": "python", "repo": "AuyLocks/PycharmProjects", "path": "/Franky/Chapter 4/methods.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>######################################################## ## Sortind the Values in a List with the sort() Method # spam = [2, 5, 3.14, 1, -7] # spam.sort() # print(spam) # returns [-7, 1, 2, 3.14, 5] # # spamOne = ['cats', 'ants', 'dogs', 'badgers', 'elephants'] # spamOne.sort() # print(spamOne) # re...
code_fim
hard
{ "lang": "python", "repo": "AuyLocks/PycharmProjects", "path": "/Franky/Chapter 4/methods.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stdout = outfiles.pop("stdout") # nwmol, if it exists, is dinky, just a clue to geometry of nwchem results qcvars, gradient, hessian = harvest(input_model.molecule, stdout, **outfiles) if gradient is not None: qcvars["CURRENT GRADIENT"] = gradient if ...
code_fim
hard
{ "lang": "python", "repo": "bgpeyton/QCEngine", "path": "/qcengine/programs/turbomole/runner.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: brynportella/budgetingapp path: /budgetingapp/urls.py """budgetingapp URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/3.1/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import vie...
code_fim
medium
{ "lang": "python", "repo": "brynportella/budgetingapp", "path": "/budgetingapp/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path('admin/', admin.site.urls), path('users/', include('users.urls')), path('users/', include('django.contrib.auth.urls')), path('favicon.ico/', favicon_view), re_path(r'^favicon\.ico$', favicon_view), path('', views.home, name='home'), path('home/', views.hom...
code_fim
medium
{ "lang": "python", "repo": "brynportella/budgetingapp", "path": "/budgetingapp/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^add_hero/(?P<b_id>\d+)/',views.add_hero,name='add_hero'), url(r'^update/',views.update,name='update'), # url(r'^test/',Test.Views(),name='uprdate'), ]<|fim_prefix|># repo: hansomeJ/webapp path: /mysite/booket/urls.py from django.urls import path from django.conf.urls import url from . imp...
code_fim
hard
{ "lang": "python", "repo": "hansomeJ/webapp", "path": "/mysite/booket/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hansomeJ/webapp path: /mysite/booket/urls.py from django.urls import path from django.conf.urls import url from . import views app_name='booket' urlpatterns = [ url(r'^index/',views.index,name='index'), url(r'^book_name/',views.book_name,name='book_name'), url(r'^author/',views.author...
code_fim
medium
{ "lang": "python", "repo": "hansomeJ/webapp", "path": "/mysite/booket/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> buildConnection() while 1: text = receive() text = str(text) if "PRIVMSG " + nickname in text: print(text) elif "PING :" in text: print(text) send("PONG :pingis\n") else: valid() todo = sys.argv[1] if todo == 'ep1': send("PRIVMSG Candy :!ep1") datarecv = receive() ...
code_fim
hard
{ "lang": "python", "repo": "grnbeltwarrior/IRC_Bot", "path": "/IRC_Botv2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: grnbeltwarrior/IRC_Bot path: /IRC_Botv2.py #!/usr/bin/python3 import base64 import codecs import math import socket import sys import time import zlib server = 'irc.root-me.org' port = 6667 nickname = 'Py_Botv2' channel = '#root-me_challenge' bot = 'Candy' user = "USER %s %s %s %s\n" % (nickna...
code_fim
hard
{ "lang": "python", "repo": "grnbeltwarrior/IRC_Bot", "path": "/IRC_Botv2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def destroy(self): self.destroy_start_frame = self.game.elapsed_ms self.status = Mirror.DESTROYED def display(self, screen): if self.is_visible(): x1 = 0 x2 = 0 y1 = 0 y2 = 0 d = 1 if self.game.frame ...
code_fim
hard
{ "lang": "python", "repo": "chihaoui-dev/Arcade-CS-Games", "path": "/minigames/mirrors/entities/mirror.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chihaoui-dev/Arcade-CS-Games path: /minigames/mirrors/entities/mirror.py import os import pygame import random class Mirror: SCALE = 3 SHOWING = 0 WAITING = 1 HIDING = 2 DESTROYED = 3 SHOW_ANIMATION_DURATION = 25 HIDE_ANIMATION_DURATION = 10 DESTROY_ANIMATION_F...
code_fim
hard
{ "lang": "python", "repo": "chihaoui-dev/Arcade-CS-Games", "path": "/minigames/mirrors/entities/mirror.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: smallbee3/Subway_Server path: /app/ingredients/serializers/cheese.py from rest_framework import serializers from utils.exceptions.get_object_or_404 import get_object_or_404_customed from ..models import Cheese class CheeseSerializer(serializers.ModelSerializer): class Meta: model =...
code_fim
medium
{ "lang": "python", "repo": "smallbee3/Subway_Server", "path": "/app/ingredients/serializers/cheese.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> serializer = CheeseSerializer(value) return serializer.data def to_internal_value(self, data): cheese_name = data.get('name') cheese = get_object_or_404_customed(Cheese, name=cheese_name) return cheese<|fim_prefix|># repo: smallbee3/Subway_Server path: /app/in...
code_fim
medium
{ "lang": "python", "repo": "smallbee3/Subway_Server", "path": "/app/ingredients/serializers/cheese.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if alpha > 0 and (g == 0).sum() > 0: return torch.min(a_, b_) return g<|fim_prefix|># repo: ISMHinoLab/geodesical_skew_divergence path: /gs_divergence/alpha_geodesic.py import torch def alpha_geodesic( a: torch.Tensor, b: torch.Tensor, alpha: float, lmd: flo...
code_fim
hard
{ "lang": "python", "repo": "ISMHinoLab/geodesical_skew_divergence", "path": "/gs_divergence/alpha_geodesic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ISMHinoLab/geodesical_skew_divergence path: /gs_divergence/alpha_geodesic.py import torch def alpha_geodesic( a: torch.Tensor, b: torch.Tensor, alpha: float, lmd: float ) -> torch.Tensor: r""" $\alpha$-geodesic between two probability distributions """ <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "ISMHinoLab/geodesical_skew_divergence", "path": "/gs_divergence/alpha_geodesic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: crowlec8/CSU33012_Practical_visualisation path: /practicalVisualiser/firstUI/views.py from django.shortcuts import render from github import Github # Create your views here. g = Github(token) #take token from github repository = 'CSU33012_Practical_visualisation' #pass any repository linked to u...
code_fim
hard
{ "lang": "python", "repo": "crowlec8/CSU33012_Practical_visualisation", "path": "/practicalVisualiser/firstUI/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#function used to return lists of contributers' commits def getContributorsCommits(): listOfCommits = [] for contributor in contributors: contributorCommits = repo.get_commits(author = contributor.login).totalCount listOfCommits.append(contributorCommits) return listOfCommits ...
code_fim
hard
{ "lang": "python", "repo": "crowlec8/CSU33012_Practical_visualisation", "path": "/practicalVisualiser/firstUI/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 点击加入购物车按钮 def click_add_to_cart_btn(self): return self.click(self.add_to_cart_btn)<|fim_prefix|># repo: liurongrong666/AutoTest_PO path: /page/goods_search_page.py from selenium.webdriver.common.by import By from base.base_action import BaseAction <|fim_middle|>class GoodsSearchPage(B...
code_fim
medium
{ "lang": "python", "repo": "liurongrong666/AutoTest_PO", "path": "/page/goods_search_page.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: liurongrong666/AutoTest_PO path: /page/goods_search_page.py from selenium.webdriver.common.by import By from base.base_action import BaseAction class GoodsSearchPage(BaseAction): <|fim_suffix|> return self.click(self.add_to_cart_btn)<|fim_middle|> # 加入购物车按钮 (目的: 为了跳转到商品详情) add_...
code_fim
medium
{ "lang": "python", "repo": "liurongrong666/AutoTest_PO", "path": "/page/goods_search_page.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self.click(self.add_to_cart_btn)<|fim_prefix|># repo: liurongrong666/AutoTest_PO path: /page/goods_search_page.py from selenium.webdriver.common.by import By from base.base_action import BaseAction <|fim_middle|> class GoodsSearchPage(BaseAction): # 加入购物车按钮 (目的: 为了跳转到商品详情) add_...
code_fim
medium
{ "lang": "python", "repo": "liurongrong666/AutoTest_PO", "path": "/page/goods_search_page.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x = self.relu(self.fc2(x)) x = self.drop(x) x = self.relu(self.fc3(x)) x = self.drop(x) x = self.fc4(x) x = self.sigmoid(self.classifier(x)) return x.squeeze(), None def __str__(self) -> str: """Representat...
code_fim
hard
{ "lang": "python", "repo": "arnauddhaene/deep-learning-mini-projects-ee559", "path": "/Proj1-extended/src/models/mlp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arnauddhaene/deep-learning-mini-projects-ee559 path: /Proj1-extended/src/models/mlp.py import torch import torch.nn as nn from models.custom import SizeableModule, NamedModule, WeightInitializableModule class MLP(SizeableModule, NamedModule, WeightInitializableModule): """Multi Layer Percep...
code_fim
medium
{ "lang": "python", "repo": "arnauddhaene/deep-learning-mini-projects-ee559", "path": "/Proj1-extended/src/models/mlp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_create_bucket_list_name(self): """ Tests if the create bucket list method checks for a name """ bucket = BucketList("", "") bucket = bucket.create_bucket_list("") self.assertEqual(bucket, "Please provide a name for your bucket list", ) if __n...
code_fim
hard
{ "lang": "python", "repo": "zmwas/python_bucket_list", "path": "/tests/test_bucket_list_methods.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zmwas/python_bucket_list path: /tests/test_bucket_list_methods.py """This module contains tests for bucket list methods """ import unittest from bucket_app.buckets import BucketList class TestBucket(unittest.TestCase): """TestCase class for BucketList. """ def setUp(self): ...
code_fim
medium
{ "lang": "python", "repo": "zmwas/python_bucket_list", "path": "/tests/test_bucket_list_methods.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.my_bucket = BucketList("My resolutions", "In Progress") def test_create_bucket_list_return(self): """ Tests if a bucket list method is returned by the create bucket list method. """ bucket = BucketList("", "") bucket = bucket.create_bucket_list("N...
code_fim
medium
{ "lang": "python", "repo": "zmwas/python_bucket_list", "path": "/tests/test_bucket_list_methods.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class TANH(Activation): def func(self, x: float) -> float: return np.tanh(x) def grad(self, x: float) -> float: return 1. - np.tanh(x) * np.tanh(x) class SIGMOID(Activation): def func(self, x: float) -> float: return 1. / (1 + np.exp(-x)) def grad(self, x: float) -> float: return 1. / (1 ...
code_fim
medium
{ "lang": "python", "repo": "dunnkers/toy-neural-network", "path": "/toynn/activations.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }