text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_prefix|># repo: piladzis10/Zole-Pygame-Sockets path: /client.py
import pygame
import os
from network import Network
from card import Card
from game import Game, Player
pygame.font.init()
# Initializing window
WIDTH, HEIGHT = 700, 800
WIN = pygame.display.set_mode((WIDTH, HEIGHT))
pygame.display.set_caption("Zol... | code_fim | hard | {
"lang": "python",
"repo": "piladzis10/Zole-Pygame-Sockets",
"path": "/client.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def redraw_window(win):
win.fill((53, 101, 77))
draw_player(win, 60, 650, CARD_WIDTH, CARD_HEIGHT, player.cards,CARD_IMAGES)
draw_opponents(win, 60, 150, CARD_WIDTH, CARD_WIDTH, CARD_IMAGE_BACK_GRAY, 8)
draw_opponents(win, 550, 150, CARD_WIDTH, CARD_WIDTH, CARD_IMAGE... | code_fim | hard | {
"lang": "python",
"repo": "piladzis10/Zole-Pygame-Sockets",
"path": "/client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>STRENGTH_SCALE_NON_TRUMPS = ["A", "10", "K", "9", "None"]
def draw_player(win,x, y,width,height, cards, card_images):
i = 0
for card in cards:
win.blit(card_images[card.name], (x + i * width, y))
card.position = (x + i * width, y, x +
i * width + width... | code_fim | hard | {
"lang": "python",
"repo": "piladzis10/Zole-Pygame-Sockets",
"path": "/client.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> table = "patient_" + str(self.pid)
send_answer(self.question[self.index]['qid'], 'Нет', table)
if (self.index<self.maxim-1):
self.Pat = PW(self.index + 1, self.question, self.pid)
self.Pat.show()
self.close()<|fim_prefix|># repo: Apopheosis/Clin... | code_fim | hard | {
"lang": "python",
"repo": "Apopheosis/Clinic",
"path": "/Clinic/PatientWindow.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Apopheosis/Clinic path: /Clinic/PatientWindow.py
from PyQt5.QtCore import *
from PyQt5.QtWidgets import *
from PyQt5.QtSql import *
from DatabaseHandler import send_answer
class PW(QWidget):
def __init__(self, index, question, pid):
super().__init__()
self.question ... | code_fim | hard | {
"lang": "python",
"repo": "Apopheosis/Clinic",
"path": "/Clinic/PatientWindow.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SaumyaShastri/SearchEngine path: /Search_Engine.py
from typing import Tuple
#Creating a trie structure and it's node
class TrieNode(object):
def __init__(self, char: str):
self.char = char
self.children = []
#the last character of the word.`
self.word_finish... | code_fim | hard | {
"lang": "python",
"repo": "SaumyaShastri/SearchEngine",
"path": "/Search_Engine.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#selecting file for scrapping into fdata->files
#please change the dircectory to run on your device
fdata = r"./input/"
files=os.listdir(fdata)
#cleaning the text in every every file from punctuations, stop words, digits, words less than length 2 and other symbols
for file in files:
fname=file #cal... | code_fim | hard | {
"lang": "python",
"repo": "SaumyaShastri/SearchEngine",
"path": "/Search_Engine.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: crisperdue/mathserver path: /mathtoys/googlogin.py
#!/usr/bin/env python2.7
# Google APIs
from oauth2client import client, crypt
CLIENT_ID = '788221055258-j59svg86sv121jdr7utnhc2rs9tkb9s4.apps.googleusercontent.com'
<|fim_suffix|> try:
idinfo = client.verify_id_token(token, CLIENT_I... | code_fim | hard | {
"lang": "python",
"repo": "crisperdue/mathserver",
"path": "/mathtoys/googlogin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
idinfo = client.verify_id_token(token, CLIENT_ID)
if idinfo['aud'] not in [CLIENT_ID]:
# raise crypt.AppIdentityError("Unrecognized client.")
return None
if idinfo['iss'] not in ['accounts.google.com', 'https://accounts.google.com']:
# r... | code_fim | hard | {
"lang": "python",
"repo": "crisperdue/mathserver",
"path": "/mathtoys/googlogin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: primiano/bitleaks.net path: /handlers/redirect.py
import webapp2
class RedirectToSiteRootHandler(webapp2.RequestHandler):
<|fim_suffix|> def get(self, uri):
self.response.set_status(301)
redirect_uri = uri + '/'
self.response.headers['Location'] = redirect_uri
self.res... | code_fim | medium | {
"lang": "python",
"repo": "primiano/bitleaks.net",
"path": "/handlers/redirect.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>app = webapp2.WSGIApplication([
('/blog', RedirectToSiteRootHandler),
('/blog/', RedirectToSiteRootHandler),
('(.*[^/])', AppendTrailingSlashHandler),
], debug=True)<|fim_prefix|># repo: primiano/bitleaks.net path: /handlers/redirect.py
import webapp2
class RedirectToSiteRootHandler(webapp2.... | code_fim | hard | {
"lang": "python",
"repo": "primiano/bitleaks.net",
"path": "/handlers/redirect.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sourcefrog/projecteuler path: /007/primes.py
# What is the 10 001st prime number?
primes = [2]
<|fim_suffix|> b = a
for x in primes:
d, m = divmod(b, x)
if m == 0:
return False
else:
return True
a = 3
while len(primes) <= 10001:
# There's som... | code_fim | easy | {
"lang": "python",
"repo": "sourcefrog/projecteuler",
"path": "/007/primes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
a = 3
while len(primes) <= 10001:
# There's something faster than just checking all of them, but this
# will do for now.
if is_prime(a, primes):
primes.append(a)
print a
a += 1
print primes[10000]<|fim_prefix|># repo: sourcefrog/projecteuler path: /007/primes.py
# What ... | code_fim | medium | {
"lang": "python",
"repo": "sourcefrog/projecteuler",
"path": "/007/primes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
doc:
train the model with given data and optimizer, return log info
param:
input_seq: torch.LongTensor, [batch, max_seq_len]
target_seq: torch.LongTensor, [batch, max_seq_len]
optimizer: optimizer object
logger:... | code_fim | medium | {
"lang": "python",
"repo": "XgDuan/pensieve",
"path": "/deepbdp/models/rnn_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return loss.item(), seq_pred
def infer_batch(self, input_seq, logger):
"""
model inference.
The given data can be in the form of batch or single isinstance
"""
return self.forward(input_seq, None)<|fim_prefix|># repo: XgDuan/pensieve path: /deep... | code_fim | medium | {
"lang": "python",
"repo": "XgDuan/pensieve",
"path": "/deepbdp/models/rnn_model.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: XgDuan/pensieve path: /deepbdp/models/rnn_model.py
import math
import torch
import torch.nn as nn
import torch.nn.functional as F
class Model(nn.Module):
def __init__(self, hidden_size, encoder_layer=2, step=4, is_bidir=False, **kw):
super(Model, self).__init__()
... | code_fim | hard | {
"lang": "python",
"repo": "XgDuan/pensieve",
"path": "/deepbdp/models/rnn_model.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jazdev/JoomFind path: /JoomFind/JoomFind.py
#!/usr/bin/env python
import sys, re, urllib, urllib2, string, time, os
from urllib2 import Request, urlopen, URLError, HTTPError
from urlparse import urlparse
joomla_version="undefined" #used for joomla veersin info
provided_url="" #... | code_fim | hard | {
"lang": "python",
"repo": "jazdev/JoomFind",
"path": "/JoomFind/JoomFind.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|># Scans the en-GB.xml file
def scan_engb_ini():
"""
scan_engb_ini()
Scans the en-GB.ini file of website.
The en-GB.ini file, if readable, has clues that Joomla is being used.
"""
target_engb=provided_url+"/language/en-GB/en-GB.xml"
if verbose_flag: print "\t[.] Trying to... | code_fim | hard | {
"lang": "python",
"repo": "jazdev/JoomFind",
"path": "/JoomFind/JoomFind.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
scan_mootools()
Scans the mootools.js file of website.
The mootools.js file, if readable, has clues that Joomla is being used.
"""
target_mootools=provided_url+"/media/system/js/mootools-more.js"
if verbose_flag: print "\t[.] Trying to access MooTools file...", #+ targ... | code_fim | hard | {
"lang": "python",
"repo": "jazdev/JoomFind",
"path": "/JoomFind/JoomFind.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GonnaLIO/geekpython path: /lesson4/2.py
# Представлен список чисел.
# Необходимо вывести элементы исходного списка,
# значения которых больше предыдущего элемента.
from random import randint
<|fim_suffix|>new = [el for num, el in enumerate(list) if list[num - 1] < list[num]]
print(f"Исходный спи... | code_fim | medium | {
"lang": "python",
"repo": "GonnaLIO/geekpython",
"path": "/lesson4/2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>new = [el for num, el in enumerate(list) if list[num - 1] < list[num]]
print(f"Исходный список: {list}")
print(f"Новый список список: {new}")<|fim_prefix|># repo: GonnaLIO/geekpython path: /lesson4/2.py
# Представлен список чисел.
# Необходимо вывести элементы исходного списка,
# значения которых больше ... | code_fim | medium | {
"lang": "python",
"repo": "GonnaLIO/geekpython",
"path": "/lesson4/2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rahulkumar1m/exercism-python-track path: /word-count/word_count.py
import re
from collections import defaultdict
<|fim_suffix|> # Counting the frequency of each words
for word in sentence:
counts[word] += 1
return counts<|fim_middle|>def count_words(sentence):
# extra... | code_fim | medium | {
"lang": "python",
"repo": "rahulkumar1m/exercism-python-track",
"path": "/word-count/word_count.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Counting the frequency of each words
for word in sentence:
counts[word] += 1
return counts<|fim_prefix|># repo: rahulkumar1m/exercism-python-track path: /word-count/word_count.py
import re
from collections import defaultdict
def count_words(sentence):
<|fim_middle|> # extra... | code_fim | medium | {
"lang": "python",
"repo": "rahulkumar1m/exercism-python-track",
"path": "/word-count/word_count.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: acounsel/django_msat path: /assessments/views.py
from django.conf import settings
from django.contrib import messages
from django.shortcuts import redirect, render
from django.urls import reverse
from django.views.generic import DetailView, ListView, View
from assessments.models import (Mine, Co... | code_fim | hard | {
"lang": "python",
"repo": "acounsel/django_msat",
"path": "/assessments/views.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> company, created = Company.objects.get_or_create(
name=request.POST.get('company')
)
mine, created = Mine.objects.get_or_create(
name=request.POST.get('mine'),
company=company,
location=request.POST.get('location')
)
a... | code_fim | hard | {
"lang": "python",
"repo": "acounsel/django_msat",
"path": "/assessments/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> context = super().get_context_data(**kwargs)
context['maps_api_key'] = settings.GOOGLEMAPS_API_KEY
return context
class MineDetail(DetailView):
model = Mine
class AssessmentList(ListView):
model = Assessment
class AssessmentDetail(DetailView):
model = Assessment
cla... | code_fim | hard | {
"lang": "python",
"repo": "acounsel/django_msat",
"path": "/assessments/views.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pioneers/mentor-decal path: /debug-1/debug.py
left_motor = 1563872856371375
right_motor = 7567382956378165
servo = 9275392915737265
def autonomous_setup():
print("Autonomous mode has started!")
Robot.run(autonomous_actions)
<|fim_suffix|> if gamepad.get_value("r_trigger") > 0.5:
... | code_fim | hard | {
"lang": "python",
"repo": "pioneers/mentor-decal",
"path": "/debug-1/debug.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Tele-operated mode has started!")
def move_arm();
Robot.get_value(left_motor, serv0, 1)
time.sleep(2)
Robot.get_value(left_motor, serv0, 0)
def teleop_main():
if gamepad.get_value("r_trigger") > 0.5:
while True:
# move forward
Robot.get_value(le... | code_fim | medium | {
"lang": "python",
"repo": "pioneers/mentor-decal",
"path": "/debug-1/debug.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_curdatetime_str():
return get_curtime_str().strftime("%Y%m%d%H%M%S")
def get_curminuter_str():
return get_curtime_str().strftime("%Y%m%d%H%M")<|fim_prefix|># repo: KyleAdultHub/CaptchaFuck path: /utils/date.py
# -*- coding: utf-8 -*-
import time
import datetime
def get_second_long(ti... | code_fim | medium | {
"lang": "python",
"repo": "KyleAdultHub/CaptchaFuck",
"path": "/utils/date.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KyleAdultHub/CaptchaFuck path: /utils/date.py
# -*- coding: utf-8 -*-
import time
import datetime
def get_second_long(time_str=None):
if time_str is None:
return long(time.time())
time_array = time.strptime(time_str, "%Y-%m-%d %H:%M:%S")
return long(time.mktime(time_array))... | code_fim | medium | {
"lang": "python",
"repo": "KyleAdultHub/CaptchaFuck",
"path": "/utils/date.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def put(self, id):
access_token = Validations().get_access_token()
user = self.db.check_user_id(id)
if not access_token:
return jsonify({"Message": "Token needed. Please login"})
elif not user:
return jsonify({"Message": "User ID does not exist"}... | code_fim | hard | {
"lang": "python",
"repo": "gatemadavid/iReporter2",
"path": "/app/api/v2/views/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gatemadavid/iReporter2 path: /app/api/v2/views/users.py
from flask_restful import Resource
from flask import jsonify, make_response, request
from ..models.Users import UsersModel
from ..models.Incidents import IncidentsModel
from app.api.validations.validations import Validations
class Users... | code_fim | hard | {
"lang": "python",
"repo": "gatemadavid/iReporter2",
"path": "/app/api/v2/views/users.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UserView(Resource):
def __init__(self):
self.db = UsersModel()
def get(self, id):
access_token = Validations().get_access_token()
if not access_token:
return jsonify({"Message": "Token needed. Please login"})
else:
res = self.db.get_si... | code_fim | hard | {
"lang": "python",
"repo": "gatemadavid/iReporter2",
"path": "/app/api/v2/views/users.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> mtlDict = getShadingGroupMembership()
for meshList in mtlDict.keys():
vmtl = cmds.listConnections(meshList + '.surfaceShader', s= 1)[0]
if mtlDict[meshList]:
for mesh in mtlDict[meshList]:
msg = ''
target = ''
if '.' in s... | code_fim | hard | {
"lang": "python",
"repo": "davidlatwe/MS_Research",
"path": "/_research/remoteMayaSetShader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidlatwe/MS_Research path: /_research/remoteMayaSetShader.py
import pymel.core as PM
import socket
def getShadingGroupMembership():
'''
Get a dictionary of shading group set information
{'shadingGroup': [assignmnet1, assignment2...]}
'''
result = {}
#sgs = PM.ls(sl= 1, ... | code_fim | hard | {
"lang": "python",
"repo": "davidlatwe/MS_Research",
"path": "/_research/remoteMayaSetShader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for meshList in mtlDict.keys():
vmtl = cmds.listConnections(meshList + '.surfaceShader', s= 1)[0]
if mtlDict[meshList]:
for mesh in mtlDict[meshList]:
msg = ''
target = ''
if '.' in str(mesh):
faceList = []... | code_fim | hard | {
"lang": "python",
"repo": "davidlatwe/MS_Research",
"path": "/_research/remoteMayaSetShader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gusthiot/PySubsEl-V2 path: /traitement/bilan_comptes.py
from outils import Outils
class BilanComptes(object):
"""
Classe pour la création du bilan des comptes
"""
@staticmethod
def bilan(dossier_destination, subedition, subgeneraux, lignes):
"""
création du ... | code_fim | hard | {
"lang": "python",
"repo": "gusthiot/PySubsEl-V2",
"path": "/traitement/bilan_comptes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
génération des lignes de données du bilan
:param subedition: paramètres d'édition
:param subgeneraux: paramètres généraux
:param consolidation: classe de consolidation des données des bilans
:return: lignes de données du bilan
"""
lignes ... | code_fim | hard | {
"lang": "python",
"repo": "gusthiot/PySubsEl-V2",
"path": "/traitement/bilan_comptes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pankajmech/Codeforces-Problems path: /0870B-Maximum-of-Maximums-of-Minimums.py
n,k = map(int,raw_input().split())
nums = <|fim_suffix|>:
print min(nums)
elif k==2:
print max(nums[0],nums[-1])
else:
print max(nums)<|fim_middle|>list(map(int,raw_input().split()))
if k==1 | code_fim | easy | {
"lang": "python",
"repo": "pankajmech/Codeforces-Problems",
"path": "/0870B-Maximum-of-Maximums-of-Minimums.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(nums[0],nums[-1])
else:
print max(nums)<|fim_prefix|># repo: pankajmech/Codeforces-Problems path: /0870B-Maximum-of-Maximums-of-Minimums.py
n,k = map(int,raw_input().split())
nums = <|fim_middle|>list(map(int,raw_input().split()))
if k==1:
print min(nums)
elif k==2:
print max | code_fim | medium | {
"lang": "python",
"repo": "pankajmech/Codeforces-Problems",
"path": "/0870B-Maximum-of-Maximums-of-Minimums.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> OUTPUT:
ndata:
number of last point (starts with 0)
data:
output data in form [0:ndata,0:1]
index 0:
equidistant grid with step size dz starting at 0
index 1:
0: theta(z)
1: d theta(z) / dz
... | code_fim | hard | {
"lang": "python",
"repo": "adam-m-jcbs/xrb-sens-datashare",
"path": "/kepler_python_packages/python_scripts/laneemden/solver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def lane_emden_int(dz = 2.**(-14), n = 3., w = 0.):
"""
Interface to FORTRAN90 Lane-Emden Integrator.
Call:
ndata, data = laneemden.lane_emden_int(dz, n, w)
INPUT:
dz:
step in z, maye use 2**(-14)
n:
polytropic index (use 3.)
w:
... | code_fim | medium | {
"lang": "python",
"repo": "adam-m-jcbs/xrb-sens-datashare",
"path": "/kepler_python_packages/python_scripts/laneemden/solver.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
b1 = wx.Button(self, -1, "Create and Show a MiniFrame", (50, 50))
self.Bind(wx.EVT_BUTTON, self.OnButton1, b1)
b2 = wx.Button(self, -1, "Create and S... | code_fim | hard | {
"lang": "python",
"repo": "pythonthings/wxPython-Sample-Apps-and-Demos",
"path": "/100_Frames_and_Dialogs/MiniFrame/MiniFrame_extended.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def OnCloseWindow(self, event):
self.Destroy()
#---------------------------------------------------------------------------
class TestPanel(wx.Panel):
def __init__(self, parent, log):
self.log = log
wx.Panel.__init__(self, parent, -1)
b1 = wx.Button(self, -1, "Cr... | code_fim | hard | {
"lang": "python",
"repo": "pythonthings/wxPython-Sample-Apps-and-Demos",
"path": "/100_Frames_and_Dialogs/MiniFrame/MiniFrame_extended.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pythonthings/wxPython-Sample-Apps-and-Demos path: /100_Frames_and_Dialogs/MiniFrame/MiniFrame_extended.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__doc__ = """\
A MiniFrame is a Frame with a small title bar. It is suitable for floating
toolbars that must not take up too much screen area. I... | code_fim | hard | {
"lang": "python",
"repo": "pythonthings/wxPython-Sample-Apps-and-Demos",
"path": "/100_Frames_and_Dialogs/MiniFrame/MiniFrame_extended.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>is required to run this program", RuntimeWarning)
else:
print('Normal continuation')<|fim_prefix|># repo: maksym-bielyshev/book-a-byte-of-python-by-swaroop path: /stdlib/versioncheck.py
import sys, warnings
if sys.version_info[0] <|fim_middle|>< 3:
warnings.warn("At least Python 3.0 | code_fim | easy | {
"lang": "python",
"repo": "maksym-bielyshev/book-a-byte-of-python-by-swaroop",
"path": "/stdlib/versioncheck.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: maksym-bielyshev/book-a-byte-of-python-by-swaroop path: /stdlib/versioncheck.py
import sys, warnings
if sys.version_info[0] < 3:
warnings.warn("At least Python 3.0 <|fim_suffix|>ning)
else:
print('Normal continuation')<|fim_middle|>is required to run this program", RuntimeWar | code_fim | easy | {
"lang": "python",
"repo": "maksym-bielyshev/book-a-byte-of-python-by-swaroop",
"path": "/stdlib/versioncheck.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: noverby/conan-center-index path: /recipes/glib/all/conanfile.py
from conans import *
class GlibConan(ConanFile):
name = "glib"
description = "Common C routines used by Gtk+ and other libs"
license = "LGPL"
settings = {"os": ["Linux"], "arch": ["x86_64", "armv8"]}
build_requir... | code_fim | medium | {
"lang": "python",
"repo": "noverby/conan-center-index",
"path": "/recipes/glib/all/conanfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def build(self):
args = [
"--disable-static",
]
autotools = AutoToolsBuildEnvironment(self)
autotools.configure(args=args, configure_dir=f"{self.name}-{self.version}")
autotools.make()
autotools.install()<|fim_prefix|># repo: noverby/conan-ce... | code_fim | medium | {
"lang": "python",
"repo": "noverby/conan-center-index",
"path": "/recipes/glib/all/conanfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> args = [
"--disable-static",
]
autotools = AutoToolsBuildEnvironment(self)
autotools.configure(args=args, configure_dir=f"{self.name}-{self.version}")
autotools.make()
autotools.install()<|fim_prefix|># repo: noverby/conan-center-index path: /re... | code_fim | medium | {
"lang": "python",
"repo": "noverby/conan-center-index",
"path": "/recipes/glib/all/conanfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test01():
ReagentInfoItem11 = ReagentInfoItem('dai', 12)
ReagentInfoItem12 = ReagentInfoItem('han', 13)
ReagentInfoItem13 = ReagentInfoItem('peng', 14)
ReagentInfoList1 = [ReagentInfoItem11, ReagentInfoItem12, ReagentInfoItem13]
ReagentInfoItem21 = ReagentInfoItem('I', 32)
Re... | code_fim | hard | {
"lang": "python",
"repo": "DaiHanpeng/CentralDB",
"path": "/AptioLogParser/ReagentInfoDef.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_instrument_reagent_inventory_item_by_id(self,instr_id):
for item in self.system_reagent:
if isinstance(item,InstrumentReagentInfo):
if item.instrument_id == instr_id:
return item
def get_last_update_timestamp_per_instrument(self,inst... | code_fim | hard | {
"lang": "python",
"repo": "DaiHanpeng/CentralDB",
"path": "/AptioLogParser/ReagentInfoDef.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DaiHanpeng/CentralDB path: /AptioLogParser/ReagentInfoDef.py
HORIZONTAL_TABLE = b'\x09'
class ReagentInfoItem():
'''
This class if defined for a single reagent info unit, from the table's view, its a cell of the table.
'''
def __init__(self, reagent_name, reagent_count):
... | code_fim | hard | {
"lang": "python",
"repo": "DaiHanpeng/CentralDB",
"path": "/AptioLogParser/ReagentInfoDef.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ApotropaicTroper/One_Smart_Toaster path: /App-Wifi (Client).py
from kivy.app import App
from kivy.lang import Builder
from kivy.uix.screenmanager import ScreenManager, Screen
import subprocess
import socket
from kivy.uix.button import Button
from kivy.uix.button import Label
from kivy.uix.boxlayo... | code_fim | hard | {
"lang": "python",
"repo": "ApotropaicTroper/One_Smart_Toaster",
"path": "/App-Wifi (Client).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> sm.transition.direction = 'left'
sm.current = 'settings'
def forwardFunction2(self, next_screen):
sm.transition.direction = 'left'
sm.current = 'testing'
class TestScreen(Screen):
def __init__(self, **kwargs):
super(Screen, self).__init__(**kwargs)
... | code_fim | hard | {
"lang": "python",
"repo": "ApotropaicTroper/One_Smart_Toaster",
"path": "/App-Wifi (Client).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def printButtons(self):
y = 0
s2 = self.manager.get_screen('settings')
vLayout = BoxLayout(orientation='vertical')
self.add_widget(vLayout)
while y < len(ssids) - 1:
button = Button(text=ssids[y])
button.bind(on_press=self.connectWifi)
... | code_fim | hard | {
"lang": "python",
"repo": "ApotropaicTroper/One_Smart_Toaster",
"path": "/App-Wifi (Client).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: takenokoya/Python3_grammer path: /lesson38.py
animal = 'cat'
def f():
<|fim_suffix|>f()
print('global_scope:', animal)
print('global:', locals())<|fim_middle|> global animal
animal = 'dog'
print('local_scope:', animal)
print('local:', locals())
| code_fim | medium | {
"lang": "python",
"repo": "takenokoya/Python3_grammer",
"path": "/lesson38.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print('global_scope:', animal)
print('global:', locals())<|fim_prefix|># repo: takenokoya/Python3_grammer path: /lesson38.py
animal = 'cat'
def f():
<|fim_middle|> global animal
animal = 'dog'
print('local_scope:', animal)
print('local:', locals())
f()
| code_fim | medium | {
"lang": "python",
"repo": "takenokoya/Python3_grammer",
"path": "/lesson38.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
f()
print('global_scope:', animal)
print('global:', locals())<|fim_prefix|># repo: takenokoya/Python3_grammer path: /lesson38.py
animal = 'cat'
def f():
<|fim_middle|> global animal
animal = 'dog'
print('local_scope:', animal)
print('local:', locals())
| code_fim | medium | {
"lang": "python",
"repo": "takenokoya/Python3_grammer",
"path": "/lesson38.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def setup_logging(default_path='common/config/logging.yaml'):
path = default_path
if os.path.exists(path):
with open(path, 'rt') as f:
config = yaml.safe_load(f.read())
logging.config.dictConfig(config)
else:
logging.basicConfig(level=default_level)<|fim_prefix|># repo: hyunjun/... | code_fim | medium | {
"lang": "python",
"repo": "hyunjun/practice",
"path": "/python/test-flask/API/common/src/common.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: hyunjun/practice path: /python/test-flask/API/common/src/common.py
import logging.config
import os
import sys
import yaml
<|fim_suffix|>
def setup_logging(default_path='common/config/logging.yaml'):
path = default_path
if os.path.exists(path):
with open(path, 'rt') as f:
config = ... | code_fim | medium | {
"lang": "python",
"repo": "hyunjun/practice",
"path": "/python/test-flask/API/common/src/common.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> id = db.Column(db.Integer, primary_key=True)
status = db.Column(db.Integer, nullable=False, server_default=db.FetchedValue())
exam_id = db.Column(db.Integer, nullable=False)
exam_name = db.Column(db.String(200), nullable=False, server_default=db.FetchedValue())
show_exam_name = db.Colu... | code_fim | medium | {
"lang": "python",
"repo": "yiruizhixing/order",
"path": "/common/models/bm/BmExam.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yiruizhixing/order path: /common/models/bm/BmExam.py
# coding: utf-8
from sqlalchemy import Column, DateTime, Integer, String
from sqlalchemy.schema import FetchedValue
from application import db
class BmExam(db.Model):
<|fim_suffix|> id = db.Column(db.Integer, primary_key=True)
status =... | code_fim | medium | {
"lang": "python",
"repo": "yiruizhixing/order",
"path": "/common/models/bm/BmExam.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def test_unravel_buckets():
"""."""
from radixsort import unravel_buckets
buckets_dict = OrderedDict({
'none': Queue(),
'0': Queue(),
'1': Queue(),
'2': Queue(),
'3': Queue(),
'4': Queue(),
'5': Queue(),
'6': Queue(),
'7'... | code_fim | hard | {
"lang": "python",
"repo": "ztaylor2/data-structures",
"path": "/src/test_radixsort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> buckets_dict = OrderedDict({
'none': Queue(),
'0': Queue(),
'1': Queue(),
'2': Queue(),
'3': Queue(),
'4': Queue(),
'5': Queue(),
'6': Queue(),
'7': Queue(),
'8': Queue(),
'9': Queue(),
})
nums = ['0', '1'... | code_fim | hard | {
"lang": "python",
"repo": "ztaylor2/data-structures",
"path": "/src/test_radixsort.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ztaylor2/data-structures path: /src/test_radixsort.py
"""Test radix sort."""
import random
from collections import OrderedDict
from que_ import Queue
def test_stringify_nums():
"""."""
from radixsort import stringify_nums
nums = [1, 2, 3, 4, 5]
stringified_nums = stringify_nums... | code_fim | hard | {
"lang": "python",
"repo": "ztaylor2/data-structures",
"path": "/src/test_radixsort.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>print("Temp in ",celsius,"celsius=",fah," Fahrenheit")<|fim_prefix|># repo: gpallavi9790/PythonPrograms path: /Python Basic Programs/7.TemperatureConversion.py
#Program to convert temp in degree Celsius to temp in<|fim_middle|> degree Fahrenheit
celsius=input("Enter temperature in Celsius")
celsius=int(c... | code_fim | medium | {
"lang": "python",
"repo": "gpallavi9790/PythonPrograms",
"path": "/Python Basic Programs/7.TemperatureConversion.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gpallavi9790/PythonPrograms path: /Python Basic Programs/7.TemperatureConversion.py
#Program to convert temp in degree Celsius to temp in<|fim_suffix|>print("Temp in ",celsius,"celsius=",fah," Fahrenheit")<|fim_middle|> degree Fahrenheit
celsius=input("Enter temperature in Celsius")
celsius=int(c... | code_fim | medium | {
"lang": "python",
"repo": "gpallavi9790/PythonPrograms",
"path": "/Python Basic Programs/7.TemperatureConversion.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>r=(i+1), number=results[0])
if len(results) > 1:
print 'Case #{nr}: Bad magician!'.format(nr=(i+1))
if len(results) == 0:
print 'Case #{nr}: Volunteer cheated!'.format(nr=(i+1))<|fim_prefix|># repo: dr-dos-ok/Code_Jam_Webscraper path: /solutions_python/Problem_135/4080.py
import s... | code_fim | hard | {
"lang": "python",
"repo": "dr-dos-ok/Code_Jam_Webscraper",
"path": "/solutions_python/Problem_135/4080.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dr-dos-ok/Code_Jam_Webscraper path: /solutions_python/Problem_135/4080.py
import sys
lines = sys.stdin.readlines()
t = int(lines[0])
for i in range(t):
c = i*10+1
n = int(lines[c]) - 1
first = [x.strip() for x in [
lines[c+1],
lines[c+2],
<|fim_suffix|> lin... | code_fim | hard | {
"lang": "python",
"repo": "dr-dos-ok/Code_Jam_Webscraper",
"path": "/solutions_python/Problem_135/4080.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PyBites-Open-Source/pybites-faker path: /pybites_faker/constants.py
from collections import namedtuple
from os import getenv
from pathlib import Path
<|fim_suffix|>Bite = namedtuple("Bite", "number title level")
Article = namedtuple("Article", "author title tags")<|fim_middle|>TMP = getenv("TMP"... | code_fim | hard | {
"lang": "python",
"repo": "PyBites-Open-Source/pybites-faker",
"path": "/pybites_faker/constants.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>Bite = namedtuple("Bite", "number title level")
Article = namedtuple("Article", "author title tags")<|fim_prefix|># repo: PyBites-Open-Source/pybites-faker path: /pybites_faker/constants.py
from collections import namedtuple
from os import getenv
from pathlib import Path
<|fim_middle|>TMP = getenv("TMP"... | code_fim | hard | {
"lang": "python",
"repo": "PyBites-Open-Source/pybites-faker",
"path": "/pybites_faker/constants.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sonnycruz/End-to-End-Data-Analysis path: /1. Get the Data/d_JPC11C05_more_clean.py
import pandas as pd
import os
import re
main_dir = r'C:\Users\Username\Desktop\Python\End-to-End-Data-Analysis\1. Get the Data\table'
file = 'CMBS Table.csv'
<|fim_suffix|># Delete extra Loan & Seller colu... | code_fim | medium | {
"lang": "python",
"repo": "sonnycruz/End-to-End-Data-Analysis",
"path": "/1. Get the Data/d_JPC11C05_more_clean.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>for key, value in regex_dict.items():
cmbs.columns = [re.sub(key, value, col) for col in cmbs.columns]
# Delete
for col in list(cmbs.columns.values):
try:
if cmbs[col].str.normalize('NFKD').str.match(' ').all():
cmbs.drop(columns=col, axis=1, inplace=True)
except... | code_fim | medium | {
"lang": "python",
"repo": "sonnycruz/End-to-End-Data-Analysis",
"path": "/1. Get the Data/d_JPC11C05_more_clean.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tomdssdasd/six3 path: /s/s1.py
import os
os.mkdir("作业")
f=open("D:/six3/s/作业/tet.txt"<|fim_suffix|>作业/tet2.txt",'w+')
for i in s:
f.write(i)
f.close()<|fim_middle|>,'w+')
for i in range(10):
f.write("hello world\n")
f.seek(0)
s=f.read(100)
print(s)
f=open("D:/six3/s/ | code_fim | medium | {
"lang": "python",
"repo": "Tomdssdasd/six3",
"path": "/s/s1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>作业/tet2.txt",'w+')
for i in s:
f.write(i)
f.close()<|fim_prefix|># repo: Tomdssdasd/six3 path: /s/s1.py
import os
os.mkdir("作业")
f=open("D:/six3/s/作业/tet.txt",'w+')
for i in range(10):
f.write("hello world\n"<|fim_middle|>)
f.seek(0)
s=f.read(100)
print(s)
f=open("D:/six3/s/ | code_fim | easy | {
"lang": "python",
"repo": "Tomdssdasd/six3",
"path": "/s/s1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: njumagus/VROID path: /detectron2/modeling/backbone/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates.
from .build import build_backbone, BACKBONE_REGISTRY # noqa F401 isort:skip
<|fim_suffix|>__all__ = [k for k in globals().keys() if not k.startswith("_")]
# TODO can expose more... | code_fim | medium | {
"lang": "python",
"repo": "njumagus/VROID",
"path": "/detectron2/modeling/backbone/__init__.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>__all__ = [k for k in globals().keys() if not k.startswith("_")]
# TODO can expose more resnet blocks after careful consideration<|fim_prefix|># repo: njumagus/VROID path: /detectron2/modeling/backbone/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates.
from .build import build_backbone, BAC... | code_fim | medium | {
"lang": "python",
"repo": "njumagus/VROID",
"path": "/detectron2/modeling/backbone/__init__.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: suzhiyu/Test_Bench path: /interfaceTest/common/duquexcl.py
#!/usr/bin/env python
#-*-coding:utf-8-*-
#author:wuya
import os
import xlrd
import json
class Helper(object):
'''公共方法'''
def base_dir(self,filePath,folder='data'):
'''
返回公共路径
:parameter folder:文件夹
:... | code_fim | hard | {
"lang": "python",
"repo": "suzhiyu/Test_Bench",
"path": "/interfaceTest/common/duquexcl.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def readExcel(self,rowx,filePath='data.xlsx'):
'''
读取excel中数据并且返回
:parameter filePath:xlsx文件名称
:parameter rowx:在excel中的行数
'''
book=xlrd.open_workbook(self.base_dir(filePath))
sheet=book.sheet_by_index(0)
return sheet.row_values(rowx)
def getUrl(self,r... | code_fim | hard | {
"lang": "python",
"repo": "suzhiyu/Test_Bench",
"path": "/interfaceTest/common/duquexcl.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: adielad/Python path: /GitTest/Testtest.py
print(1)
print(2)
print("Jenkins")
print(<|fim_suffix|>33333")
print("44444444")
print("jhjhj")<|fim_middle|>"Jenkins2")
print("Jenkins3")
print("Jenkins44")
print("Jenkins55khlk")
print("33 | code_fim | medium | {
"lang": "python",
"repo": "adielad/Python",
"path": "/GitTest/Testtest.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ins44")
print("Jenkins55khlk")
print("3333333")
print("44444444")
print("jhjhj")<|fim_prefix|># repo: adielad/Python path: /GitTest/Testtest.py
print(1)
print(2)
print("Jenkins")
print(<|fim_middle|>"Jenkins2")
print("Jenkins3")
print("Jenk | code_fim | easy | {
"lang": "python",
"repo": "adielad/Python",
"path": "/GitTest/Testtest.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: huihuiZzz/Ios_Console_Auto path: /page/test_login_registration_page.py
import random
from elment.login_registration_element import LoginRegistration
from page.test_verification_code_page import VerificationCodeAction
public_number_vip = ['17800000000','17800000001','17800000002','17800000003','1... | code_fim | hard | {
"lang": "python",
"repo": "huihuiZzz/Ios_Console_Auto",
"path": "/page/test_login_registration_page.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.exit_area_code().click()
return self
def click_switch_area_code(self): # 点击区号页面阿富汗区号
self.switch_area_code().click()
return self
def check_switch_area_code(self): # 查看修改后的区号
return self.switch_area_code().text
def check_memory_logged_in_number(... | code_fim | hard | {
"lang": "python",
"repo": "huihuiZzz/Ios_Console_Auto",
"path": "/page/test_login_registration_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.keyboard_Delete().text
def logged_in_assert(self): # 判断是否进入了登录页
assert "欢迎登录迅游" in self.check_welcome_xunyou()
return self
def click_exit_logged_in(self): # 点击登录页左上角<点击,在加速首页触发的登录,返回加速页
self.exit_logged_in().click()
from page.test_accelerate_... | code_fim | hard | {
"lang": "python",
"repo": "huihuiZzz/Ios_Console_Auto",
"path": "/page/test_login_registration_page.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: calimacaco/pyfacil path: /generador/generador.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on 7/02/2014
@author: marco
Generador de ambientes FACIL 2014
'''
import wx
from formgenerador import FrameGeneral
from Dial_Pagina import ObjPagina
class IncioInterface(FrameGeneral)... | code_fim | hard | {
"lang": "python",
"repo": "calimacaco/pyfacil",
"path": "/generador/generador.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class ObjInicio():
def __init__(self,ActDebug=False):
# Lanzamos aplicación.
#ActDebug=True
#
#print "inicio"
#if ActDebug:
# pass
# aplicacion = ObjDebug(redirect=True)
#else:
# aplicacion=wx.PySimpleApp()
# frame_usuario = IncioInterface()
# frame_usuario.Maximize()
# frame_... | code_fim | hard | {
"lang": "python",
"repo": "calimacaco/pyfacil",
"path": "/generador/generador.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self,ActDebug=False):
# Lanzamos aplicación.
#ActDebug=True
#
#print "inicio"
#if ActDebug:
# pass
# aplicacion = ObjDebug(redirect=True)
#else:
# aplicacion=wx.PySimpleApp()
# frame_usuario = IncioInterface()
# frame_usuario.Maximize()
# frame_usuario.Show()
... | code_fim | hard | {
"lang": "python",
"repo": "calimacaco/pyfacil",
"path": "/generador/generador.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sergio05Rule/AI path: /Uniformed Search Strategy/DepthLimitedSearch/GraphClosed/Problem_State.py
class State:
def __init__(self, id):
self.id = id
<|fim_suffix|> NotVisited = 1
for tuple in problem.closed:
if node.state.id == tuple[0].id and node.depth >= tuple[1]:
... | code_fim | medium | {
"lang": "python",
"repo": "Sergio05Rule/AI",
"path": "/Uniformed Search Strategy/DepthLimitedSearch/GraphClosed/Problem_State.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> NotVisited = 1
for tuple in problem.closed:
if node.state.id == tuple[0].id and node.depth >= tuple[1]:
NotVisited = 0 #presente nei visited ma selected_node ha maggiore/uguale depth
return NotVisited<|fim_prefix|># repo: Sergio05Rule/AI path: /Uniformed Search Strategy/De... | code_fim | medium | {
"lang": "python",
"repo": "Sergio05Rule/AI",
"path": "/Uniformed Search Strategy/DepthLimitedSearch/GraphClosed/Problem_State.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>'No!Number is not present at the end of string'
print(end_num(s))<|fim_prefix|># repo: kittu1999/30-days-python-program path: /task10/ques3.py
import re
s=input('enter the string:')
def end_num(s):
text = re.compile(r".*[0-9]$")
if text.match(s):
return 'Yes<|fim_middle|>!Number i... | code_fim | medium | {
"lang": "python",
"repo": "kittu1999/30-days-python-program",
"path": "/task10/ques3.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kittu1999/30-days-python-program path: /task10/ques3.py
import re
s=input('enter the string:')
def end_num(s):
text =<|fim_suffix|>'No!Number is not present at the end of string'
print(end_num(s))<|fim_middle|> re.compile(r".*[0-9]$")
if text.match(s):
return 'Yes!Number i... | code_fim | medium | {
"lang": "python",
"repo": "kittu1999/30-days-python-program",
"path": "/task10/ques3.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print(n, "korovy")
else:
print(n, "korov")<|fim_prefix|># repo: GitKurmax/coursera-python path: /week02/task09.py
n = int(input())
if n % 10 == 1 and (n < 11 o<|fim_middle|>r n > 20):
print(n, "korova")
elif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20):
| code_fim | medium | {
"lang": "python",
"repo": "GitKurmax/coursera-python",
"path": "/week02/task09.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GitKurmax/coursera-python path: /week02/task09.py
n = int(input())
if n % 10 == 1 and (n < 11 o<|fim_suffix|> print(n, "korovy")
else:
print(n, "korov")<|fim_middle|>r n > 20):
print(n, "korova")
elif n % 10 > 1 and n % 10 < 5 and (n < 11 or n > 20):
| code_fim | medium | {
"lang": "python",
"repo": "GitKurmax/coursera-python",
"path": "/week02/task09.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Salma-Hashem/PythonPrograms path: /TimeWarnerBot.py
# "Time Warner Python" Salma Hashem netid: sh5640
#Design costumer service application by asking users series of questions, and based on the customers' answers to the questions, provide them with instructions.
#Ask the user to choose from the f... | code_fim | hard | {
"lang": "python",
"repo": "Salma-Hashem/PythonPrograms",
"path": "/TimeWarnerBot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> else:
print("Plug your modem into the nearest outlet to turn on your modem. If you still cannot connect to the Internet, restart this program. Note, this program will now terminate. Goodbye!")
#assign variables to user inputs using if statements for scenario two and print output based on user ... | code_fim | hard | {
"lang": "python",
"repo": "Salma-Hashem/PythonPrograms",
"path": "/TimeWarnerBot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rich-03/LeetPractice path: /Problem1436/Problem1436.py
from typing import List
class Solution:
<|fim_suffix|> departCity = set()
destCity = []
for i in paths:
if i[1] not in departCity:
destCity.append(i[1])
if i[0] in destCity:
... | code_fim | easy | {
"lang": "python",
"repo": "rich-03/LeetPractice",
"path": "/Problem1436/Problem1436.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> departCity = set()
destCity = []
for i in paths:
if i[1] not in departCity:
destCity.append(i[1])
if i[0] in destCity:
destCity.remove(i[0])
departCity.add(i[0])
return destCity[0]<|fim_prefix|># repo: ric... | code_fim | easy | {
"lang": "python",
"repo": "rich-03/LeetPractice",
"path": "/Problem1436/Problem1436.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = 'taobao'
allowed_domains = ['www.taobao.com']
start_urls = ['http://www.taobao.com/']
def parse(self, response, **kwargs):
pass<|fim_prefix|># repo: WangKun-program/python path: /pythonProject/Product/Product/spiders/taobao.py
from scrapy import Spider, Request
from urllib... | code_fim | easy | {
"lang": "python",
"repo": "WangKun-program/python",
"path": "/pythonProject/Product/Product/spiders/taobao.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: WangKun-program/python path: /pythonProject/Product/Product/spiders/taobao.py
from scrapy import Spider, Request
from urllib.parse import quote
from Product.items import ProductItem
class TaobaoSpider(Spider):
<|fim_suffix|> def parse(self, response, **kwargs):
pass<|fim_middle|> ... | code_fim | medium | {
"lang": "python",
"repo": "WangKun-program/python",
"path": "/pythonProject/Product/Product/spiders/taobao.py",
"mode": "psm",
"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.