text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>
pcUA = ['Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_8; en-us) AppleWebKit/534.50 (KHTML, like Gecko) Version/5.1 Safari/534.50',
'Mozilla/5.0 (iPad; U; CPU OS 4_3_3 like Mac OS X; en-us) AppleWebKit/533.17.9 (KHTML, like Gecko) Version/5.0.2 Mobile/8J2 Safari/6533.18.5']
mWidth = 1440
mHeig... | code_fim | hard | {
"lang": "python",
"repo": "xwh-p/taobao",
"path": "/6.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> return webdriver.Chrome(chrome_options=chrome_options)
def detaail_page(item):
headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"accept-encoding": "gzip, deflate, br",
"accept-language": "zh-CN,zh;q=0.9",
... | code_fim | hard | {
"lang": "python",
"repo": "xwh-p/taobao",
"path": "/6.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: xwh-p/taobao path: /6.py
import random
import re
import time
import requests
from lxml import etree
from selenium import webdriver
headers = {
"accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8",
"accept-encoding": "gzip, deflate, br",
"a... | code_fim | hard | {
"lang": "python",
"repo": "xwh-p/taobao",
"path": "/6.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: elados93/trex-core path: /scripts/external_libs/pyzmq-ctypes/zmq/context.py
'''
Based on pyzmq-ctypes and pyzmq
Updated to work with latest ZMQ shared object
https://github.com/zeromq/pyzmq
https://github.com/svpcom/pyzmq-ctypes
'''
from zmq.bindings import *
from zmq.socket import *
from zmq.e... | code_fim | hard | {
"lang": "python",
"repo": "elados93/trex-core",
"path": "/scripts/external_libs/pyzmq-ctypes/zmq/context.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def term(self):
rc = zmq_ctx_destroy(self.handle)
try:
_check_rc(rc)
except InterruptedSystemCall:
# ignore interrupted term
# see PEP 475 notes about close & EINTR for why
pass
self.handle = None
self._closed = T... | code_fim | medium | {
"lang": "python",
"repo": "elados93/trex-core",
"path": "/scripts/external_libs/pyzmq-ctypes/zmq/context.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jmg/simple-web-browser path: /baseBrowser.py
from PyQt4 import QtCore, QtWebKit, QtGui
from GUI.main import BrowserGUI, BrowserTabGUI
actions = {"Alt+Left" : QtWebKit.QWebPage.Back, "Alt+Right" : QtWebKit.QWebPage.Forward, "F5" : QtWebKit.QWebPage.Reload }
class BaseBrowser(BrowserGUI):
"""... | code_fim | hard | {
"lang": "python",
"repo": "jmg/simple-web-browser",
"path": "/baseBrowser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
This class is the base for a browser tab
Inherit from this class and override all the virtual methods
to make a browser tab
"""
def __init__(self, parent):
BrowserTabGUI.__init__(self, parent)
self.connect(self.parent.bt_back, QtCore.SIGNAL("clic... | code_fim | hard | {
"lang": "python",
"repo": "jmg/simple-web-browser",
"path": "/baseBrowser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
BrowserTabGUI.__init__(self, parent)
self.connect(self.parent.bt_back, QtCore.SIGNAL("clicked()"), self.back)
self.connect(self.parent.bt_ahead, QtCore.SIGNAL("clicked()"), self.ahead)
self.connect(self.parent.bt_reload, QtCore.SIGNAL("clicked()"), self.reload)
se... | code_fim | hard | {
"lang": "python",
"repo": "jmg/simple-web-browser",
"path": "/baseBrowser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r_omeda.andr_bot.tasks import async_set_webhook<|fim_prefix|># repo: IhebTrabelsi/andr_omeda path: /andr_omeda/andr_bot/signals.py
from django.db.models.signals import post_save<|fim_middle|>
from django.dispatch import receiver
from andr_omeda.andr_bot.models.bot import Bot
from and | code_fim | medium | {
"lang": "python",
"repo": "IhebTrabelsi/andr_omeda",
"path": "/andr_omeda/andr_bot/signals.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IhebTrabelsi/andr_omeda path: /andr_omeda/andr_bot/signals.py
from django.db.models.signals import post_save<|fim_suffix|>r_omeda.andr_bot.tasks import async_set_webhook<|fim_middle|>
from django.dispatch import receiver
from andr_omeda.andr_bot.models.bot import Bot
from and | code_fim | medium | {
"lang": "python",
"repo": "IhebTrabelsi/andr_omeda",
"path": "/andr_omeda/andr_bot/signals.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: binfen1/PythonWithHardware path: /CyberPi/Python with CyberPi 054(usocket 控制无人机).py
""""
名称:54 童芯派控制Tello无人机(MicroPython usocket标准库)
硬件: 童芯派
功能介绍:简单的利用童芯派实现对Tello无人机的起飞降落控制。
难度:⭐⭐⭐⭐⭐⭐
支持的模式:上传
"""
# ---------程序分割线----------------程序分割线----------------程序分割线----------
<|fim_suffix|>
while True:... | code_fim | hard | {
"lang": "python",
"repo": "binfen1/PythonWithHardware",
"path": "/CyberPi/Python with CyberPi 054(usocket 控制无人机).py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
while True:
if cyberpi.controller.is_press("up"):
cyberpi.console.println("command")
msg = b"command"
# msg = msg.encode()
sock.sendto(msg, tello_address)
time.sleep(0.5)
if cyberpi.controller.is_press("a"):
cyberpi.console.println("off")
ms... | code_fim | hard | {
"lang": "python",
"repo": "binfen1/PythonWithHardware",
"path": "/CyberPi/Python with CyberPi 054(usocket 控制无人机).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>host = ''
port = 9000
locaddr = usocket.getaddrinfo(host, port)[0][-1]
print(locaddr)
sock = usocket.socket(usocket.AF_INET, usocket.SOCK_DGRAM)
tello_address = ('192.168.10.1', 8889)
sock.bind(locaddr)
msg = None
while True:
if cyberpi.controller.is_press("up"):
cyberpi.console.println("com... | code_fim | medium | {
"lang": "python",
"repo": "binfen1/PythonWithHardware",
"path": "/CyberPi/Python with CyberPi 054(usocket 控制无人机).py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>hdulist = fits.BinTableHDU.from_columns(cols)
header = hdulist.header
hdulist.writeto(dir+args.type+args.region+args.version+args.output+'.dat.fits', overwrite=True)
cols = []
RAc = fits.Column(name='RA',format='D', array=ran.RA)
cols.append(RAc)
DECc = fits.Column(name='DEC',format='D', array=ran.DEC)
c... | code_fim | hard | {
"lang": "python",
"repo": "ashleyjross/mkAllsamples",
"path": "/do_recon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ashleyjross/mkAllsamples path: /do_recon.py
'''
Copied from Julian Bautista to be used as a general script to execute eBOSS reconstruction
'''
#from ebosscat import Catalog
from recon import Recon
import argparse
from astropy.io import fits
import numpy as np
from cattools import *
dir = '/User... | code_fim | hard | {
"lang": "python",
"repo": "ashleyjross/mkAllsamples",
"path": "/do_recon.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>cols = []
RAc = fits.Column(name='RA',format='D', array=cat.RA)
cols.append(RAc)
DECc = fits.Column(name='DEC',format='D', array=cat.DEC)
cols.append(DECc)
Zc = fits.Column(name='Z',format='D', array=cat.Z)
cols.append(Zc)
fkpc = fits.Column(name='WEIGHT_FKP',format='D', array=cat.WEIGHT_FKP)
cols.append(... | code_fim | hard | {
"lang": "python",
"repo": "ashleyjross/mkAllsamples",
"path": "/do_recon.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for i in range(0,inp.shape[0]-1):
output[int(i*scale),:]=inp[i,:]
output[int(i*scale+1):int((i+1)*scale),:]=intermediate[int(i*(scale-1)):int((i+1)*(scale-1)),:]
output[-1,:]=inp[-1,:]
return output<|fim_prefix|># repo: DimitriosBellos/UDNN path: /udnn/u... | code_fim | hard | {
"lang": "python",
"repo": "DimitriosBellos/UDNN",
"path": "/udnn/utils/merge.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def expr_d(self):
node = self.expr_e()
while (
self._cur.type == SYMBOL
and self._cur.meta in ("<=", "<", ">", ">=")
):
sym = self.eat(SYMBOL)
node = CmpNode(node, sym.meta, self.expr_e())
return node
def expr_c(self)... | code_fim | hard | {
"lang": "python",
"repo": "Bottersnike/whilelang",
"path": "/whilelang/parser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Bottersnike/whilelang path: /whilelang/parser.py
from .base_parser import BaseParser
from .const import DIRECTIVE, NUMBER, SYMBOL, NAME, KEYWORD, BOOLEAN, EOF, ANY
from .nodes import (
EvalNode, SuiteNode, SkipNode, IfNode, WhileNode, AssignNode, VariableNode, NotNode,
ConstantNode, MulNo... | code_fim | hard | {
"lang": "python",
"repo": "Bottersnike/whilelang",
"path": "/whilelang/parser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Genora51/Bitwise path: /blib/bitparser.py
from .basefuncs import *
try:
from functional import compose
except ImportError:
raiseErrN("You need functional!\nInstall it from http://pypi.python.org/pypi/functional\nor run pip install functional.")
def ParserError(message, token):
... | code_fim | hard | {
"lang": "python",
"repo": "Genora51/Bitwise",
"path": "/blib/bitparser.py",
"mode": "psm",
"license": "CC-BY-3.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@ParseRunner(3)
def parenParser(tkens, pos):
if (tkens[pos].tag == LPAREN and
tkens[pos + 1].tag in EXPRESSION and
tkens[pos + 2].tag == RPAREN):
# parses expression
return tkens[pos + 1]
else:
return None
@ParseRunner(3)
def asopPars... | code_fim | hard | {
"lang": "python",
"repo": "Genora51/Bitwise",
"path": "/blib/bitparser.py",
"mode": "spm",
"license": "CC-BY-3.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_iniciar_elenco(self):
ControllerElenco.IniciarElenco()
e = ControllerElenco.BuscarTodosElenco()
self.assertEqual(2, len(e))
if __name__ == '__main__':
unittest.main(exit=False)<|fim_prefix|># repo: ygorclima/apd path: /Elenco/TestElenco.py
import unittest... | code_fim | hard | {
"lang": "python",
"repo": "ygorclima/apd",
"path": "/Elenco/TestElenco.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> ControllerElenco.AdicionarAtor(1,1,1,"Coadjuvante")
ControllerElenco.RemoverElenco(1)
e = ControllerElenco.BuscarElenco(1)
self.assertIsNone(e)
def test_remover_todos_elenco(self):
ControllerElenco.AdicionarAtor(1,1,1,"Coadjuvante")
ControllerElenco.Adi... | code_fim | hard | {
"lang": "python",
"repo": "ygorclima/apd",
"path": "/Elenco/TestElenco.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DealPete/challenge path: /euler/thirtythree.py
import fractions
from algebra import cancel
from integer import digitsToNumber
for i in rang<|fim_suffix|>list(str(j)))
f0 = digitsToNumber(f[0])
f1 = digitsToNumber(f[1])
if 0 < f0 < 10 and 0 < f1 < 10 :
if fractions.Fraction(f... | code_fim | medium | {
"lang": "python",
"repo": "DealPete/challenge",
"path": "/euler/thirtythree.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>0 < f1 < 10 :
if fractions.Fraction(f0, f1) == fractions.Fraction(i, j) :
print (i, j)<|fim_prefix|># repo: DealPete/challenge path: /euler/thirtythree.py
import fractions
from algebra import cancel
from integer import digitsToNumber
for i in rang<|fim_middle|>e(10,99) :
for j in range(... | code_fim | medium | {
"lang": "python",
"repo": "DealPete/challenge",
"path": "/euler/thirtythree.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif comp_choice == "scissors":
print("You chose scissors. The computer chose scissors. You tied.")
print("")
print("Player wins: " + str(player_wins))
print("Computer wins: " + str(computer_wins))
print("")
user_choice = input("Do you want to play again? (y/n) : ... | code_fim | hard | {
"lang": "python",
"repo": "shivam188/rps_game_python",
"path": "/rock_paper_scissor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user_choice = input("Do you want to play again? (y/n) : ")
if user_choice in ["Y", "y", "yes", "Yes"]:
pass
elif user_choice in ["N", "n", "no", "No"]:
break
else:
break<|fim_prefix|># repo: shivam188/rps_game_python path: /rock_paper_scissor.py
import random
comp... | code_fim | hard | {
"lang": "python",
"repo": "shivam188/rps_game_python",
"path": "/rock_paper_scissor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shivam188/rps_game_python path: /rock_paper_scissor.py
import random
computer_wins = 0
player_wins = 0
while True:
print("")
user_choice = input("Choose Rock, Paper or Scissors : ")
user_choice = user_choice.lower()
moves = ["rock","paper","scissors"]
comp_choice = random.... | code_fim | hard | {
"lang": "python",
"repo": "shivam188/rps_game_python",
"path": "/rock_paper_scissor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: A-AFTAHI/AndroidManifest_Analyzer path: /manifest_analyser.py
plication to function correctly."
state = 'Warning'
print "\nparameter : %s\nvalue : Dangerous permission\ndescription : %s\nimpact : %s\nrecommandation : %s\nstatus : %s\n"%(usesper.getAttribute("android:name")... | code_fim | hard | {
"lang": "python",
"repo": "A-AFTAHI/AndroidManifest_Analyzer",
"path": "/manifest_analyser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: A-AFTAHI/AndroidManifest_Analyzer path: /manifest_analyser.py
el")
if (not protectLevel) or (protectLevel == "normal"):
des="The system will automatically grant this permission to a requesting application at installation, without asking for the user explicit approval."
... | code_fim | hard | {
"lang": "python",
"repo": "A-AFTAHI/AndroidManifest_Analyzer",
"path": "/manifest_analyser.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif ifilter and sp:
des="the service is exported but only with applications which have specific permission. this way service data are only shared with legitime applications"
state = 'Good'
print "\nparameter : %s\nvalue : Service\ndescription %s... | code_fim | hard | {
"lang": "python",
"repo": "A-AFTAHI/AndroidManifest_Analyzer",
"path": "/manifest_analyser.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># figure(2)
# title(u"3vs3, 4 process, Without data security")
# t = [u" Initial write ",u" Rewrite ",u" Read ",u" Re-read ",u" Random read ",u" Random write ",]
# for x in xrange(len(t)):
# k = t[x]
# figx = []
# figy = []
# for i in xrange(len(blockSize))... | code_fim | hard | {
"lang": "python",
"repo": "lavenresearch/autoscaleStorage",
"path": "/utility/hotsoptAnalysis.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lavenresearch/autoscaleStorage path: /utility/hotsoptAnalysis.py
from pylab import *
import seaborn as sns
import json
# load data
migrationEffect1 = {}
migrationEffect2 = {}
# f = open("migrationEffect","r")
# migrationEffect1 = json.loads(f.read())
# f.close()
f = open("migrationEffect4","r")... | code_fim | hard | {
"lang": "python",
"repo": "lavenresearch/autoscaleStorage",
"path": "/utility/hotsoptAnalysis.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ANh0r/LeetCode-Daily path: /3.18 reverseBetween.py
# Definition for singly-linked list.
# class ListNode:
# def __init__(self, val=0, next=None):
# self.val = val
# self.next = next
class Solution:
<|fim_suffix|> a = []
cur = head
while (cur):
... | code_fim | medium | {
"lang": "python",
"repo": "ANh0r/LeetCode-Daily",
"path": "/3.18 reverseBetween.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> a = []
cur = head
while (cur):
a.append(cur.val)
cur = cur.next
if left>1:
a = a[:left-1] + a[right-1:left-2:-1] + a[right:]
else:
a = a[right-1::-1] + a[right:]
cur = head
i = 0
while (cur):
... | code_fim | medium | {
"lang": "python",
"repo": "ANh0r/LeetCode-Daily",
"path": "/3.18 reverseBetween.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Haller-x/BioSeq path: /bio_seq.py
from Bio import SeqIO
from Bio import pairwise2
from Bio.Seq import Seq
from Bio.Alphabet import generic_dna# i need to change it
from Bio.SubsMat import MatrixInfo as matlist
from tkinter import filedialog
import tkinter.messagebox
import tkinter as tk
import py... | code_fim | hard | {
"lang": "python",
"repo": "Haller-x/BioSeq",
"path": "/bio_seq.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def alignment_matrix():
try:
seq1 = entry_prot_seq1_matrix.get()
seq2 = entry_prot_seq2_matrix.get()
chosen = dict_matrix[chosen_matrix]
alinhamento = pairwise2.align.globaldx(seq1,seq2,chosen)
save_pairwise_prot = tk... | code_fim | hard | {
"lang": "python",
"repo": "Haller-x/BioSeq",
"path": "/bio_seq.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunxianliang1/deeplearning path: /k近邻算法/DeepLearning0713/HandWriteClass.py
# -*- coding: utf-8 -*-
import numpy
import matplotlib.image as mpimg
from os import listdir
import operator
import copy
import time
def img2vector(filename):
img=mpimg.imread(filename)
vec=img.copy()
ret... | code_fim | hard | {
"lang": "python",
"repo": "sunxianliang1/deeplearning",
"path": "/k近邻算法/DeepLearning0713/HandWriteClass.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(TrainData1,Table1)=GetTrainData()
filelist=listdir("E:\\深度学习\\训练集数据\\手写字符\\numbers\\test\\")
TrainNum=len(filelist)
all=right=0
ticks1=time.time()
for i in range(TrainNum):
if(filelist[i].find("png")!=-1):
filename="E:\\深度学习\\训练集数据\\手写字符\\numbers\\test\\"+filelist[i]
indata1=img2vecto... | code_fim | hard | {
"lang": "python",
"repo": "sunxianliang1/deeplearning",
"path": "/k近邻算法/DeepLearning0713/HandWriteClass.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Chronophobe/PyMon path: /battle.py
import sys, random, os
class Monster(object):
exp = 0
level = 1
decay = 0
def __init__(self, name, atk, arm, hp, spec, nextLevel, regen):
self.name = name
self.HP = hp
self.atk = atk
self.armor = armor
se... | code_fim | hard | {
"lang": "python",
"repo": "Chronophobe/PyMon",
"path": "/battle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>hp = 100
atk = 1.0
armor = 1.0
spec = 0.0
regen = 0.0
monsters_slain = 0
opponent = Monster("Bobtimus Prime", 1, 1, 100, 0, 0, 0)
name = raw_input("Your name: ")
player = Monster(name, 1.0, 1.0, 125.0, 0.0, 20.0, 0)
while True:
turn()
if opponent.HP == 0:
player.addExp(10)
monst... | code_fim | hard | {
"lang": "python",
"repo": "Chronophobe/PyMon",
"path": "/battle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: flpdsc/marker_tracking_for_AGV path: /agv_autorace/nodes/leader/sign_detector
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import rospy
import numpy as np
import cv2
from cv_bridge import CvBridge
from sensor_msgs.msg import Image, CompressedImage
class DetectSign():
def __init__(self):
... | code_fim | hard | {
"lang": "python",
"repo": "flpdsc/marker_tracking_for_AGV",
"path": "/agv_autorace/nodes/leader/sign_detector",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # define range of blue color in HSV
lower_blue = np.array([Hue_l, Saturation_l, Lightness_l])
upper_blue = np.array([Hue_h, Saturation_h, Lightness_h])
# Threshold the HSV image to get only blue colors
mask = cv2.inRange(hsv, lower_blue, upper_blue)
# Bitw... | code_fim | hard | {
"lang": "python",
"repo": "flpdsc/marker_tracking_for_AGV",
"path": "/agv_autorace/nodes/leader/sign_detector",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: superstall/python_data_structures path: /project/num1234.py
# aList=[1,2,3,4,5,6,3,8,9]
# sign=False #初始值为没找到
# x=int(input("请输入要查找的整数:"))
# for i in range(len(aList)):
# if aList[i]==x:
# print("整数%d在列表中,在第%d个数"%(x,i+1))
# sign=True
# if sign==False:
# print("整数%d不... | code_fim | hard | {
"lang": "python",
"repo": "superstall/python_data_structures",
"path": "/project/num1234.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __getitem__(self, item):
return self.get(item)
def __setitem__(self, key, value):
self.put(key, value)
h = HashTable()
h[54] = 'cat'
h[26] = 'dog'
h[93] = 'lion'
# h[17] = 'tiger'
# h[77] = 'bird'
# h[85] = 'bee'
# h[34] = 'fish'
print(h.slots)
print(h.data)
print(h.get(54)... | code_fim | hard | {
"lang": "python",
"repo": "superstall/python_data_structures",
"path": "/project/num1234.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return jsonify(data.get_subject_ids())
@application.route("/api/v1.0/info")
def get_all_results():
return jsonify(data.get_data_for_all())
@application.route("/api/v1.0/info/<subject_id>")
def get_one_user_results(subject_id):
return jsonify(data.get_data_by_user(subject_id))
@appli... | code_fim | hard | {
"lang": "python",
"repo": "andersjh/belly_button_2",
"path": "/application.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: andersjh/belly_button_2 path: /application.py
# dependencies
from config import database, connect_string
# relational database class with our data retrieval functions
from BellyButtonData import BellyButtonData
# mongodb database class with the same function signitures ( same functions)
from Bel... | code_fim | hard | {
"lang": "python",
"repo": "andersjh/belly_button_2",
"path": "/application.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gordonbondon/kubernetes-typed path: /kubernetes-stubs/client/models/v1_node_spec.pyi
# Code generated by `stubgen`. DO NOT EDIT.
from kubernetes.client.configuration import Configuration as Configuration
from typing import Any
class V1NodeSpec:
openapi_types: Any
attribute_map: Any
l... | code_fim | hard | {
"lang": "python",
"repo": "gordonbondon/kubernetes-typed",
"path": "/kubernetes-stubs/client/models/v1_node_spec.pyi",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> @property
def provider_id(self): ...
@provider_id.setter
def provider_id(self, provider_id) -> None: ...
@property
def taints(self): ...
@taints.setter
def taints(self, taints) -> None: ...
@property
def unschedulable(self): ...
@unschedulable.setter
def uns... | code_fim | hard | {
"lang": "python",
"repo": "gordonbondon/kubernetes-typed",
"path": "/kubernetes-stubs/client/models/v1_node_spec.pyi",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>scord TOS or you will be punished", inline=True)
embed.add_field(name="Don't advertize", value="Please don't advertize your server in DMS or the server unless you are allowed to", inline=True)
embed.add_field(name="Please post according to the channel", value="Please post the correct conte... | code_fim | hard | {
"lang": "python",
"repo": "ConcordBot/VoyageBot",
"path": "/VoyageBot/cogs/rules.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> loss_avg, n_iter = train(
model=model_core,
data_loader=train_data_loader,
loss_func=loss_func,
optimizer=optimizer,
scheduler=scheduler,
args=args,
n_iter=n_iter
)
... | code_fim | hard | {
"lang": "python",
"repo": "bazhiyong/chempropBayes",
"path": "/chemprop/train/bayes_tr/swag_tstr.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bazhiyong/chempropBayes path: /chemprop/train/bayes_tr/swag_tstr.py
import os
import torch
import numpy as np
import wandb
from ..train import train
from ..evaluate import evaluate
from chemprop.data import MoleculeDataLoader
from chemprop.utils import save_checkpoint
from chemprop.baye... | code_fim | hard | {
"lang": "python",
"repo": "bazhiyong/chempropBayes",
"path": "/chemprop/train/bayes_tr/swag_tstr.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Seq2Seq()
torch.save(model.state_dict(), model_path)
good_count, bad_count = 0, 0
while bad_count < experiment_num_heads or good_count < experiment_num_heads:
attn = Attn_head()
cur_path = 'cur.pt'
torch.save(attn.state_dict(), cur_path)
head_init_pr... | code_fim | hard | {
"lang": "python",
"repo": "Sea-Snell/AttentionDynamics",
"path": "/SequenceCopying/multihead.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sea-Snell/AttentionDynamics path: /SequenceCopying/multihead.py
import torch
from torch import nn
import os
import pickle as pkl
import numpy as np
from typing import List
import random
exp_name = 'all_comb'
exp_dir = exp_name
save_result_dir = exp_dir + '/results/'
num_vocab = 40
end_of_sequenc... | code_fim | hard | {
"lang": "python",
"repo": "Sea-Snell/AttentionDynamics",
"path": "/SequenceCopying/multihead.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getPhysicalPath(self):
return ('', self._path, self._id)
def getPhysicalRoot(self):
return self
def unrestrictedTraverse(self, path, default=None, restricted=0):
if path == ['acl_users']:
return self.acl_users
else:
obj = self
... | code_fim | hard | {
"lang": "python",
"repo": "zopefoundation/Products.CMFCore",
"path": "/src/Products/CMFCore/tests/base/dummy.py",
"mode": "spm",
"license": "ZPL-2.1",
"source": "the-stack-v2"
} |
<|fim_suffix|> def _setObject(self, id, object, suppress_events=False):
if not suppress_events:
notify(ObjectWillBeAddedEvent(object, self, id))
self._setOb(id, object)
object = self._getOb(id)
if hasattr(aq_base(object), 'manage_afterAdd'):
object.manage_after... | code_fim | hard | {
"lang": "python",
"repo": "zopefoundation/Products.CMFCore",
"path": "/src/Products/CMFCore/tests/base/dummy.py",
"mode": "spm",
"license": "ZPL-2.1",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zopefoundation/Products.CMFCore path: /src/Products/CMFCore/tests/base/dummy.py
##############################################################################
#
# Copyright (c) 2002 Zope Foundation and Contributors.
#
# This software is subject to the provisions of the Zope Public License,
# Vers... | code_fim | hard | {
"lang": "python",
"repo": "zopefoundation/Products.CMFCore",
"path": "/src/Products/CMFCore/tests/base/dummy.py",
"mode": "psm",
"license": "ZPL-2.1",
"source": "the-stack-v2"
} |
<|fim_suffix|>it clone cmd
os.system(cmd)########## executing the command
grepcmd='grep -r <pattern>'
os.system(grepcmd)<|fim_prefix|># repo: darshan-raul/Github-Repository-backup-Script path: /cloner.py
import requests
import os
response = requests.get('https://api.github.com/users/<repo_name>/repos').json() ##... | code_fim | medium | {
"lang": "python",
"repo": "darshan-raul/Github-Repository-backup-Script",
"path": "/cloner.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: darshan-raul/Github-Repository-backup-Script path: /cloner.py
import requests
import os
response = requests.get('https://api.github.com/users/<repo_name>/repos').json() <|fim_suffix|>'html_url'])######using this to parse the html url of therepo
cmd='git clone '+url ####adding it to the git ... | code_fim | medium | {
"lang": "python",
"repo": "darshan-raul/Github-Repository-backup-Script",
"path": "/cloner.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jyota/vHunter path: /pstats.py
class PStats():
def __init__(self, hp = 0, ep = 0, attack = 0, eattack = 0, defense = 0, edefense = 0, tough = 0, level = 0, X<|fim_suffix|>atus as 0. This will be filled later as needed will values'''
''' that represent things like poison, speed up, or whateve... | code_fim | hard | {
"lang": "python",
"repo": "jyota/vHunter",
"path": "/pstats.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>atus as 0. This will be filled later as needed will values'''
''' that represent things like poison, speed up, or whatever. '''<|fim_prefix|># repo: jyota/vHunter path: /pstats.py
class PStats():
def __init__(self, hp = 0, ep = 0, attack = 0, eattack = 0, defense = 0, edefense = 0, tough = 0, level ... | code_fim | hard | {
"lang": "python",
"repo": "jyota/vHunter",
"path": "/pstats.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(oBJETO)
#Obj2 = soma_num_pos(2, -3) #Exibe a mensagem dentre o Erro -> 'Numeros Precisam Ser Positivos'
#print(Obj2)
def comer(comida):
assert comida in (
'pizza',
'hamburguer',
'batata_frita'
), \
"A Comida tem que ser Fast Food" #Mensagem que vai aparece... | code_fim | medium | {
"lang": "python",
"repo": "DiksonSantos/GeekUniversity_Python",
"path": "/142_Assertions(Afirmacoes).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DiksonSantos/GeekUniversity_Python path: /142_Assertions(Afirmacoes).py
"""
Checagens / Questionamentos
Usamos para checar se expressoes no codigo são validas ou não.
Podemos personalizar mensagens de erro.
SE UM PROGRAMA PYTHON FOR EXECUTADO COM O PARAMETRO -O, NENHU ASSERTION
SERÁ VALIDADO. ... | code_fim | medium | {
"lang": "python",
"repo": "DiksonSantos/GeekUniversity_Python",
"path": "/142_Assertions(Afirmacoes).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__=='__main__':
putaospider = spider()
print putaospider.getContent()<|fim_prefix|># repo: rozentill/Spider-for-Fun path: /jike_tutorial/spider-first/coursespider.py
#!/usr/bin/env python
#-*-coding:utf8-*-
import re
import requests
url = 'https://pt.sjtu.edu.cn/torrents.php?inclboo... | code_fim | medium | {
"lang": "python",
"repo": "rozentill/Spider-for-Fun",
"path": "/jike_tutorial/spider-first/coursespider.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rozentill/Spider-for-Fun path: /jike_tutorial/spider-first/coursespider.py
#!/usr/bin/env python
#-*-coding:utf8-*-
import re
import requests
url = 'https://pt.sjtu.edu.cn/torrents.php?inclbookmarked=0&incldead=0&spstate=0&cat=429&page=0'
class spider:
def __init__(self):
self.u... | code_fim | easy | {
"lang": "python",
"repo": "rozentill/Spider-for-Fun",
"path": "/jike_tutorial/spider-first/coursespider.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> response = requests.get(self.url)
return response.content
# def getEachLesson(self,):
if __name__=='__main__':
putaospider = spider()
print putaospider.getContent()<|fim_prefix|># repo: rozentill/Spider-for-Fun path: /jike_tutorial/spider-first/coursespider.py
#!/usr/bi... | code_fim | medium | {
"lang": "python",
"repo": "rozentill/Spider-for-Fun",
"path": "/jike_tutorial/spider-first/coursespider.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tquiviger/market-monitor path: /api/reliefweb_api.py
from api import main_api
base_url = "https://api.reliefweb.int/v1/reports?appname=apidoc"
def get_reports_for_country(iso_code):
<|fim_suffix|> for ocha_product in 20471, 12347, 12348, 12354: # https://api.reliefweb.int/v1/references/och... | code_fim | hard | {
"lang": "python",
"repo": "tquiviger/market-monitor",
"path": "/api/reliefweb_api.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for ocha_product in 20471, 12347, 12348, 12354: # https://api.reliefweb.int/v1/references/ocha-products
report = main_api.call_get(
url=base_url + '&filter[operator]=AND'
'&filter[conditions][0][field]=primary_country.iso3'
'&f... | code_fim | hard | {
"lang": "python",
"repo": "tquiviger/market-monitor",
"path": "/api/reliefweb_api.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if cur.left is None and cur.right is None:
res[0] = max(res[0], cur.val)
return cur.val
fromLeft, fromRight = 0, 0
if cur.left is not None:
fromLeft = dfs(cur.left, res)
... | code_fim | medium | {
"lang": "python",
"repo": "kanglicheng/CodeBreakersCode",
"path": "/recursive/124. Binary Tree Maximum Path Sum(3).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kanglicheng/CodeBreakersCode path: /recursive/124. Binary Tree Maximum Path Sum(3).py
# Definition for a binary tree node.
# class TreeNode:
# def __init__(self, val=0, left=None, right=None):
# self.val = val
# self.left = left
# self.right = right
class Solution:
... | code_fim | hard | {
"lang": "python",
"repo": "kanglicheng/CodeBreakersCode",
"path": "/recursive/124. Binary Tree Maximum Path Sum(3).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return max(cur.val, cur.val + fromLeft, cur.val + fromRight)
res = [-float('inf')]
dfs(root, res)
return res[0]<|fim_prefix|># repo: kanglicheng/CodeBreakersCode path: /recursive/124. Binary Tree Maximum Path Sum(3).py
# Definition for a bina... | code_fim | hard | {
"lang": "python",
"repo": "kanglicheng/CodeBreakersCode",
"path": "/recursive/124. Binary Tree Maximum Path Sum(3).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for genre in self.favorites.keys() :
self.logger.log("Handling genre "+ genre)
if useGenreSubFolder :
os.makedirs(os.path.join(self.configuration['exportDir'],self.setKey,genre))
if scrapeImages :
... | code_fim | hard | {
"lang": "python",
"repo": "Europia79/BestArcade",
"path": "/basicsorter.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Europia79/BestArcade path: /basicsorter.py
# -*- coding: utf-8 -*-
import xml.etree.ElementTree as etree
import os.path, shutil
import gamelist, utils
import fav, dat
class BasicSorter :
def __init__(self,configuration,scriptDir,logger,bioses,setKey) :
self.configuration = co... | code_fim | hard | {
"lang": "python",
"repo": "Europia79/BestArcade",
"path": "/basicsorter.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def format(self, ret):
'''
格式化输出
:param ret:爬去的内容
:return:格式化后的输出
'''
str = ""
for i in ret:
str += u'时间:{0} <a href="{1}">{2}</a><br>'.format(i['time'], i['url'], i['title'])
return str
def save2mysql(self, data, dbname)... | code_fim | hard | {
"lang": "python",
"repo": "lemonbiz/reptiles",
"path": "/anhui.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lemonbiz/reptiles path: /anhui.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import common
from bs4 import BeautifulSoup
import mysqlop
class AnHui():
_url = 'www.ccgp-anhui.gov.cn'
_baseurl = 'http://www.ccgp-anhui.gov.cn/'
_posturl = '/mhxt/MhxtSearchBulletinController.zc?meth... | code_fim | hard | {
"lang": "python",
"repo": "lemonbiz/reptiles",
"path": "/anhui.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> '''
格式化输出
:param ret:爬去的内容
:return:格式化后的输出
'''
str = ""
for i in ret:
str += u'时间:{0} <a href="{1}">{2}</a><br>'.format(i['time'], i['url'], i['title'])
return str
def save2mysql(self, data, dbname):
ret = True
... | code_fim | hard | {
"lang": "python",
"repo": "lemonbiz/reptiles",
"path": "/anhui.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return 'From: '+self.sender.user.username+' Title: '+self.subject<|fim_prefix|># repo: nazaninsbr/Django-ChatJS-Dashboard path: /aie/contact/models.py
from django.db import models
from accounts.models import Profile
# Create your models here.
<|fim_middle|>class ContactMessage(mode... | code_fim | hard | {
"lang": "python",
"repo": "nazaninsbr/Django-ChatJS-Dashboard",
"path": "/aie/contact/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nazaninsbr/Django-ChatJS-Dashboard path: /aie/contact/models.py
from django.db import models
from accounts.models import Profile
# Create your models here.
class ContactMessage(models.Model):
sender = models.ForeignKey(Profile, on_delete=models.DO_NOTHING)
subject = models.CharField(max_length... | code_fim | easy | {
"lang": "python",
"repo": "nazaninsbr/Django-ChatJS-Dashboard",
"path": "/aie/contact/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: odoku/djangorestframework-blueprint path: /rest_framework_blueprint/factories.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals, print_function
from collections import OrderedDict
import inspect
import re
from rest_framework.fields import empty, Field as SerializerField
from re... | code_fim | hard | {
"lang": "python",
"repo": "odoku/djangorestframework-blueprint",
"path": "/rest_framework_blueprint/factories.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(fields) == 0:
return []
fields = [
create_field_from_serializer_field(name, field)
for name, field in fields.items()
]
if only_readable:
for index, field in enumerate(fields):
fields[index].required = True
return fields
def create... | code_fim | hard | {
"lang": "python",
"repo": "odoku/djangorestframework-blueprint",
"path": "/rest_framework_blueprint/factories.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> data = [[0 for i in xrange(peoples_count)] for j in xrange(peoples_count)]
for f in likesCountFiles:
ii = open(f)
likes = int(ii.read())
ii.close()
whoLikes = extractFirstName(f)
whomLikes = extractSecondName(f)
data[userMapping[whoLikes]][userMapping[whomLikes]] = likes
generate_temp... | code_fim | hard | {
"lang": "python",
"repo": "codehipsters/mutualikes",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: codehipsters/mutualikes path: /utils.py
import json
from pprint import pprint
from string import Template
from presentation import generate_template
def calculateLikesFrom(likesDict, username):
for user, likeCount in likesDict.iteritems():
if user == username:
return likeCount
return 0
... | code_fim | hard | {
"lang": "python",
"repo": "codehipsters/mutualikes",
"path": "/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> usersSet = set()
for f in likesCountFiles:
usersSet.add(extractFirstName(f))
usersList = list(usersSet)
peoples_count = len(usersList)
userMapping = {}
for i in xrange(peoples_count):
userMapping[usersList[i]] = i
data = [[0 for i in xrange(peoples_count)] for j in xrange(peoples_count)]... | code_fim | hard | {
"lang": "python",
"repo": "codehipsters/mutualikes",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Hediby/cdiscount_datascience path: /gridsearch_sim.py
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 8 08:33:54 2016
@author: hedi
"""
import numpy as np
import sys
from time import time
import os
from sim_model import m_sim_mean
import theano
from itertools import product
import json
from job... | code_fim | hard | {
"lang": "python",
"repo": "Hediby/cdiscount_datascience",
"path": "/gridsearch_sim.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f.write('Epoch: %d, W_im = %f, W_txt = %f\n' % (epoch,(model.W_img**2).mean(),
(model.W_txt**2).mean()))
f.flush()
np.random.shuffle(train_idxs)
Xim_train = Xim_train[train_idxs]
Xtxt_train = Xtxt_train[train_i... | code_fim | hard | {
"lang": "python",
"repo": "Hediby/cdiscount_datascience",
"path": "/gridsearch_sim.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mtc44/BES path: /StartPage.py
# -*- coding: utf-8 -*-
"""
Created on Wed Aug 18 20:23:42 2021
@author: chanchanchan
"""
import streamlit as st
import pandas as pd
import plotly.graph_objects as go
def app():
st.header('Summary of Shear Wave Velocity')
st.write... | code_fim | hard | {
"lang": "python",
"repo": "mtc44/BES",
"path": "/StartPage.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> fig = go.Figure(data=[go.Table(
header=dict(values=['Input signal frequency (kHz)', 'Interpretation method','Shear wave arrival time (ms)', 'Shear wave velocity (m/s)', 'Shear modulus (MPa)','L/ λ'],
line_color='darkslategray',
fill_color='light blue',
... | code_fim | hard | {
"lang": "python",
"repo": "mtc44/BES",
"path": "/StartPage.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if heatmap:
dense_1 = Convolution2D(4096, 6, 6, activation='relu', name='dense_1')(dense_1)
dense_2 = Convolution2D(4096, 1, 1, activation='relu', name='dense_2')(dense_1)
dense_3 = Convolution2D(1000, 1, 1, name='dense_3')(dense_2)
prediction = Softmax4D(axis=1, name='... | code_fim | hard | {
"lang": "python",
"repo": "sagarbhokre/CarND-Capstone",
"path": "/NN_train/alexnet/ts_alx_net.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> b, ch, r, c = X.shape
half = n // 2
square = K.square(X)
extra_channels = K.spatial_2d_padding(K.permute_dimensions(square, (0, 2, 3, 1))
, (0, half))
extra_channels = K.permute_dimensions(extra_channels, (0, 3, 1, 2))
... | code_fim | hard | {
"lang": "python",
"repo": "sagarbhokre/CarND-Capstone",
"path": "/NN_train/alexnet/ts_alx_net.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sagarbhokre/CarND-Capstone path: /NN_train/alexnet/ts_alx_net.py
import os
import h5py
import keras
from keras.models import Sequential, Model
from keras.layers import Dense, Flatten, Dropout, Input, merge, Activation
from keras.layers.convolutional import Convolution2D, MaxPooling2D, ZeroPad... | code_fim | hard | {
"lang": "python",
"repo": "sagarbhokre/CarND-Capstone",
"path": "/NN_train/alexnet/ts_alx_net.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SEPalmiere/Seguranca-da-informacao-com-Python path: /threadsandIPs/IPs.py
import ipaddress
ip = '192.168.0.1'
rede = '192.168.0.0/24'
<|fim_suffix|>print(endereco + 1500)
print("#"*60)
for n in network:
print(n)<|fim_middle|>
endereco = ipaddress.ip_address(ip)
network = ipaddress.ip_netwo... | code_fim | medium | {
"lang": "python",
"repo": "SEPalmiere/Seguranca-da-informacao-com-Python",
"path": "/threadsandIPs/IPs.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for n in network:
print(n)<|fim_prefix|># repo: SEPalmiere/Seguranca-da-informacao-com-Python path: /threadsandIPs/IPs.py
import ipaddress
ip = '192.168.0.1'
rede = '192.168.0.0/24'
endereco = ipaddress.ip_address(ip)
network = ipaddress.ip_network(rede)
<|fim_middle|>print(endereco)
print(networ... | code_fim | medium | {
"lang": "python",
"repo": "SEPalmiere/Seguranca-da-informacao-com-Python",
"path": "/threadsandIPs/IPs.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class QuizRetrieveSerializer(serializers.ModelSerializer):
questions = QuestionSerializer(many=True, source='question_set')
class Meta:
model = Quiz
fields = ('id', 'questions')<|fim_prefix|># repo: dominik24c/quiz-api-app path: /backend/app/quiz/serializers/retrieve_quiz.py
from... | code_fim | easy | {
"lang": "python",
"repo": "dominik24c/quiz-api-app",
"path": "/backend/app/quiz/serializers/retrieve_quiz.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> class Meta:
model = Quiz
fields = ('id', 'questions')<|fim_prefix|># repo: dominik24c/quiz-api-app path: /backend/app/quiz/serializers/retrieve_quiz.py
from quiz.models import Quiz
from rest_framework import serializers
from .create_quiz import QuestionSerializer
<|fim_middle|>clas... | code_fim | medium | {
"lang": "python",
"repo": "dominik24c/quiz-api-app",
"path": "/backend/app/quiz/serializers/retrieve_quiz.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dominik24c/quiz-api-app path: /backend/app/quiz/serializers/retrieve_quiz.py
from quiz.models import Quiz
from rest_framework import serializers
<|fim_suffix|> questions = QuestionSerializer(many=True, source='question_set')
class Meta:
model = Quiz
fields = ('id', 'quest... | code_fim | medium | {
"lang": "python",
"repo": "dominik24c/quiz-api-app",
"path": "/backend/app/quiz/serializers/retrieve_quiz.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>a, b, c, = int(argv[1]), int(argv[2]), int(argv[3])
if (a >= b + c) or (b >= a + c) or (c >= b + a):
print("False")
else:
print("True")<|fim_prefix|># repo: R-BAR-001/intro_to_programming_python path: /CH02/1.2.12.py
#!/usr/bin/env python3
<|fim_middle|>from sys import argv
| code_fim | easy | {
"lang": "python",
"repo": "R-BAR-001/intro_to_programming_python",
"path": "/CH02/1.2.12.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: R-BAR-001/intro_to_programming_python path: /CH02/1.2.12.py
#!/usr/bin/env python3
<|fim_suffix|>a, b, c, = int(argv[1]), int(argv[2]), int(argv[3])
if (a >= b + c) or (b >= a + c) or (c >= b + a):
print("False")
else:
print("True")<|fim_middle|>from sys import argv
| code_fim | easy | {
"lang": "python",
"repo": "R-BAR-001/intro_to_programming_python",
"path": "/CH02/1.2.12.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class PostStore:
posts=[]
def get_all(self):
return (PostStore.posts)
def add(self,post):
self.posts.append(post)<|fim_prefix|># repo: AliTechM/ATM path: /Forums/stores.py
class MemberStore:
members = []
def get_all(self):
return(MemberStore.members)
<|fim_mid... | code_fim | medium | {
"lang": "python",
"repo": "AliTechM/ATM",
"path": "/Forums/stores.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AliTechM/ATM path: /Forums/stores.py
class MemberStore:
members = []
def get_all(self):
return(MemberStore.members)
<|fim_suffix|> return (PostStore.posts)
def add(self,post):
self.posts.append(post)<|fim_middle|> def add(self, member):
self.members.append(mem... | code_fim | medium | {
"lang": "python",
"repo": "AliTechM/ATM",
"path": "/Forums/stores.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> posts=[]
def get_all(self):
return (PostStore.posts)
def add(self,post):
self.posts.append(post)<|fim_prefix|># repo: AliTechM/ATM path: /Forums/stores.py
class MemberStore:
members = []
<|fim_middle|> def get_all(self):
return(MemberStore.members)
def add(self, m... | code_fim | medium | {
"lang": "python",
"repo": "AliTechM/ATM",
"path": "/Forums/stores.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.