text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> else:
for i in range(0, m + 1): # We add 1 so Python will replicate m times
print '%s\t%s' % ((i, col),(provenance, row, value))
# Printing last object!
#print '%s\t%s' % ((i, col),(provenance, row, value))
# Each element then goes through a sort&shuffle phase wher... | code_fim | hard | {
"lang": "python",
"repo": "ALaks96/MapReduce_Pyspark_Large_Matrix_Multiplication",
"path": "/MapReduce program 1/mapper_check.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.canvas.addtag_withtag("dead", tagOrId=id)
def onObjectClick(self,event):
'''Handling mouse click events on objects(tiny rectangles)'''
mx, my = self.box_loc(event.x, event.y)
#self.status_bar.config(text = f"Cell at: {mx},{my}")
self.status... | code_fim | hard | {
"lang": "python",
"repo": "samsiaw/GameOfLife",
"path": "/canvas_outline.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: samsiaw/GameOfLife path: /canvas_outline.py
"""Conway's Game of Life Simulation
Started: August 6th 2020
@author: Samuel T. Siaw"""
# Objective: Draw a canvas
# Draw grids on the canvas to represent cells
# Mouse click on a cell highlights the cell
from tkinter import *
from tkinter im... | code_fim | hard | {
"lang": "python",
"repo": "samsiaw/GameOfLife",
"path": "/canvas_outline.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: simschmid/pydaqt path: /PYDAQ-0.1/gui/ui/selectlines.py
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'selectlines.ui'
#
# Created: Sun Oct 30 19:53:08 2016
# by: PyQt4 UI code generator 4.10.4
#
# WARNING! All changes made in this file will be lost!
<|fim_su... | code_fim | hard | {
"lang": "python",
"repo": "simschmid/pydaqt",
"path": "/PYDAQ-0.1/gui/ui/selectlines.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return s
try:
_encoding = QtGui.QApplication.UnicodeUTF8
def _translate(context, text, disambig):
return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
def _translate(context, text, disambig):
return QtGui.QApplication.translate... | code_fim | medium | {
"lang": "python",
"repo": "simschmid/pydaqt",
"path": "/PYDAQ-0.1/gui/ui/selectlines.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Ojas-Singh/ensor path: /lib/intersection.py
import itertools
from itertools import chain, combinations
def all_subsets(ss):
return chain(*map(lambda x: combinations(ss, x), range(0, len(ss)+1)))
<|fim_suffix|>def f2p(F):
Parts = []
for i in range(len(F)):
Parts.append([i,F... | code_fim | hard | {
"lang": "python",
"repo": "Ojas-Singh/ensor",
"path": "/lib/intersection.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# return final
def get_subsets(fullset):
listrep = list(fullset)
n = len(listrep)
return [[listrep[k] for k in range(n) if i&1<<k] for i in range(2**n)]<|fim_prefix|># repo: Ojas-Singh/ensor path: /lib/intersection.py
import itertools
from itertools import chain, combinations
def all_su... | code_fim | hard | {
"lang": "python",
"repo": "Ojas-Singh/ensor",
"path": "/lib/intersection.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>s):\n\tl=s.find("f(",28)\n\tprint s[:l+2]+repr(s)+s[-1]\n\nif __name__ == \'__main__\':\n\tf()')<|fim_prefix|># repo: TalkUHulk/CodeLab path: /Quine.py
def f(s):
l=s.find("f(",28)
print s[:l+2]+repr<|fim_middle|>(s)+s[-1]
if __name__ == '__main__':
f('def f( | code_fim | easy | {
"lang": "python",
"repo": "TalkUHulk/CodeLab",
"path": "/Quine.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>)+s[-1]\n\nif __name__ == \'__main__\':\n\tf()')<|fim_prefix|># repo: TalkUHulk/CodeLab path: /Quine.py
def f(s):
l=s.find("f(",28)
print s[:l+2]+repr<|fim_middle|>(s)+s[-1]
if __name__ == '__main__':
f('def f(s):\n\tl=s.find("f(",28)\n\tprint s[:l+2]+repr(s | code_fim | medium | {
"lang": "python",
"repo": "TalkUHulk/CodeLab",
"path": "/Quine.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TalkUHulk/CodeLab path: /Quine.py
def f(s):
l=s.find("f(",28)
print s[:l+2]+repr<|fim_suffix|>)+s[-1]\n\nif __name__ == \'__main__\':\n\tf()')<|fim_middle|>(s)+s[-1]
if __name__ == '__main__':
f('def f(s):\n\tl=s.find("f(",28)\n\tprint s[:l+2]+repr(s | code_fim | medium | {
"lang": "python",
"repo": "TalkUHulk/CodeLab",
"path": "/Quine.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Osblouf/Coded-Walkie-Talkie path: /test_audio_core.py
# Test section of audio_core class
# Last Modificication from D3Rnatch
import sys
import time
sys.path.insert(0, 'src/')
from audio import *
# creating and starting the audio core system.
# has record mode.
audio = audio_core()
frames = []
... | code_fim | hard | {
"lang": "python",
"repo": "Osblouf/Coded-Walkie-Talkie",
"path": "/test_audio_core.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>frames = []
# we get 500 chunks from audio input device
# but first enable continuous reading is necessary !
# audio.enable_continuousReading()
for i in range(0,100) :
data = audio.Read()
frames.append(data)
audio.createWaveFile("test.wav", frames)
# we play those 500 chunks directly
#audio.disable... | code_fim | medium | {
"lang": "python",
"repo": "Osblouf/Coded-Walkie-Talkie",
"path": "/test_audio_core.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Switchf0cus/Python-Tutorial path: /main.py
# print("Shalom")
# input('What is your name?')
<|fim_suffix|># x = "Python is"
# y = " awesomPiee"
# z = x + y
# print(z)P<|fim_middle|># name = input("What is your name?")
# print( "Hello " + name)
| code_fim | medium | {
"lang": "python",
"repo": "Switchf0cus/Python-Tutorial",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># x = "Python is"
# y = " awesomPiee"
# z = x + y
# print(z)P<|fim_prefix|># repo: Switchf0cus/Python-Tutorial path: /main.py
# print("Shalom")
# input('What is your name?')
<|fim_middle|># name = input("What is your name?")
# print( "Hello " + name)
| code_fim | medium | {
"lang": "python",
"repo": "Switchf0cus/Python-Tutorial",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: swang2000/DSAPractice path: /Leet_subTreeDeepNodes.py
#Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
def subtreeWithAllDeepest(root):
<|fim_suffix|> if not root:
return (d... | code_fim | medium | {
"lang": "python",
"repo": "swang2000/DSAPractice",
"path": "/Leet_subTreeDeepNodes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if not root:
return (d, None)
l, r = depth(root.left, d + 1), depth(root.right, d + 1)
if l[0] > r[0]: return (l[0], l[1])
elif l[0] < r[0]: return (r[0], r[1])
else:
return l[0], root.val
return depth(root, 0)[1]
root = TreeNode(3)
roo... | code_fim | medium | {
"lang": "python",
"repo": "swang2000/DSAPractice",
"path": "/Leet_subTreeDeepNodes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>root = TreeNode(3)
root.left = TreeNode(5)
root.right = TreeNode(1)
root.left.left = TreeNode(6)
root.left.right = TreeNode(2)
root.left.right.left = TreeNode(7)
root.left.right.right = TreeNode(4)
root.right.left = TreeNode(0)
root.right.right = TreeNode(8)
subtreeWithAllDeepest(root)<|fim_prefix|># rep... | code_fim | hard | {
"lang": "python",
"repo": "swang2000/DSAPractice",
"path": "/Leet_subTreeDeepNodes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sql = 'SELECT {} FROM {} WHERE {}="{}"'.format(
field,
table_name,
field,
value)
d = self.get(sql)
return d
def table_insert(self, table_name, item):
'''item is a dict : key is mysql table field'''
fields = list(i... | code_fim | hard | {
"lang": "python",
"repo": "veelion/ezmysql",
"path": "/ezmysql/connection_sync.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: veelion/ezmysql path: /ezmysql/connection_sync.py
"""A lightweight wrapper around PyMySQL for easy to use
Only for python 3
"""
import time
import traceback
import pymysql
import pymysql.cursors
class ConnectionSync:
def __init__(self, host, database, user, password,
port=... | code_fim | hard | {
"lang": "python",
"repo": "veelion/ezmysql",
"path": "/ezmysql/connection_sync.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ''' items: list of item'''
assert isinstance(items, list)
item = items[0]
fields = list(item.keys())
values = [list(item.values()) for item in items]
fieldstr = ','.join(fields)
valstr = ','.join(['%s'] * len(item))
sql = 'INSERT INTO {} ({})... | code_fim | hard | {
"lang": "python",
"repo": "veelion/ezmysql",
"path": "/ezmysql/connection_sync.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vivek1729/brainnetworks path: /generic.py
import pulp as _pulp
import numpy as _np
'''
Graph description
v0 -> v2
v0 -> v1
v0 -> v3
v1 -> v3
v2 -> v3
v0
/ |\
/ | \
v1 | v2
\ | /
\ |/
v3
All the initial capacities are 1. Max flow is 3
Cost function
Cost of increasing capac... | code_fim | hard | {
"lang": "python",
"repo": "vivek1729/brainnetworks",
"path": "/generic.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
'''
Now its time to add the constraints
First, the objective function
in this case, just use lpsum over scaling_factors which takes in the list of variables
scaling_factors_list = a list of all of the scaling factor variables in this case
e.g.,
lp_problem += scaling_factor[0][0] + scaling_factors[0][1] ... | code_fim | hard | {
"lang": "python",
"repo": "vivek1729/brainnetworks",
"path": "/generic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>rows = sequence
columns = sequence
'''
First, lets specify the scaling factor variables.
Lets make it simple and have a scaling factor for each edge
'''
scaling_factors = _pulp.LpVariable.dicts("scaling_factors",(rows,columns),lowBound=1,cat="Continuous")
'''
Next up, lets create the flow variables.
Agai... | code_fim | hard | {
"lang": "python",
"repo": "vivek1729/brainnetworks",
"path": "/generic.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PrincessKostii/tgbot path: /main.py
import telebot
from telebot import types
import db_users
bot = telebot.TeleBot("1299818980:AAFzO8-7l_0iKWoe2hgQopIg0Aw28BJouNM")
@bot.message_handler(commands=['start'])
def start(message):
markup = types.ReplyKeyboardMarkup(resize_keyboard=True)
it... | code_fim | hard | {
"lang": "python",
"repo": "PrincessKostii/tgbot",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if get_message_bot == "ГАРАНТИИ":
bot.send_message(message.chat.id,"Самый популярный вопрос, - Почему я должен верить вам, где гарантии?\n\nГарантии это наши отзывы с 2019 года, которые вы можете посмотреть в нашем канале с отзывами, а ещё то, что мы выкладываем на своём канале. А публикуем мы... | code_fim | hard | {
"lang": "python",
"repo": "PrincessKostii/tgbot",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def has_object_permission(self, request, view, obj):
return request.user.id == obj.user.id<|fim_prefix|># repo: osw4l/django-api-shop path: /apps/api/app/utils.py
from rest_framework import permissions
from rest_framework.permissions import IsAuthenticated, AllowAny
SAFE_METHODS = ['GET', 'P... | code_fim | medium | {
"lang": "python",
"repo": "osw4l/django-api-shop",
"path": "/apps/api/app/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: osw4l/django-api-shop path: /apps/api/app/utils.py
from rest_framework import permissions
from rest_framework.permissions import IsAuthenticated, AllowAny
<|fim_suffix|> if (request.method in SAFE_METHODS and
request.user and
request.user.is_authenticated):... | code_fim | medium | {
"lang": "python",
"repo": "osw4l/django-api-shop",
"path": "/apps/api/app/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if (request.method in SAFE_METHODS and
request.user and
request.user.is_authenticated):
return True
return False
def has_object_permission(self, request, view, obj):
return request.user.id == obj.user.id<|fim_prefix|># repo: osw4l/dj... | code_fim | medium | {
"lang": "python",
"repo": "osw4l/django-api-shop",
"path": "/apps/api/app/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IagoBarboza/paa path: /sr-indeciso/srIndeciso.py
def searchLo(x, left, right):
if(left == right):
if(a[left] >= x): return left
else: return None
mid = int((left+right)/2)
if(a[mid] >= x):
if(mid == left): return mid
if(mid > left):
mostLeft = searchLo(x, left, mid-... | code_fim | hard | {
"lang": "python",
"repo": "IagoBarboza/paa",
"path": "/sr-indeciso/srIndeciso.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(a[mid] <= x):
mostRight = searchHi(x, mid+1, right)
if(mostRight == None): return mid
else: return mostRight
else:
if(mid != left): return searchHi(x, left, mid-1)
input()
a = list(map(int, input().split(" ")))
nQueries = int(input())
queriesArray = []
for q in range(nQueries)... | code_fim | hard | {
"lang": "python",
"repo": "IagoBarboza/paa",
"path": "/sr-indeciso/srIndeciso.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for q in range(nQueries):
x = queriesArray[q]
print(searchLo(x, 0, len(a)-1), searchHi(x, 0, len(a)-1))<|fim_prefix|># repo: IagoBarboza/paa path: /sr-indeciso/srIndeciso.py
def searchLo(x, left, right):
if(left == right):
if(a[left] >= x): return left
else: return None
mid = int((left+r... | code_fim | medium | {
"lang": "python",
"repo": "IagoBarboza/paa",
"path": "/sr-indeciso/srIndeciso.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> browser.get(link)
# Uncomment next line to check the page language
#time.sleep(30)
items = browser.find_elements_by_css_selector("form#add_to_basket_form>button.btn.btn-lg.btn-primary.btn-add-to-basket")
assert len(items) > 0 , "'Add to basket' button wasn't found"<|fim_prefix|># repo:... | code_fim | easy | {
"lang": "python",
"repo": "glaurungh/selenium_conf_task",
"path": "/test_items.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: glaurungh/selenium_conf_task path: /test_items.py
import pytest
import time
link = "http://selenium1py.pythonanywhere.com/catalogue/coders-at-work_207/"
<|fim_suffix|> browser.get(link)
# Uncomment next line to check the page language
#time.sleep(30)
items = browser.find_elements... | code_fim | easy | {
"lang": "python",
"repo": "glaurungh/selenium_conf_task",
"path": "/test_items.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(f"{result:.2f}")
print(f"From 0 to 9: {from_0_to_9_per:.2f}%")
print(f"From 10 to 19: {from_10_to_19_per:.2f}%")
print(f"From 20 to 29: {from_20_to_29_per:.2f}%")
print(f"From 30 to 39: {from_30_to_39_per:.2f}%")
print(f"From 40 to 50: {from_40_to_50_per:.2f}%")
print(f"Invalid numbers: {invalid_num... | code_fim | hard | {
"lang": "python",
"repo": "SJeliazkova/SoftUni",
"path": "/Programming-Basic-Python/Exercises-and-Labs/For_Loop_More Exercises/05.Game_of_intervals.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SJeliazkova/SoftUni path: /Programming-Basic-Python/Exercises-and-Labs/For_Loop_More Exercises/05.Game_of_intervals.py
moves = int(input())
result = 0
from_0_to_9 = 0
from_10_to_19 = 0
from_20_to_29 = 0
from_30_to_39 = 0
from_40_to_50 = 0
invalid_num = 0
<|fim_suffix|>from_0_to_9_per = from_0_t... | code_fim | hard | {
"lang": "python",
"repo": "SJeliazkova/SoftUni",
"path": "/Programming-Basic-Python/Exercises-and-Labs/For_Loop_More Exercises/05.Game_of_intervals.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: HomeSox/AtCoder path: /satory074/abc244/c/main.py
N = int(input())
<|fim_suffix|> inp = int(input())
if inp == 0:
exit()
else:
l.pop(l.index(inp))<|fim_middle|>l = list(range(1, 2*N+2))
while l:
print(l.pop(0))
| code_fim | easy | {
"lang": "python",
"repo": "HomeSox/AtCoder",
"path": "/satory074/abc244/c/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> inp = int(input())
if inp == 0:
exit()
else:
l.pop(l.index(inp))<|fim_prefix|># repo: HomeSox/AtCoder path: /satory074/abc244/c/main.py
N = int(input())
<|fim_middle|>l = list(range(1, 2*N+2))
while l:
print(l.pop(0))
| code_fim | easy | {
"lang": "python",
"repo": "HomeSox/AtCoder",
"path": "/satory074/abc244/c/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hleclerc/Metil path: /src/Metil/Level1/LazyObjectOperationData.h.py
# -*- coding: utf-8 -*-
from MethodHelper import *
print "// generated file"
print "#ifndef LAZYOBJECTOPERATIONDATA_H"
print "#define LAZYOBJECTOPERATIONDATA_H"
print ''
print '#include <Config.h>'
print ''
print 'BEG_METIL_LEVE... | code_fim | hard | {
"lang": "python",
"repo": "hleclerc/Metil",
"path": "/src/Metil/Level1/LazyObjectOperationData.h.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print ''
print 'END_METIL_LEVEL1_NAMESPACE;'
print ''
print "#endif // LAZYOBJECTOPERATIONDATA_H"<|fim_prefix|># repo: hleclerc/Metil path: /src/Metil/Level1/LazyObjectOperationData.h.py
# -*- coding: utf-8 -*-
from MethodHelper import *
print "// generated file"
print "#ifndef LAZYOBJECTOPERATIONDATA_H... | code_fim | hard | {
"lang": "python",
"repo": "hleclerc/Metil",
"path": "/src/Metil/Level1/LazyObjectOperationData.h.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># model = my_InceptionV3()
# model.compile(optimizer='rmsprop',
# loss='categorical_crossentropy',
# metrics=['accuracy'])
# from keras.utils import plot_model
#
# plot_model(model, to_file='model.png', show_shapes=True)<|fim_prefix|># repo: m-L-0/17b-Caoguohong-2015 path: /Ca... | code_fim | hard | {
"lang": "python",
"repo": "m-L-0/17b-Caoguohong-2015",
"path": "/CaptchaRecognition/googLeNet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> model = Model(inputs, t, name='my_InceptionV3')
return model
# model = my_InceptionV3()
# model.compile(optimizer='rmsprop',
# loss='categorical_crossentropy',
# metrics=['accuracy'])
# from keras.utils import plot_model
#
# plot_model(model, to_file='model.png', show... | code_fim | hard | {
"lang": "python",
"repo": "m-L-0/17b-Caoguohong-2015",
"path": "/CaptchaRecognition/googLeNet.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: m-L-0/17b-Caoguohong-2015 path: /CaptchaRecognition/googLeNet.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time : 2017/12/17 下午9:21
# @Author : tudoudou
# @File : googLeNet.py
# @Software: PyCharm
import warnings
from keras.models import Model
from keras import layers
from keras.l... | code_fim | hard | {
"lang": "python",
"repo": "m-L-0/17b-Caoguohong-2015",
"path": "/CaptchaRecognition/googLeNet.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AldiT/chatbot path: /chatbot/deprecated_bot/server.py
from bot import Telegram_Chatbot
from chat_controller import Chat_Controller
<|fim_suffix|>update_id = None
while True:
updates = my_bot.get_updates(offset=update_id)
updates = updates['result']
if updates:
if chat_contro... | code_fim | medium | {
"lang": "python",
"repo": "AldiT/chatbot",
"path": "/chatbot/deprecated_bot/server.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>update_id = None
while True:
updates = my_bot.get_updates(offset=update_id)
updates = updates['result']
if updates:
if chat_controller.state == "Deactivated":
chat_controller.state = "Activated"
update_id, msg, sender_id = chat_controller.process_input... | code_fim | medium | {
"lang": "python",
"repo": "AldiT/chatbot",
"path": "/chatbot/deprecated_bot/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> update_id, msg, sender_id = chat_controller.process_input(updates)
reply = chat_controller.make_reply(msg)
my_bot.send_message(reply, sender_id)<|fim_prefix|># repo: AldiT/chatbot path: /chatbot/deprecated_bot/server.py
from bot import Telegram_Chatbot
from chat_controller import ... | code_fim | medium | {
"lang": "python",
"repo": "AldiT/chatbot",
"path": "/chatbot/deprecated_bot/server.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: peacock0803sz/procon path: /beginners-selection/04_abc087b.py
a = int(input())
b = int(input())
c = int(input())
x = int(input())
answer = 0
for i in (a + 1):
for j in (b + 1<|fim_suffix|>00 + k * 50 == x:
answer += 1
print(answer)<|fim_middle|>):
for k in (c + 1):
... | code_fim | easy | {
"lang": "python",
"repo": "peacock0803sz/procon",
"path": "/beginners-selection/04_abc087b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>00 + k * 50 == x:
answer += 1
print(answer)<|fim_prefix|># repo: peacock0803sz/procon path: /beginners-selection/04_abc087b.py
a = int(input())
b = int(input())
c = int(input())
x = int<|fim_middle|>(input())
answer = 0
for i in (a + 1):
for j in (b + 1):
for k in (c + 1):
... | code_fim | medium | {
"lang": "python",
"repo": "peacock0803sz/procon",
"path": "/beginners-selection/04_abc087b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: awixom/PyGitLatex path: /pygitlatex.py
#! python3
from pyforms.gui.appmanager import start_app
from pyforms.gui.basewidget import BaseWidget
from pyforms.gui.controls.ControlButton import ControlButton
from pyforms.gui.controls.ControlDir import ControlDir
from pyforms.gui.controls.Control... | code_fim | hard | {
"lang": "python",
"repo": "awixom/PyGitLatex",
"path": "/pygitlatex.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def no_git_repo_detected(self):
self.dirProjectDir.value = ''
self.update_git_console(output='Please select a directory with an ' \
+ 'existing project git repository or initialize a new one.' \
+ 'In order to clone an existing project, please use the ' \
... | code_fim | hard | {
"lang": "python",
"repo": "awixom/PyGitLatex",
"path": "/pygitlatex.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, row):
#####
self.medium = 1
self.disctitle = "CD"
#####
self.medium_index = int(row[0][:-1])
self.track_id = int(row[0][:-1])
self.index = int(row[0][:-1])
# wiping out the character (") from track name
temp_n... | code_fim | hard | {
"lang": "python",
"repo": "sarikaya/beets",
"path": "/beetsplug/wikipedia.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sarikaya/beets path: /beetsplug/wikipedia.py
# -*- coding: utf-8 -*-
# This file is part of beets.
# Copyright 2017, Gokturk Gok & Nurefsan Sarikaya.
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Soft... | code_fim | hard | {
"lang": "python",
"repo": "sarikaya/beets",
"path": "/beetsplug/wikipedia.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> httpd = make_server('0.0.0.0', 8051, application)
httpd.serve_forever()<|fim_prefix|># repo: abijith-kp/DataMining_NLP_AI path: /Flash-Emolytics/wsgi.py
#!/usr/bin/python
from server.Emolytics import emolytics
from wsgiref.simple_<|fim_middle|>server import make_server
from werkzeug.debug import... | code_fim | medium | {
"lang": "python",
"repo": "abijith-kp/DataMining_NLP_AI",
"path": "/Flash-Emolytics/wsgi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: abijith-kp/DataMining_NLP_AI path: /Flash-Emolytics/wsgi.py
#!/usr/bin/python
from server.Emolytics import emolytics
from wsgiref.simple_<|fim_suffix|>_name__ == '__main__':
application = DebuggedApplication(emolytics, True)
httpd = make_server('0.0.0.0', 8051, application)
httpd.ser... | code_fim | medium | {
"lang": "python",
"repo": "abijith-kp/DataMining_NLP_AI",
"path": "/Flash-Emolytics/wsgi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Da posição 3 até a 5 (05, 09, etc) do item valor (cada par: nome, data)
dic_aniversariantes_setembro[chave] = valor #dicionario na posicao 1, 2, 3, etc recebe valor inteiro, nome e data
return dic_aniversariantes_setembro<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /b... | code_fim | medium | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_097/ch76_2019_10_02_13_04_48_053131.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gabriellaec/desoft-analise-exercicios path: /backup/user_097/ch76_2019_10_02_13_04_48_053131.py
def aniversariantes_de_setembro(dic_aniversariantes):
dic_aniversariantes_setembro = {}
for chave, valor in di<|fim_suffix|>] = valor #dicionario na posicao 1, 2, 3, etc recebe valor inteiro, n... | code_fim | hard | {
"lang": "python",
"repo": "gabriellaec/desoft-analise-exercicios",
"path": "/backup/user_097/ch76_2019_10_02_13_04_48_053131.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KellyGothard/RedditUSACOVID path: /src/timeseries.py
import glob
import pandas as pd
import reddit_utils
import pushshift
import numpy as np
import matplotlib.pyplot as plt
from matplotlib import rc
import matplotlib.dates as mdates
import datetime
from datetime import timedelta
def get_relativ... | code_fim | hard | {
"lang": "python",
"repo": "KellyGothard/RedditUSACOVID",
"path": "/src/timeseries.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> rc('font', **{'family': 'serif', 'serif': ['Computer Modern'], 'size': 18})
rc('text', usetex=True)
years_fmt = mdates.DateFormatter('%b\n%Y')
colors = plt.cm.tab20(np.linspace(0,1,len(cities)))
i = 0
d0 = '2019-12-30'
d1 = '2020-04-19'
d1 = datetime.date(int(d1.split('-')... | code_fim | hard | {
"lang": "python",
"repo": "KellyGothard/RedditUSACOVID",
"path": "/src/timeseries.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for result in cl_e30.get_results(sort_by='newest'):
print(result)<|fim_prefix|># repo: cowang4/e30_search path: /e30search.py
from craigslist import CraigslistForSale
<|fim_middle|>cl_e30 = CraigslistForSale(site='boston', category='cta',
filters={'make': 'bmw', 'auto_transmission': ['manua... | code_fim | medium | {
"lang": "python",
"repo": "cowang4/e30_search",
"path": "/e30search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cowang4/e30_search path: /e30search.py
from craigslist import CraigslistForSale
<|fim_suffix|>for result in cl_e30.get_results(sort_by='newest'):
print(result)<|fim_middle|>cl_e30 = CraigslistForSale(site='boston', category='cta',
filters={'make': 'bmw', 'auto_transmission': ['manua... | code_fim | medium | {
"lang": "python",
"repo": "cowang4/e30_search",
"path": "/e30search.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Player:
def __init__(self, board: Board):
self.position = board
def move(self):
self.position.change_position()
def rotate(self, direction):
pos = 1 if direction == 'r' else -1
self.position.switch_direction(pos)
def play(instr: str):
board = Board... | code_fim | hard | {
"lang": "python",
"repo": "mwidera/board_game",
"path": "/board_game/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> major, minor, _ = python_version_tuple()
msg = "Not possible to use with python version below 3.7"
if major < "3":
raise RuntimeError(msg)
if minor < "7":
raise RuntimeError(msg)
def main():
check_python_version()
prompt = "Play the game.\nInput M to move, R to rot... | code_fim | hard | {
"lang": "python",
"repo": "mwidera/board_game",
"path": "/board_game/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mwidera/board_game path: /board_game/main.py
#!/usr/bin/env python
from dataclasses import dataclass, field
from platform import python_version_tuple
@dataclass
class Point:
x: int = field(default=0)
y: int = field(default=0)
direction: int = field(default=0)
def __repr__(self... | code_fim | hard | {
"lang": "python",
"repo": "mwidera/board_game",
"path": "/board_game/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>sources = FeatureSources(config, [
'loader/kboot.c',
'console.c',
'memory.c',
'platform.c',
])
# Add architecture-specific headers.
env['CPPPATH'] += [Dir('arch/%s/include' % (config['ARCH']))]
# Get architecture-specific sources.
arch_sources = SConscript(dirs = ['arch/' + config['ARCH... | code_fim | medium | {
"lang": "python",
"repo": "aejsmith/kboot",
"path": "/source/platform/dt/SConscript",
"mode": "spm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aejsmith/kboot path: /source/platform/dt/SConscript
#
# Copyright (C) 2009-2021 Alex Smith
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in ... | code_fim | medium | {
"lang": "python",
"repo": "aejsmith/kboot",
"path": "/source/platform/dt/SConscript",
"mode": "psm",
"license": "ISC",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mixib/matrix_utils path: /matrix_utils/__init__.py
__all__ = (
"__version__",
"ResourceGroup",
"ArrayMapper",
"MappedMatrix",
"RandomIndex<|fim_suffix|>up import ResourceGroup
from .indexers import RandomIndexer, SequentialIndexer, CombinatorialIndexer, Proxy<|fim_middle|>er",... | code_fim | hard | {
"lang": "python",
"repo": "mixib/matrix_utils",
"path": "/matrix_utils/__init__.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>up import ResourceGroup
from .indexers import RandomIndexer, SequentialIndexer, CombinatorialIndexer, Proxy<|fim_prefix|># repo: mixib/matrix_utils path: /matrix_utils/__init__.py
__all__ = (
"__version__",
"ResourceGroup",
"ArrayMapper",
"MappedMatrix",
"RandomIndex<|fim_middle|>er",... | code_fim | hard | {
"lang": "python",
"repo": "mixib/matrix_utils",
"path": "/matrix_utils/__init__.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: wuwenshan/RI path: /code/okapi.py
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 21 11:24:24 2019
@author: 3874034
"""
#from indexerSimple import IndexerSimple
from IRModel import IRModel
from TextRepresenter import PorterStemmer
from math import log
class Okapi(IRModel):
"""
i... | code_fim | hard | {
"lang": "python",
"repo": "wuwenshan/RI",
"path": "/code/okapi.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> f_qi_d = itemDico
print("f",f_qi_d)
D = sum(self._index.getTfsForDoc(keyDico)[term] for term in self._index.getTfsForDoc(keyDico).keys())
print("D",D)
... | code_fim | hard | {
"lang": "python",
"repo": "wuwenshan/RI",
"path": "/code/okapi.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Now let's test
class TestStockPrice(unittest.TestCase):
def test_given_obvious_edge_case(self):
stock_prices_yesterday = [10, 10, 10, 10]
max_profit = get_max_profit(stock_prices_yesterday)
self.assertEqual(0, max_profit)
def test_given_example(self):
"""test ... | code_fim | hard | {
"lang": "python",
"repo": "jerryasher-challenges/challenge-interviewcake",
"path": "/1-stocks.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jerryasher-challenges/challenge-interviewcake path: /1-stocks.py
#!python
from __future__ import print_function
import unittest
######################################################################
# this problem is from
# https://www.interviewcake.com/question/python/stock-price
# Writing pr... | code_fim | hard | {
"lang": "python",
"repo": "jerryasher-challenges/challenge-interviewcake",
"path": "/1-stocks.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>h
print("Harga Sebelum Diskon",x)
y = x*0.85
print("Harga Setelah Diskon",y)<|fim_prefix|># repo: Rafii271/Praktikum-Alpro-2021 path: /pratikan/pratikan 1/G_SOAL4_RAFI_1202204175.py
buah = int(8000)
jumlah = int(input("<|fim_middle|>Masukan Berat Buah :"))
x = buah*jumla | code_fim | easy | {
"lang": "python",
"repo": "Rafii271/Praktikum-Alpro-2021",
"path": "/pratikan/pratikan 1/G_SOAL4_RAFI_1202204175.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Rafii271/Praktikum-Alpro-2021 path: /pratikan/pratikan 1/G_SOAL4_RAFI_1202204175.py
buah = int(8000)
jumlah = int(input("Masukan Berat Buah :"))
x = buah*jumla<|fim_suffix|>x*0.85
print("Harga Setelah Diskon",y)<|fim_middle|>h
print("Harga Sebelum Diskon",x)
y = | code_fim | easy | {
"lang": "python",
"repo": "Rafii271/Praktikum-Alpro-2021",
"path": "/pratikan/pratikan 1/G_SOAL4_RAFI_1202204175.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>irs"
print "How do you say \"dead\" in spanish?"
answer = raw_input("> ")
if answer == "muerto":
print "Good Job !!"
return 'dance'
else:
print "Wrong !, you die. Bye !"
exit(1)<|fim_prefix|># repo: nflondo/myprog path: /pyth... | code_fim | hard | {
"lang": "python",
"repo": "nflondo/myprog",
"path": "/python/hardwaybook/projects/fright/fright/dayofdead.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nflondo/myprog path: /python/hardwaybook/projects/fright/fright/dayofdead.py
class DayOfDead(object):
def enter(self):
print "A nice looking skeleton woman with a big dress is standing in"
<|fim_suffix|>irs"
print "How do you say \"dead\" in spanish?"
answer = raw... | code_fim | hard | {
"lang": "python",
"repo": "nflondo/myprog",
"path": "/python/hardwaybook/projects/fright/fright/dayofdead.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jeedom-rdlc14/mydiskotek path: /myapp/models.py
# -*- coding: utf-8 -*-
"""
models.py
flask
Created on 10|04
-----
20|18
@author: rdlc_Dev(alain)
@version:1.180410
"""
# Import the database object (db) from the main application module
# We will define this inside /a... | code_fim | hard | {
"lang": "python",
"repo": "jeedom-rdlc14/mydiskotek",
"path": "/myapp/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, artists, title, year, release, rangement, place):
self.artists = artists
self.title = title
self.year = year
self.release = release
self.rangement = rangement
self.place = place<|fim_prefix|># repo: jeedom-rdlc14/mydiskotek path: /mya... | code_fim | hard | {
"lang": "python",
"repo": "jeedom-rdlc14/mydiskotek",
"path": "/myapp/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ListCollection():
def __init__(self, artists, title, year, release, rangement, place):
self.artists = artists
self.title = title
self.year = year
self.release = release
self.rangement = rangement
self.place = place<|fim_prefix|># repo: jeedom-... | code_fim | hard | {
"lang": "python",
"repo": "jeedom-rdlc14/mydiskotek",
"path": "/myapp/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> = False
else:
garbage_count += 1
elif c == "<":
in_garbage = True
elif c == "{":
level += 1
score += level
elif c == "}":
level -= 1
return score, garbage_count
score, garbage = score_string(sys.argv[... | code_fim | medium | {
"lang": "python",
"repo": "PhilMarsh/adventofcode",
"path": "/2017/9.2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> score += level
elif c == "}":
level -= 1
return score, garbage_count
score, garbage = score_string(sys.argv[1])
print(garbage)<|fim_prefix|># repo: PhilMarsh/adventofcode path: /2017/9.2.py
import sys
def score_string(s):
skip_next = False
in_garbage = False
... | code_fim | hard | {
"lang": "python",
"repo": "PhilMarsh/adventofcode",
"path": "/2017/9.2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PhilMarsh/adventofcode path: /2017/9.2.py
import sys
def score_string(s):
skip_next = False
in_garbage = False
level = 0
score = 0
garbage_count = 0
for c in s:
if skip_ne<|fim_suffix|> = False
else:
garbage_count += 1
elif c ==... | code_fim | medium | {
"lang": "python",
"repo": "PhilMarsh/adventofcode",
"path": "/2017/9.2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_returns_false_for_references_with_different_types(self):
reference_1 = building_blocks.Reference('a', tf.int32)
reference_2 = building_blocks.Reference('a', tf.float32)
self.assertFalse(tree_analysis.trees_equal(reference_1, reference_2))
def test_returns_false_for_references_wit... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/core/impl/compiler/tree_analysis_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tensorflow/federated path: /tensorflow_federated/python/core/impl/compiler/tree_analysis_test.py
s.check_broadcast_not_dependent_on_aggregate(
broadcasted_aggregate
)
def test_returns_correct_example_of_broadcast_dependent_on_aggregate(self):
aggregate = (
building_... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/core/impl/compiler/tree_analysis_test.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class ContainsAggregationShared(parameterized.TestCase):
@parameterized.named_parameters([
('non_aggregation_intrinsics', non_aggregation_intrinsics),
('trivial_aggregate', trivial_aggregate),
('trivial_mean', trivial_mean),
('trivial_sum', trivial_sum),
# TODO(b/12043963... | code_fim | hard | {
"lang": "python",
"repo": "tensorflow/federated",
"path": "/tensorflow_federated/python/core/impl/compiler/tree_analysis_test.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ymli1997/deeplearning-notes path: /numerical/symbol-compute/02-numbers.py
#coding:utf-8
'''
数据类型
'''
import sympy
sympy.init_printing()
from sympy import I, pi, oo
<|fim_suffix|># 有理数符号
r = sympy.Rational(11,13)
print(r)
# 有理数符号计算
r1 = sympy.Rational(2,3)
r2 = sympy.Rational(4,5)
print(r1 * r2)... | code_fim | hard | {
"lang": "python",
"repo": "ymli1997/deeplearning-notes",
"path": "/numerical/symbol-compute/02-numbers.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># 有理数符号
r = sympy.Rational(11,13)
print(r)
# 有理数符号计算
r1 = sympy.Rational(2,3)
r2 = sympy.Rational(4,5)
print(r1 * r2)
print(r1 / r2)<|fim_prefix|># repo: ymli1997/deeplearning-notes path: /numerical/symbol-compute/02-numbers.py
#coding:utf-8
'''
数据类型
'''
import sympy
sympy.init_printing()
from sympy imp... | code_fim | medium | {
"lang": "python",
"repo": "ymli1997/deeplearning-notes",
"path": "/numerical/symbol-compute/02-numbers.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dyn0402/Misc path: /bh_binary_power.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on March 01 9:47 PM 2020
Created in PyCharm
Created as Misc/bh_binary_power
@author: Dylan Neff, Dylan
"""
import matplotlib.pyplot as plt
import numpy as np
<|fim_suffix|>def main():
m_chirp ... | code_fim | medium | {
"lang": "python",
"repo": "Dyn0402/Misc",
"path": "/bh_binary_power.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> plt.plot(taus, powers, color='blue', label='Power')
plt.axvline(6.04746, linestyle='--', color='green', label='10Hz')
plt.axvline(0.000028, linestyle='--', color='red', label='1000Hz')
plt.xlabel(r'$\tau = t_{coal} - t$ (seconds)')
plt.ylabel('Power (watts)')
plt.legend()
plt.... | code_fim | hard | {
"lang": "python",
"repo": "Dyn0402/Misc",
"path": "/bh_binary_power.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>osSku_subs = {
# Translated from https://msdn.microsoft.com/en-us/library/aa394239(v=vs.85).aspx
# ^(.+) \((\d+)\)\n(.+)$
"0":"An unknown product",
"1":"Ultimate",
"2":"Home Basic",
... | code_fim | hard | {
"lang": "python",
"repo": "stamler/radiator",
"path": "/radiator-push/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stamler/radiator path: /radiator-push/constants.py
import re
from enum import IntEnum, auto
class Version(IntEnum):
v1 = auto()
v2 = auto()
v3 = auto()
v3_2 = auto()
# original v1
# datetime,username,manufacturer,serial,name,macaddress
full_line_v1 = re.compile('^([^,]+),([^,]+)... | code_fim | hard | {
"lang": "python",
"repo": "stamler/radiator",
"path": "/radiator-push/constants.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>osVersion_subs = {
"6.0":"WinVista",
"6.1":"Win7",
"6.2":"Win8",
"6.3":"Win8.1",
"10.0":"Win10"
}
osSku_subs = {
# Translated from https://ms... | code_fim | hard | {
"lang": "python",
"repo": "stamler/radiator",
"path": "/radiator-push/constants.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> nx.set_node_attributes(G, {floor_path[0]: {"location": (x, y)}}, "floor_start")
if id == len(level_solution)-1:
# This is the last floor to visit, place the level exit
possible_places = np.stack(np.where(roommap == floor_path[-1]), axis=1)
... | code_fim | hard | {
"lang": "python",
"repo": "AkashJam/DoomGAN",
"path": "/WADParser/WADEditor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> walkable = np.logical_and(floormap, np.logical_not(wallmap)) if wallmap is not None else floormap
# walkable = morphology.remove_small_objects(walkable)
# walkable = morphology.remove_small_holes(walkable)
roommap, graph, metrics = topological_features(walkable, prepare_fo... | code_fim | hard | {
"lang": "python",
"repo": "AkashJam/DoomGAN",
"path": "/WADParser/WADEditor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AkashJam/DoomGAN path: /WADParser/WADEditor.py
rary lumps for this level
self.scale_factor = scale_factor
def _sector_orientation(self, vertices):
"""
Check if the polygon is oriented clock-wise or counter-clockwise.
If the polygon is not closed, then closes i... | code_fim | hard | {
"lang": "python",
"repo": "AkashJam/DoomGAN",
"path": "/WADParser/WADEditor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>timeleft = 90 - int(age)
x = 365 * timeleft
y = 52 * timeleft
z = 12 * timeleft
print("++++++++++++++++++++++++++++++++++++++++++++++")
print(f"You have {x} days,{y} weeks, and {z} months left")<|fim_prefix|># repo: dolapo1223/life_left_before_90 path: /main.py
# 🚨 Don't change the code below 👇
print("... | code_fim | easy | {
"lang": "python",
"repo": "dolapo1223/life_left_before_90",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dolapo1223/life_left_before_90 path: /main.py
# 🚨 Don't change the code below 👇
print("Welcome to life time left before 90!")
age = input("What is your current age? ")
# 🚨 Don't change the code above 👆
<|fim_suffix|>timeleft = 90 - int(age)
x = 365 * timeleft
y = 52 * timeleft
z = 12 * timel... | code_fim | easy | {
"lang": "python",
"repo": "dolapo1223/life_left_before_90",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return 0
def flattingResult(self, flat_key={'biz_ext':['rating','cost']}):
for r in self.result:
for f in flat_key.keys():
if f in r.keys():
tmp = r[f]
for tk in tmp.keys():
if tk in f... | code_fim | hard | {
"lang": "python",
"repo": "lixivip/Unilever_AIChangeU",
"path": "/Geographical_Info_Extractor/poi_searcher.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> extractor.typefilter = ['060301',\
'060302',\
'060303',\
'060304',\
'060305',\
'060306',\
'060307',\
'0603... | code_fim | hard | {
"lang": "python",
"repo": "lixivip/Unilever_AIChangeU",
"path": "/Geographical_Info_Extractor/poi_searcher.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lixivip/Unilever_AIChangeU path: /Geographical_Info_Extractor/poi_searcher.py
"""
@COMPANY WHALE
@AUTHOR ChenZhou
@DESC This is the realization of POI Searcher using AMap API.
@DATE 2019/09
"""
import requests
import time
import random
import math
import json
import logging
import pandas as pd
... | code_fim | hard | {
"lang": "python",
"repo": "lixivip/Unilever_AIChangeU",
"path": "/Geographical_Info_Extractor/poi_searcher.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zywh/waterlooccc path: /2014/Junior/J4.py
# CCC 2014 Junior 4: Party Invitation
#
# relatively straight forward 1D array processing
# (element removal and modulo arithmetic)
#
<|fim_suffix|>#create friends array [1...k]
friends = []
for i in range (k):
friends.append(i+1)
m = int(file.readl... | code_fim | medium | {
"lang": "python",
"repo": "zywh/waterlooccc",
"path": "/2014/Junior/J4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for round in range(m):
r = int(file.readline())
# eliminate every rth friend
newfriends = []
for i in range(len(friends)):
if (i+1) % r != 0:
newfriends.append (friends[i])
# copy the new friends back into the old one
friends = []
for f in newfriends:
... | code_fim | medium | {
"lang": "python",
"repo": "zywh/waterlooccc",
"path": "/2014/Junior/J4.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.