text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: Viqm0101/Dom-Z-1 path: /4 Задание.py
# 4. Пользователь вводит целое положительное число. Найдите самую большую<|fim_suffix|> pol > 0:
d = pol % 10
if d >= s: s = d
pol//= 10
print(s)<|fim_middle|> цифру в числе.
# Для решения используйте цикл while и арифметические операции.
p... | code_fim | medium | {
"lang": "python",
"repo": "Viqm0101/Dom-Z-1",
"path": "/4 Задание.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> pol > 0:
d = pol % 10
if d >= s: s = d
pol//= 10
print(s)<|fim_prefix|># repo: Viqm0101/Dom-Z-1 path: /4 Задание.py
# 4. Пользователь вводит целое положительное число. Найдите самую большую<|fim_middle|> цифру в числе.
# Для решения используйте цикл while и арифметические операции.
p... | code_fim | medium | {
"lang": "python",
"repo": "Viqm0101/Dom-Z-1",
"path": "/4 Задание.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>рации.
pol = int(input('Введите положительное число: '))
s = 0
while pol > 0:
d = pol % 10
if d >= s: s = d
pol//= 10
print(s)<|fim_prefix|># repo: Viqm0101/Dom-Z-1 path: /4 Задание.py
# 4. Пользователь вводит целое положительное число. Найдите самую большую<|fim_middle|> цифру в чис... | code_fim | medium | {
"lang": "python",
"repo": "Viqm0101/Dom-Z-1",
"path": "/4 Задание.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
media = (n1 + n2 + n3) / 3
if media >=7:
print('Você esta Aprovado! ')
elif media >= 5 and media < 7:
print('Você esta na final! ')
else:
print('Reprovado!! ')<|fim_prefix|># repo: tiduswr/Algoritimos_P1_UEPB_CCEA_CAMPUS_VII path: /Lista 02/lista02ex03.py
print('Calculadora de notas! '... | code_fim | medium | {
"lang": "python",
"repo": "tiduswr/Algoritimos_P1_UEPB_CCEA_CAMPUS_VII",
"path": "/Lista 02/lista02ex03.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tiduswr/Algoritimos_P1_UEPB_CCEA_CAMPUS_VII path: /Lista 02/lista02ex03.py
print('Calculadora de notas! ')
n1 = float(input('Insira sua primeira nota: '))
n2 = f<|fim_suffix|>
media = (n1 + n2 + n3) / 3
if media >=7:
print('Você esta Aprovado! ')
elif media >= 5 and media < 7:
pr... | code_fim | medium | {
"lang": "python",
"repo": "tiduswr/Algoritimos_P1_UEPB_CCEA_CAMPUS_VII",
"path": "/Lista 02/lista02ex03.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SuperCloudDBA/auto_install_software path: /MySQL/auto_install_mysqlha_keepalived_2nodes/scripts/check_mysql.py
#!/usr/bin/python
# coding: utf-8
import time
import sys
import os
import logging
# Third-part
import mysql_helper
import filelock
import config
log_dir = config.log_dir
logging.basi... | code_fim | hard | {
"lang": "python",
"repo": "SuperCloudDBA/auto_install_software",
"path": "/MySQL/auto_install_mysqlha_keepalived_2nodes/scripts/check_mysql.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
lock = filelock.FileLock("/tmp/kpc.txt")
if lock:
logging.info("ZST Get Lock.start!!!")
try:
with lock.acquire(timeout=5):
pass
except filelock.timeout:
print "timeout"
logging.warning("get file lock timeout")
par... | code_fim | hard | {
"lang": "python",
"repo": "SuperCloudDBA/auto_install_software",
"path": "/MySQL/auto_install_mysqlha_keepalived_2nodes/scripts/check_mysql.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> 若 数据库能够正常连接 ;则 返回数据正常;
否则 判断进程和端口是否存在:
- 若此时进程和端口均存在,则连续check 5次 数据库连接情况是否正常,每次check后等待1秒;若5次check后都无法正常连接数据库,则返回数据库异常;若在完成5次check前恢复数据库连接,则返回数据库正常。
- 若此时进程不存在 or 监听端口 不存在 ;则直接返回数据库异常;
st = 0 数据库退出值为0 代表正常
st = 1 数据库退出值为1 代表异常
:return:
"""
params = {
"url"... | code_fim | hard | {
"lang": "python",
"repo": "SuperCloudDBA/auto_install_software",
"path": "/MySQL/auto_install_mysqlha_keepalived_2nodes/scripts/check_mysql.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # tag on img_info
cv.putText(img_info, "Perimeter:#{0}:{1:.1f}".format(idx, perimeter), (10, 20+idx*40),
cv.FONT_HERSHEY_COMPLEX_SMALL, 1, (51, 204, 153))
cv.putText(img_info, "Area:#{0}:{1:.1f}".format(idx, area), ... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/LEGO_detection",
"path": "/solution/segmentation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SmirkCao/LEGO_detection path: /solution/segmentation.py
#! /usr/bin/env python
# -*- coding: utf-8 -*-
# Project: LEGO_detection
# Filename: segmentation
# Date: 4/15/19
# Author: 😏 <smirk dot cao at gmail dot com>
import cv2 as cv
import numpy as np
class Segmenter(object):
def __init__(... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/LEGO_detection",
"path": "/solution/segmentation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> adaptive_method = 0
threshold_type = 1
block_size = 5
const_value = 4
max_value = 200
# -1 or np.ones*255
img_info = np.zeros((img.shape[0], int(img.shape[1]/2), img.shape[2]), img.dtype)
gray = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
bl... | code_fim | hard | {
"lang": "python",
"repo": "SmirkCao/LEGO_detection",
"path": "/solution/segmentation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r.bookmark.getTotalCount('http://www.python-izm.com/'))<|fim_prefix|># repo: moriken0921/python_study path: /応用編/49.XML-RPC/sample02.py
import xmlrpc.client
server = xmlrpc.client.ServerProxy('http://b.hatena.ne.jp/xmlrpc')
print(server.bookma<|fim_middle|>rk.getCount('http://www.python-izm.com/'))
prin... | code_fim | easy | {
"lang": "python",
"repo": "moriken0921/python_study",
"path": "/応用編/49.XML-RPC/sample02.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: moriken0921/python_study path: /応用編/49.XML-RPC/sample02.py
import xmlrpc.client
server = xmlrpc.client.ServerPro<|fim_suffix|>r.bookmark.getTotalCount('http://www.python-izm.com/'))<|fim_middle|>xy('http://b.hatena.ne.jp/xmlrpc')
print(server.bookmark.getCount('http://www.python-izm.com/'))
prin... | code_fim | medium | {
"lang": "python",
"repo": "moriken0921/python_study",
"path": "/応用編/49.XML-RPC/sample02.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> score = {}
for (src, dest) in legal_territories_to_fortify:
fortification = (src, dest, src['num_armies'] - 1)
score[self.fe.evaluate_action(fortification, self.map_layout, self.player_status, self.enemy_status)] = fortification
return score[max(score)] if l... | code_fim | hard | {
"lang": "python",
"repo": "jrsun/brisk",
"path": "/EvaluatorAI.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jrsun/brisk path: /EvaluatorAI.py
import AIBase
import Reinforcement_Evaluator
import Battle_Evaluator
import Fortify_Evaluator
#debug
import features
class EvaluatorAI(AIBase.AIBase):
def __init__(self):
super(EvaluatorAI, self).__init__()
self.re = Reinforcement_Evaluator.... | code_fim | hard | {
"lang": "python",
"repo": "jrsun/brisk",
"path": "/EvaluatorAI.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
form = TrendForm(request.POST)
if form.is_valid():
interval_one = CountStatistics(c20.objects.filter(added_by__personel__workplace = request.user.get_profile().workplace, date_of_discharge__gte = form.cleaned_data['date1a'], date_of_discharge__l... | code_fim | hard | {
"lang": "python",
"repo": "csillagharcos/Path",
"path": "/report_forms/c20/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csillagharcos/Path path: /report_forms/c20/views.py
import RequestContext
from report_forms.c20.forms import C20Form, FileUploadForm, TrendForm, AnonymStatForm
from report_forms.c20.models import c20, c20CSV
from django.utils.translation import ugettext_lazy as _
from report_forms.tools import pa... | code_fim | hard | {
"lang": "python",
"repo": "csillagharcos/Path",
"path": "/report_forms/c20/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: csillagharcos/Path path: /report_forms/c20/views.py
leUploadForm, TrendForm, AnonymStatForm
from report_forms.c20.models import c20, c20CSV
from django.utils.translation import ugettext_lazy as _
from report_forms.tools import parseInt, csvDump, calculate_age, DateException, csvExport
from unidec... | code_fim | hard | {
"lang": "python",
"repo": "csillagharcos/Path",
"path": "/report_forms/c20/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>partial_derivative = np.array([1, 1])
while not (partial_derivative == [0, 0]).all():
partial_derivative = (input * ((input * weights).sum(axis=1) - output).values.reshape((100, 1))).sum(axis=0).round(5)
weights = weights - learning_rate * partial_derivative
print(partial_derivative)
print(w... | code_fim | medium | {
"lang": "python",
"repo": "lenhat509/machine-learning-practice",
"path": "/2D_linear_regression_algo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lenhat509/machine-learning-practice path: /2D_linear_regression_algo.py
import numpy as np
import pandas as pd
pd.set_option('display.float_format', lambda x: '%.5f' % x)
<|fim_suffix|>while not (partial_derivative == [0, 0]).all():
partial_derivative = (input * ((input * weights).sum(axis=... | code_fim | hard | {
"lang": "python",
"repo": "lenhat509/machine-learning-practice",
"path": "/2D_linear_regression_algo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('api', '0002_auto_20190413_1616'),
]
operations = [
migrations.AlterField(
model_name='news',
name='thumbnail',
field=models.ImageField(blank=True, null=True, upload_to='news/thumbnail'),
),
]<|fim_prefix|># rep... | code_fim | easy | {
"lang": "python",
"repo": "Cherylon/PhotoGallery",
"path": "/PGDjango/api/migrations/0003_auto_20190414_1127.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('api', '0002_auto_20190413_1616'),
]
operations = [
migrations.AlterField(
model_name='news',
name='thumbnail',
field=models.ImageField(blank=True, null=True, upload_to='news/thumbnail'),
),
]<|fim_prefix|># re... | code_fim | easy | {
"lang": "python",
"repo": "Cherylon/PhotoGallery",
"path": "/PGDjango/api/migrations/0003_auto_20190414_1127.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Cherylon/PhotoGallery path: /PGDjango/api/migrations/0003_auto_20190414_1127.py
# Generated by Django 2.2 on 2019-04-14 09:27
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='news',
name='thumbnail',
... | code_fim | medium | {
"lang": "python",
"repo": "Cherylon/PhotoGallery",
"path": "/PGDjango/api/migrations/0003_auto_20190414_1127.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return ' '.join([stemmer.stem(i) for i in text.split(' ')])<|fim_prefix|># repo: fettermania/tfidf-pdln path: /clean_text.py
from nltk.stem.porter import *
stemmer = PorterStemmer()
<|fim_middle|>def clean_query_string(query):
query = query.strip()
query = re.sub("[\W]+", " ", query)
return po... | code_fim | hard | {
"lang": "python",
"repo": "fettermania/tfidf-pdln",
"path": "/clean_text.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fettermania/tfidf-pdln path: /clean_text.py
from nltk.stem.porter import *
stemmer = PorterStemmer()
def clean_query_string(query):
query = query.strip()
query = re.sub("[\W]+", " ", query)
return porter_stem_pass(query)
<|fim_suffix|> return ' '.join([stemmer.stem(i) for i in text.spl... | code_fim | hard | {
"lang": "python",
"repo": "fettermania/tfidf-pdln",
"path": "/clean_text.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>o = 0
for i in range(0, 16, 2):
for j in range(i, 16, 2):
if q[i] == q[j] and q[i + 1] == q[j + 1]:
o -= 1
if abs(q[i] - q[j]) == abs(q[i + 1] - q[j + 1]) or q[i] == q[j] or q[i + 1] == q[j + 1]:
o += 1
if o == 0:
print('NO')
else:
print('YES')<|fim_pref... | code_fim | medium | {
"lang": "python",
"repo": "Zakir887/Python1",
"path": "/Lists/task_16_hod_ferz.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zakir887/Python1 path: /Lists/task_16_hod_ferz.py
# Известно, что на доске 8×8 можно расставить 8 ферзей так, чтобы они не били друг друга. Вам дана расстановка 8 ферзей
# на доске, определите, есть ли среди них пара бьющих друг друга.
# Программа получает на вход восемь пар чисел, каждое число о... | code_fim | medium | {
"lang": "python",
"repo": "Zakir887/Python1",
"path": "/Lists/task_16_hod_ferz.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 1006927966/6sclass path: /utils/cropbyanchor.py
import cv2
import numpy as np
import os
def corpbyanchor(img, size):
imglist = []
h, w = img.shape[0:2]
anchorx = w//size
anchory = h//size
if anchorx < 100 or anchory < 100:
return imglist
for i in rang... | code_fim | medium | {
"lang": "python",
"repo": "1006927966/6sclass",
"path": "/utils/cropbyanchor.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == '__main__':
dirpath = '/defaultShare/share/wujl/83/online_data/ddb_train_bg_v2'
savepath = '/defaultShare/share/wujl/83/online_data/ddb_crop'
os.makedirs(savepath, exist_ok=True)
cropx(dirpath, 4, savepath)<|fim_prefix|># repo: 1006927966/6sclass path: /utils/cropbyanch... | code_fim | hard | {
"lang": "python",
"repo": "1006927966/6sclass",
"path": "/utils/cropbyanchor.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lisiynos/loo2015 path: /day2/8_transform/stress.py
#!/usr/bin/python3
import random, shutil
from subprocess import call
def randomGraph(n):
graph = []
for i in range(n):
line = ['-'] * n
line[i] = '.'
graph.append(line)
for i in range(n):
for j in r... | code_fim | hard | {
"lang": "python",
"repo": "lisiynos/loo2015",
"path": "/day2/8_transform/stress.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> call(["./transform_av"])
shutil.copyfile("transform.out", "transform.fast")
call(["./transform_av_20"])
shutil.copyfile("transform.out", "transform.slow")
import filecmp
if not filecmp.cmp('transform.slow', 'transform.fast'):
print("FAIL")
print("".join(open("... | code_fim | hard | {
"lang": "python",
"repo": "lisiynos/loo2015",
"path": "/day2/8_transform/stress.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Thevgm01/sfa_scripts path: /src/smartsave.py
import logging
from PySide2 import QtWidgets, QtCore
from shiboken2 import wrapInstance
import maya.OpenMayaUI as omui
import maya.cmds as cmds
import pymel.core as pmc
from pymel.core.system import Path
log = logging.getLogger(__name__)
def maya_m... | code_fim | hard | {
"lang": "python",
"repo": "Thevgm01/sfa_scripts",
"path": "/src/smartsave.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.descriptor_line_edit = QtWidgets.QLineEdit(
self.scenefile.descriptor)
self.descriptor_line_edit.setMinimumWidth(100)
self.task_line_edit = QtWidgets.QLineEdit(self.scenefile.task)
self.task_line_edit.setFixedWidth(50)
self.version_spinbox = QtWidge... | code_fim | hard | {
"lang": "python",
"repo": "Thevgm01/sfa_scripts",
"path": "/src/smartsave.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>i - 1]
A[i] += 1
s += 1
print(A)<|fim_prefix|># repo: typicalwestern/pythonlessons path: /N19-in10401.py
A = [0, 2, 3, 4, 4, 10, 4, 5, 6, 12, 9]
n = 10
s = 0
print(A)
for i in range(2, n + 1):
if A[<|fim_middle|>i - 1] < A[i]:
A[i - 1], A[i] = A[i], A[ | code_fim | easy | {
"lang": "python",
"repo": "typicalwestern/pythonlessons",
"path": "/N19-in10401.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: typicalwestern/pythonlessons path: /N19-in10401.py
A = [0, 2, 3, 4, 4, 10, 4, 5, 6, 12, 9]
n = 10
s = 0
print(A)
for i in range(2, n + 1):
if A[<|fim_suffix|>i - 1]
A[i] += 1
s += 1
print(A)<|fim_middle|>i - 1] < A[i]:
A[i - 1], A[i] = A[i], A[ | code_fim | easy | {
"lang": "python",
"repo": "typicalwestern/pythonlessons",
"path": "/N19-in10401.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tuckeran5607/PersonalProjects path: /Laundrybot.py
import RPi.GPIO as GPIO
import time
from pushbullet import Pushbullet
from gpiozero import Button
GPIO.setwarnings(False)
GPIO.setmode(GPIO.BCM)
from datetime import datetime
#GPIO Setup
sens_pin = 2
button_pin = 16
led_pin = 26
GPIO.setup(sens_... | code_fim | hard | {
"lang": "python",
"repo": "Tuckeran5607/PersonalProjects",
"path": "/Laundrybot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return(all(x < val for x in logs))
#
#CODE
#
while (True): #MasterLoop
print("Service Re/Started")
button.wait_for_press()
pushJobStart()
logs.clear()
trigg = 0
logs = [None] * 5 # PURGE LOGS
GPIO.output(led_pin, GPIO.HIGH)
time.sl... | code_fim | hard | {
"lang": "python",
"repo": "Tuckeran5607/PersonalProjects",
"path": "/Laundrybot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shaidazmin/Python-for-Data-Science path: /FileOperation.py
#
# fileRead = open("jokes.txt","r")
#
# for i in fileRead:
# print(i)
#
# print(fileRead.readline())
#
# fileRead.close()
newFile = open("writingFile.txt", 'a')
#
newFile.write(input("Write : "))
<|fim_suffix|>print(newFile.rea... | code_fim | medium | {
"lang": "python",
"repo": "shaidazmin/Python-for-Data-Science",
"path": "/FileOperation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>newFile.write(input("Write : "))
newFile = open("writingFile.txt", 'r')
for i in newFile:
print(i)
print(newFile.readline())
newFile.close()
with open("writingFile.txt") as file:
for i in file:
print(i)<|fim_prefix|># repo: shaidazmin/Python-for-Data-Science path: /FileOperation.py
... | code_fim | easy | {
"lang": "python",
"repo": "shaidazmin/Python-for-Data-Science",
"path": "/FileOperation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def clickBtn1(self):
open.openFolder()<|fim_prefix|># repo: annie522/kitri path: /PROJ_COD/Machine/kwon/UI/new.py
from PyQt5 import QtCore, QtGui, QtWidgets
import test_rcc
import open
class SuccessList(QWidget, QDialog):
def __init__(self, parent=None):
QtWidgets... | code_fim | medium | {
"lang": "python",
"repo": "annie522/kitri",
"path": "/PROJ_COD/Machine/kwon/UI/new.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: annie522/kitri path: /PROJ_COD/Machine/kwon/UI/new.py
from PyQt5 import QtCore, QtGui, QtWidgets
import test_rcc
import open
class SuccessList(QWidget, QDialog):
def __init__(self, parent=None):
QtWidgets.QDialog.__init__(self, parent)
self.ui = uic.loadUi("shutdown.ui", self... | code_fim | easy | {
"lang": "python",
"repo": "annie522/kitri",
"path": "/PROJ_COD/Machine/kwon/UI/new.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>elif x >= 2.0 and y < 47 :
print("Not enough number of lectures!")
else :
print("GRADUATED!!!")<|fim_prefix|># repo: x89846394/280201032 path: /lab3/example3.py
x = float(input("What is your GPA? "))
y = float(input("What is the number of lectures you take? "))
if x < 2.0 and y < 47 :
print("Not eno... | code_fim | easy | {
"lang": "python",
"repo": "x89846394/280201032",
"path": "/lab3/example3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: x89846394/280201032 path: /lab3/example3.py
x = float(input("What is your GPA? "))
y = float(input("What is the number of lectures you take? "))
if x < 2.0 and y < 47 :
print("Not enough number of lectures and GPA!")
<|fim_suffix|>elif x >= 2.0 and y < 47 :
print("Not enough number of lecture... | code_fim | easy | {
"lang": "python",
"repo": "x89846394/280201032",
"path": "/lab3/example3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#update sidbar onclick
#side bar call back start
@app.callback(
Output('cities-data', 'children'),
[Input('earth-graph', 'clickData')])
def display_hover_data(clickData):
name = clickData['points'][0]['customdata'][0] #get country name
return [html.Li(children=[
#add info to... | code_fim | hard | {
"lang": "python",
"repo": "arjit3004/friendly-weather",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = clickData['points'][0]['customdata'][0] #get country name
return [html.Li(children=[
#add info to the side bar
city['location'],
#order last
html.Div(children=[
# data containers
html.Div(childr... | code_fim | hard | {
"lang": "python",
"repo": "arjit3004/friendly-weather",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arjit3004/friendly-weather path: /app.py
#dash imports
import dash
import dash_core_components as dcc
import dash_html_components as html
from dash.dependencies import Input, Output, State
#python imports
#my fucntion imports
from graphs import earth,country,big_graph
from data import earth_dat... | code_fim | hard | {
"lang": "python",
"repo": "arjit3004/friendly-weather",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jpayan/excercises path: /algorithms/check_if_words_are_anagrams.py
from typing import Dict
def are_anagrams(word1: str, word2: str) -> bool:
<|fim_suffix|>
def get_letter_count(word: str) -> Dict[str, int]:
letter_count = {}
for letter in word:
if letter in letter_count:
... | code_fim | medium | {
"lang": "python",
"repo": "jpayan/excercises",
"path": "/algorithms/check_if_words_are_anagrams.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_letter_count(word: str) -> Dict[str, int]:
letter_count = {}
for letter in word:
if letter in letter_count:
letter_count[letter] += 1
else:
letter_count[letter] = 1
return letter_count
if __name__ == '__main__':
word1 = "arc"
word2 ... | code_fim | medium | {
"lang": "python",
"repo": "jpayan/excercises",
"path": "/algorithms/check_if_words_are_anagrams.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == '__main__':
word1 = "arc"
word2 = "car"
print(are_anagrams(word1, word2))<|fim_prefix|># repo: jpayan/excercises path: /algorithms/check_if_words_are_anagrams.py
from typing import Dict
def are_anagrams(word1: str, word2: str) -> bool:
return get_letter_count(word1) == ... | code_fim | hard | {
"lang": "python",
"repo": "jpayan/excercises",
"path": "/algorithms/check_if_words_are_anagrams.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: micycle1/Project-Euler path: /euler 8.py
import functools
import operator
BIGNUM = ("""
73167176531330624919225119674426574742355349194934
96983520312774506326239578318016984801869478851843
85861560789112949495459501737958331952853208805511
12540698747158523863050715693290963295227443043557
6689... | code_fim | hard | {
"lang": "python",
"repo": "micycle1/Project-Euler",
"path": "/euler 8.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>580156166097919133875499200524063689912560717606
05886116467109405077541002256983155200055935729725
71636269561882670428252483600823257530420752963450""".replace("\n", ""))
def euler_8():
return max(functools.reduce(operator.mul, list(int(x) for x in BIGNUM[i:i + 13]), 1) for i in range(len(BIGNUM)))... | code_fim | hard | {
"lang": "python",
"repo": "micycle1/Project-Euler",
"path": "/euler 8.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Meta:
model = BlogUser
fields = ('username', 'password', 'captcha',)
class UserUpdateForm(UserChangeForm):
captcha = CaptchaField()
class Meta:
model = BlogUser
fields = ('first_name', 'last_name', 'email', 'captcha', )<|fim_prefix|># repo: ransomate/S... | code_fim | easy | {
"lang": "python",
"repo": "ransomate/SW-App",
"path": "/account/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ransomate/SW-App path: /account/forms.py
from .models import BlogUser
from captcha.fields import CaptchaField
from django.contrib.auth.forms import UserChangeForm, AuthenticationForm
class UserAuthForm(AuthenticationForm):
<|fim_suffix|> model = BlogUser
fields = ('first_name', ... | code_fim | medium | {
"lang": "python",
"repo": "ransomate/SW-App",
"path": "/account/forms.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> captcha = CaptchaField()
class Meta:
model = BlogUser
fields = ('first_name', 'last_name', 'email', 'captcha', )<|fim_prefix|># repo: ransomate/SW-App path: /account/forms.py
from .models import BlogUser
from captcha.fields import CaptchaField
from django.contrib.auth.forms impor... | code_fim | easy | {
"lang": "python",
"repo": "ransomate/SW-App",
"path": "/account/forms.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Enable CORS for the entire app
cors = CORS(app, resources={
r'/*': {'origins': '*'}
})
from open511.api import api<|fim_prefix|># repo: cforlando/open511-orl path: /open511/__init__.py
"""
Open511 Orlando
"""
from flask import Flask
from flask_cors import CORS
<|fim_middle|>app = Flask(__name__)... | code_fim | easy | {
"lang": "python",
"repo": "cforlando/open511-orl",
"path": "/open511/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cforlando/open511-orl path: /open511/__init__.py
"""
Open511 Orlando
"""
from flask import Flask
from flask_cors import CORS
<|fim_suffix|>from open511.api import api<|fim_middle|>app = Flask(__name__)
app.config.from_object('config')
# Enable CORS for the entire app
cors = CORS(app, resources... | code_fim | medium | {
"lang": "python",
"repo": "cforlando/open511-orl",
"path": "/open511/__init__.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>from open511.api import api<|fim_prefix|># repo: cforlando/open511-orl path: /open511/__init__.py
"""
Open511 Orlando
"""
from flask import Flask
from flask_cors import CORS
app = Flask(__name__)
app.config.from_object('config')
<|fim_middle|># Enable CORS for the entire app
cors = CORS(app, resources... | code_fim | medium | {
"lang": "python",
"repo": "cforlando/open511-orl",
"path": "/open511/__init__.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(result.src) #source language is printed
print(result.dest) #destination language is printed
print(result.text) #result text is printed<|fim_prefix|># repo: S-SANTHI25/Inframind_4_Contest path: /Sample_Text_Translation.py
!pip install googletrans #installation of googletrans
import googletrans #imp... | code_fim | medium | {
"lang": "python",
"repo": "S-SANTHI25/Inframind_4_Contest",
"path": "/Sample_Text_Translation.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: S-SANTHI25/Inframind_4_Contest path: /Sample_Text_Translation.py
!pip install googletrans #installation of googletrans
<|fim_suffix|>from googletrans import Translator
translator = Translator() #translator object is created
result = translator.translate('How are you?', src='en', dest='ta') #tra... | code_fim | medium | {
"lang": "python",
"repo": "S-SANTHI25/Inframind_4_Contest",
"path": "/Sample_Text_Translation.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> while s != 'COM':
s = orbit_map[s]
yield s
you = set(get_orbits_for_satellite('YOU'))
santa = set(get_orbits_for_satellite('SAN'))
transfers = len(you ^ santa)
print('part 1:', orbit_count)
print('part 2:', transfers)<|fim_prefix|># repo: SeniorDerpyDev/AdventOfCode path: /... | code_fim | medium | {
"lang": "python",
"repo": "SeniorDerpyDev/AdventOfCode",
"path": "/2019/python/day6.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeniorDerpyDev/AdventOfCode path: /2019/python/day6.py
orbit_map = {}
with open('../day_6.txt', 'r') as f:
for l in f:
center, satellite = l.rstrip().split(')')
orbit_map[satellite] = center
<|fim_suffix|>you = set(get_orbits_for_satellite('YOU'))
santa = set(get_orb... | code_fim | hard | {
"lang": "python",
"repo": "SeniorDerpyDev/AdventOfCode",
"path": "/2019/python/day6.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name='Services',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('Ui', models.TextField(max_length=50)),
('webdev', models.TextField(max_length=50)),
('webdesign'... | code_fim | hard | {
"lang": "python",
"repo": "pro-fibonacci/portfolio",
"path": "/apps/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pro-fibonacci/portfolio path: /apps/migrations/0001_initial.py
# Generated by Django 3.0.4 on 2020-03-18 22:25
from django.db import migrations, models
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.Cre... | code_fim | hard | {
"lang": "python",
"repo": "pro-fibonacci/portfolio",
"path": "/apps/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mgermaine93/python-playground path: /python-coding-bat/warmup-2/array_front9/test_module.py
import unittest
from array_front9 import array_front9
class UnitTests(unittest.TestCase):
def test_1_2_9_3_4_returns_true(self):
actual = array_front9([1, 2, 9, 3, 4])
expected = Tru... | code_fim | hard | {
"lang": "python",
"repo": "mgermaine93/python-playground",
"path": "/python-coding-bat/warmup-2/array_front9/test_module.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test_5_5_returns_false(self):
actual = array_front9([5, 5])
expected = False
self.assertEqual(
actual, expected, 'Expected calling array_front9() with "[5, 5]" to return "False"')
def test_2_returns_false(self):
actual = array_front9([2])
ex... | code_fim | hard | {
"lang": "python",
"repo": "mgermaine93/python-playground",
"path": "/python-coding-bat/warmup-2/array_front9/test_module.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: asliturkcalli/Python_How-to-program_Exercises path: /loop/addition with loop.py
"""*****addition with loop*****"""
<|fim_suffix|> if a=="q":
print(sum_varaible)
break
else:
a=int(a)
sum_varaible+=a<|fim_middle|>print(""""if you want exit program ,ent... | code_fim | medium | {
"lang": "python",
"repo": "asliturkcalli/Python_How-to-program_Exercises",
"path": "/loop/addition with loop.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if a=="q":
print(sum_varaible)
break
else:
a=int(a)
sum_varaible+=a<|fim_prefix|># repo: asliturkcalli/Python_How-to-program_Exercises path: /loop/addition with loop.py
"""*****addition with loop*****"""
<|fim_middle|>print(""""if you want exit program ,ent... | code_fim | medium | {
"lang": "python",
"repo": "asliturkcalli/Python_How-to-program_Exercises",
"path": "/loop/addition with loop.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def expect_node_addr(self, nodeid: int, addr: str, timeout=100):
addr = ipaddress.IPv6Address(addr)
found_addr = False
while timeout > 0:
if addr in map(ipaddress.IPv6Address, self.ns.get_ipaddrs(nodeid)):
found_addr = True
break
... | code_fim | hard | {
"lang": "python",
"repo": "simonlingoogle/ot-ns",
"path": "/pylibs/stress_tests/BaseStressTest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def avg(self, vals: Collection[float]) -> float:
assert len(vals) > 0
return sum(vals) / len(vals)
def expect_all_nodes_become_routers(self, timeout: int = 1000) -> None:
all_routers = False
while timeout > 0 and not all_routers:
self.ns.go(10)
... | code_fim | hard | {
"lang": "python",
"repo": "simonlingoogle/ot-ns",
"path": "/pylibs/stress_tests/BaseStressTest.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> def json(self):
return {"name": self.name, "choice": self.choice, "state": self.state, "consumptionDate": self.consumptionDate }
@classmethod
def find_by_name(cls, name):
return cls.query.filter_by(name=name).first()
def save_to_db(self):
db.session.add(self)
... | code_fim | hard | {
"lang": "python",
"repo": "thorwolpert/namex-api",
"path": "/api/app/models/name.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: thorwolpert/namex-api path: /api/app/models/name.py
"""Name hold a name choice for a Request
"""
from app import db
class Name(db.Model):
__tablename__ = 'names'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(1024))
state = db.Column(db.String(15), defau... | code_fim | medium | {
"lang": "python",
"repo": "thorwolpert/namex-api",
"path": "/api/app/models/name.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> db.session.add(self)
db.session.commit()
def delete_from_db(self):
db.session.delete(self)
db.session.commit()<|fim_prefix|># repo: thorwolpert/namex-api path: /api/app/models/name.py
"""Name hold a name choice for a Request
"""
from app import db
class Name(db.Model... | code_fim | hard | {
"lang": "python",
"repo": "thorwolpert/namex-api",
"path": "/api/app/models/name.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(nth_smallest([7, 5, 3, 1], 1))
print(nth_smallest([1, 3, 5, 7], 3))
print(nth_smallest([1, 3, 5, 7], 5))
print(nth_smallest([7, 3, 5, 1], 2))<|fim_prefix|># repo: kdolic/cs-guided-project-python-i path: /src/demonstration_07.py
"""
Challenge #7:
Given an unsorted list, create a function that return... | code_fim | hard | {
"lang": "python",
"repo": "kdolic/cs-guided-project-python-i",
"path": "/src/demonstration_07.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kdolic/cs-guided-project-python-i path: /src/demonstration_07.py
"""
Challenge #7:
Given an unsorted list, create a function that returns the nth smallest element
(the smallest element is the first smallest, the second smallest element is the
second smallest, etc).
Examples:
- nth_smallest([7, 5,... | code_fim | hard | {
"lang": "python",
"repo": "kdolic/cs-guided-project-python-i",
"path": "/src/demonstration_07.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: taikonetwork/taikonetwork path: /scripts/analyze_sync_log.py
#!/bin/env/python
import re
import sys
import math
def nCr(n,r):
f = math.factorial
return int(f(n) / f(r) / f(n-r))
def analyze_log():
f = open('update_sfdata.log', 'r')
groups_synced = []
group_duplicates = {}
... | code_fim | hard | {
"lang": "python",
"repo": "taikonetwork/taikonetwork",
"path": "/scripts/analyze_sync_log.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> result.write("These groups might have possible duplicate 'Membership' entries:\n\n")
offset = 0
for groupname, num in group_duplicates.items():
result.write("{0}: {1}\n".format(groupname, num))
offset += num
result.write("\n> Number of duplicate 'Membership' entries detect... | code_fim | hard | {
"lang": "python",
"repo": "taikonetwork/taikonetwork",
"path": "/scripts/analyze_sync_log.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Additionals',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('question_id', models.IntegerField()),
('user_id', mod... | code_fim | hard | {
"lang": "python",
"repo": "protasovse/mlo",
"path": "/project/apps/entry/migrations/0032_auto_20180412_1706.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: protasovse/mlo path: /project/apps/entry/migrations/0032_auto_20180412_1706.py
# Generated by Django 2.0.2 on 2018-04-12 14:06
from django.db import migrations, models
class Migration(migrations.Migration):
<|fim_suffix|> operations = [
migrations.CreateModel(
name='Add... | code_fim | hard | {
"lang": "python",
"repo": "protasovse/mlo",
"path": "/project/apps/entry/migrations/0032_auto_20180412_1706.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>b2 = Board.Board(np.array([[0,0,0,0,0,0,2,0,0],
[0,8,0,0,0,7,0,9,0],
[6,0,2,0,0,0,5,0,0],
[0,7,0,0,6,0,0,0,0],
[0,0,0,9,0,1,0,0,0],
[0,0,0,0,2,0,0,4,0],
... | code_fim | hard | {
"lang": "python",
"repo": "janpet2718/BruteForceSudoku",
"path": "/runSudoku.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: janpet2718/BruteForceSudoku path: /runSudoku.py
import Solver
import Board
import numpy as np
b0 = Board.Board(np.array([[0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0],
[0,0,0,0,0,0,0,0,0],
... | code_fim | hard | {
"lang": "python",
"repo": "janpet2718/BruteForceSudoku",
"path": "/runSudoku.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lhbbbb/TIL path: /Algorithm/Samsung/2기서울1반9월30일이현빈/5209_min_cost.py
#import sys
#sys.stdin = open('sample_input.txt', 'r')
T = int(input())
<|fim_suffix|> V = [list(map(int, input().split())) for _ in range(N)]
visited = [0] * N
min_val = 1000000
backtrack(0, 0)
print('#{} ... | code_fim | hard | {
"lang": "python",
"repo": "lhbbbb/TIL",
"path": "/Algorithm/Samsung/2기서울1반9월30일이현빈/5209_min_cost.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> visited = [0] * N
min_val = 1000000
backtrack(0, 0)
print('#{} {}'.format(tc, min_val))<|fim_prefix|># repo: lhbbbb/TIL path: /Algorithm/Samsung/2기서울1반9월30일이현빈/5209_min_cost.py
#import sys
#sys.stdin = open('sample_input.txt', 'r')
T = int(input())
def backtrack(k, cost):
global m... | code_fim | medium | {
"lang": "python",
"repo": "lhbbbb/TIL",
"path": "/Algorithm/Samsung/2기서울1반9월30일이현빈/5209_min_cost.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jasison27/CIC-localization path: /zoneswindow.py
from PyQt4 import QtGui
from zones_ui import Ui_zones
from config import Config
class ZonesWindow(QtGui.QDialog):
def __init__(self,parent = None):
QtGui.QDialog.__init__(self,parent)
self.ui = Ui_zones()
self.ui.setup... | code_fim | hard | {
"lang": "python",
"repo": "jasison27/CIC-localization",
"path": "/zoneswindow.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.ui.tableWidget.insertRow(0)
def removeItem(self):
row = self.ui.tableWidget.currentRow()
if row == -1:
return
self.ui.tableWidget.removeRow(row)<|fim_prefix|># repo: jasison27/CIC-localization path: /zoneswindow.py
from PyQt4 import QtGui
from zones_... | code_fim | hard | {
"lang": "python",
"repo": "jasison27/CIC-localization",
"path": "/zoneswindow.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_divmod(self):
"""
Test int.__divmod__
"""
vals = [10**i for i in range(0, 20)]
for i in range(200):
x = random.choice(vals)
y = random.choice(vals)
self.assertEqual(int(y).__rdivmod__(int(x)), divmod(x, y), msg='x={0... | code_fim | hard | {
"lang": "python",
"repo": "PythonCharmers/python-future",
"path": "/tests/test_future/test_int_old_division.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: atorr5555/01-the-bifid-cipher path: /program.py
import fileinput
import string
# Funcion que llena la tabla usando la llave
# y el alfabeto restante
def fill_table():
i=0
j=0
for char in KEY:
table[i][j] = char
j = (j+1) % 5
if j == 0:
i = (i+1) % 5
index=0
table[i][j... | code_fim | hard | {
"lang": "python",
"repo": "atorr5555/01-the-bifid-cipher",
"path": "/program.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Divide la cadena con indices en dos partes
break_point = int(len(string_nums) / 2)
parte1 = string_nums[:break_point]
parte2 = string_nums[break_point:]
# Genera nuevos indices usando las dos partes generadas
coord_origen = [(int(parte1[i]), int(parte2[i])) for i in range(break_point)... | code_fim | hard | {
"lang": "python",
"repo": "atorr5555/01-the-bifid-cipher",
"path": "/program.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>-1]:
return True
return False<|fim_prefix|># repo: prachi1211/CompetitiveProgramming path: /LEETCODE/05_valid_palindrome.py
class Solution:
def isPalindrome(self, name: <|fim_middle|>str) -> bool:
name = (''.join(filter(str.isalnum,name))).lower()
if name == n... | code_fim | medium | {
"lang": "python",
"repo": "prachi1211/CompetitiveProgramming",
"path": "/LEETCODE/05_valid_palindrome.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prachi1211/CompetitiveProgramming path: /LEETCODE/05_valid_palindrome.py
class Solution:
def isPalindrome(self, name: <|fim_suffix|>-1]:
return True
return False<|fim_middle|>str) -> bool:
name = (''.join(filter(str.isalnum,name))).lower()
if name == n... | code_fim | medium | {
"lang": "python",
"repo": "prachi1211/CompetitiveProgramming",
"path": "/LEETCODE/05_valid_palindrome.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>salnum,name))).lower()
if name == name[::-1]:
return True
return False<|fim_prefix|># repo: prachi1211/CompetitiveProgramming path: /LEETCODE/05_valid_palindrome.py
class Solution:
def isPalindrome(self, name: <|fim_middle|>str) -> bool:
name = (''.join(filter... | code_fim | easy | {
"lang": "python",
"repo": "prachi1211/CompetitiveProgramming",
"path": "/LEETCODE/05_valid_palindrome.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>csv", 'rb') as rawdata:
result = chardet.detect(rawdata.read(10000))
# check what the character encoding might be
print(result)<|fim_prefix|># repo: jason-jz-zhu/ML-knowledge-pool path: /Data Cleaning/Character Encodings.py
# look at the first ten thousand bytes to guess the character enc<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "jason-jz-zhu/ML-knowledge-pool",
"path": "/Data Cleaning/Character Encodings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jason-jz-zhu/ML-knowledge-pool path: /Data Cleaning/Character Encodings.py
# look at the first ten thousand bytes to guess the character enc<|fim_suffix|>csv", 'rb') as rawdata:
result = chardet.detect(rawdata.read(10000))
# check what the character encoding might be
print(result)<|fim_middl... | code_fim | medium | {
"lang": "python",
"repo": "jason-jz-zhu/ML-knowledge-pool",
"path": "/Data Cleaning/Character Encodings.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>0000))
# check what the character encoding might be
print(result)<|fim_prefix|># repo: jason-jz-zhu/ML-knowledge-pool path: /Data Cleaning/Character Encodings.py
# look at the first ten thousand bytes to guess the character enc<|fim_middle|>oding
with open("../input/kickstarter-projects/ks-projects-2018... | code_fim | medium | {
"lang": "python",
"repo": "jason-jz-zhu/ML-knowledge-pool",
"path": "/Data Cleaning/Character Encodings.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class Solution:
def deleteNode(self, head: ListNode, val: int) -> ListNode:
t = ListNode(-1)
t.next = head
t2 = t
while t.next != None:
if t.next.val == val:
t3 = t.next
t.next = t.next.next
del t3
... | code_fim | medium | {
"lang": "python",
"repo": "KevenGe/LeetCode-Solutions",
"path": "/books/《剑指offer》/剑指 Offer 18. 删除链表的节点.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class Solution:
def deleteNode(self, head: ListNode, val: int) -> ListNode:
t = ListNode(-1)
t.next = head
t2 = t
while t.next != None:
if t.next.val == val:
t3 = t.next
t.next = t.next.next
del t3
... | code_fim | medium | {
"lang": "python",
"repo": "KevenGe/LeetCode-Solutions",
"path": "/books/《剑指offer》/剑指 Offer 18. 删除链表的节点.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KevenGe/LeetCode-Solutions path: /books/《剑指offer》/剑指 Offer 18. 删除链表的节点.py
# 剑指 Offer 18. 删除链表的节点
# https://leetcode-cn.com/problems/shan-chu-lian-biao-de-jie-dian-lcof/
<|fim_suffix|> self.val = x
self.next = None
class Solution:
def deleteNode(self, head: ListNode, val: int... | code_fim | medium | {
"lang": "python",
"repo": "KevenGe/LeetCode-Solutions",
"path": "/books/《剑指offer》/剑指 Offer 18. 删除链表的节点.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goodok/sympy path: /sympy/combinatorics/permutations.py
>>> p = Permutation([0,1,2,3])
>>> p.is_even
True
>>> p = Permutation([3,2,1,0])
>>> p.is_even
True
See Also
========
is_odd
"""
return S(self.parity()).is_ev... | code_fim | hard | {
"lang": "python",
"repo": "goodok/sympy",
"path": "/sympy/combinatorics/permutations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> Examples
========
>>> from sympy.combinatorics.permutations import Permutation
>>> p = Permutation([[2,0],[3,1]])
>>> ~p
Permutation([2, 3, 0, 1])
>>> p*(~p) == Permutation([0,1,2,3])
True
"""
a = self.array_form
n = ... | code_fim | hard | {
"lang": "python",
"repo": "goodok/sympy",
"path": "/sympy/combinatorics/permutations.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: goodok/sympy path: /sympy/combinatorics/permutations.py
return res
def __invert__(self):
"""
Finds the invert of a permutation.
A permutation multiplied by its invert equals
the identity permutation.
Examples
========
>>> from s... | code_fim | hard | {
"lang": "python",
"repo": "goodok/sympy",
"path": "/sympy/combinatorics/permutations.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> pass
def test_combine_state_names_and_abbreviations():
pass<|fim_prefix|># repo: alex-vegan/100daysofcode-with-python-course path: /days/day009/test_bite_089_Playing_with_lists_and_dicts_and_github.py
from bite_089_Playing_with_lists_and_dicts_and_github import (get_every_nth_state,
get_sta... | code_fim | easy | {
"lang": "python",
"repo": "alex-vegan/100daysofcode-with-python-course",
"path": "/days/day009/test_bite_089_Playing_with_lists_and_dicts_and_github.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.