text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> nivel_count = {'bronze' : 0, 'prata' : 0, 'ouro' : 0}
for semana in range(1,8):
for nivel in ['bronze', 'prata', 'ouro']:
nivel_completo = True
tarefas_nivel = Tarefa.query.filter_by(semana=semana, nivel=nivel).all()
for tarefa in... | code_fim | hard | {
"lang": "python",
"repo": "leite0407/template-leaderboard",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leite0407/template-leaderboard path: /utils.py
from datetime import datetime
def rplt_time_to_datetime(time):
''' Transforma string do timestamp do repl.it em datetime '''
# 2020-04-11T18:39:41.336Z
return datetime(
# ano
int(time.split('-')[0]),
# mês
... | code_fim | hard | {
"lang": "python",
"repo": "leite0407/template-leaderboard",
"path": "/utils.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Calcula quantas medalhas aluno ganhou
with app.app_context():
nivel_count = {'bronze' : 0, 'prata' : 0, 'ouro' : 0}
for semana in range(1,8):
for nivel in ['bronze', 'prata', 'ouro']:
nivel_completo = True
tarefas_nivel = Tarefa.query.f... | code_fim | hard | {
"lang": "python",
"repo": "leite0407/template-leaderboard",
"path": "/utils.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sunithaswain/aciinfotechdata path: /b2b-claim-portal-api-development/app/utility/vault_manager.py
import requests
def singleton(cls):
<|fim_suffix|> self.session = requests.Session()<|fim_middle|> instance = {}
def singleton_inner(*args, **kwargs):
if cls not in instance:... | code_fim | hard | {
"lang": "python",
"repo": "sunithaswain/aciinfotechdata",
"path": "/b2b-claim-portal-api-development/app/utility/vault_manager.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
@singleton
class VaultSession:
def __init__(self):
self.session = requests.Session()<|fim_prefix|># repo: sunithaswain/aciinfotechdata path: /b2b-claim-portal-api-development/app/utility/vault_manager.py
import requests
def singleton(cls):
<|fim_middle|> instance = {}
def singleton... | code_fim | medium | {
"lang": "python",
"repo": "sunithaswain/aciinfotechdata",
"path": "/b2b-claim-portal-api-development/app/utility/vault_manager.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def process_input(text):
word_sequence = ['.']
amb_sequence = []
current_ambiguities = [Tag('.', ['sent'])]
for line in text:
if line.startswith('"'):
amb_sequence.append(current_ambiguities)
current_ambiguities = []
word = line.strip()[2:-2]
... | code_fim | hard | {
"lang": "python",
"repo": "KindYAK/NLPMonitor",
"path": "/containers/apertium/kaz-tagger/process.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KindYAK/NLPMonitor path: /containers/apertium/kaz-tagger/process.py
# coding: utf-8
import sys
assert sys.version_info >= (3,4)
ROOT_DELIM = '_'
IGS_DELIM = '.'
class Tag(object):
def __init__(self, root, ig):
self.root = root
self.ig = ig
self.fine_ig = None
... | code_fim | hard | {
"lang": "python",
"repo": "KindYAK/NLPMonitor",
"path": "/containers/apertium/kaz-tagger/process.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Sandy4321/NN path: /fnn/NN.py
#!/usr/bin/python
from fann2 import libfann
connection_rate = 1
learning_rate = 0.07
num_input = 64
num_hidden_1 = 20
num_output = 10
<|fim_suffix|>ann = libfann.neural_net()
ann.create_sparse_array(connection_rate, (num_input, num_hidden_1, num_output))
#ann.rand... | code_fim | medium | {
"lang": "python",
"repo": "Sandy4321/NN",
"path": "/fnn/NN.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ann = libfann.neural_net()
ann.create_sparse_array(connection_rate, (num_input, num_hidden_1, num_output))
#ann.randomize_weights(ann, -1, 1)
ann.set_learning_rate(learning_rate)
ann.set_activation_function_output(libfann.SIGMOID_SYMMETRIC_STEPWISE)
ann.train_on_file("../../preproc/data/original.data", m... | code_fim | medium | {
"lang": "python",
"repo": "Sandy4321/NN",
"path": "/fnn/NN.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>nse == 'no':
break
print('thank you bhai!!!!!!')<|fim_prefix|># repo: siumhossain/python_automation path: /how_to_keep_an_idiot_busy.py
import pyinputplus as pyin
while True:
prompt = 'want to know how to keep an idiot busy for hour<|fim_middle|>s?'
response = pyin.inputYesNo(prompt)
if respo | code_fim | easy | {
"lang": "python",
"repo": "siumhossain/python_automation",
"path": "/how_to_keep_an_idiot_busy.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: siumhossain/python_automation path: /how_to_keep_an_idiot_busy.py
import pyinputplus as pyin
while True:
prompt = 'want to know how to keep an idiot busy for hour<|fim_suffix|>nse == 'no':
break
print('thank you bhai!!!!!!')<|fim_middle|>s?'
response = pyin.inputYesNo(prompt)
if respo | code_fim | easy | {
"lang": "python",
"repo": "siumhossain/python_automation",
"path": "/how_to_keep_an_idiot_busy.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>frm=Frame(root, height=500,width=500)
frm.bind("<Button-1>",lclick)
frm.bind("<Button-2>",rclick)
root.mainloop()<|fim_prefix|># repo: MarshallPramukh/TableauWorkshop path: /GUI/FifthProj.py
from tkinter import *
root=Tk()
def lclick(event):
print("Left")
def rclick(event):
<|fim_middle|> print(... | code_fim | easy | {
"lang": "python",
"repo": "MarshallPramukh/TableauWorkshop",
"path": "/GUI/FifthProj.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("Left")
def rclick(event):
print("Right")
frm=Frame(root, height=500,width=500)
frm.bind("<Button-1>",lclick)
frm.bind("<Button-2>",rclick)
root.mainloop()<|fim_prefix|># repo: MarshallPramukh/TableauWorkshop path: /GUI/FifthProj.py
from tkinter import *
root=Tk()
<|fim_middle|>def lclic... | code_fim | easy | {
"lang": "python",
"repo": "MarshallPramukh/TableauWorkshop",
"path": "/GUI/FifthProj.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MarshallPramukh/TableauWorkshop path: /GUI/FifthProj.py
from tkinter import *
root=Tk()
<|fim_suffix|> print("Right")
frm=Frame(root, height=500,width=500)
frm.bind("<Button-1>",lclick)
frm.bind("<Button-2>",rclick)
root.mainloop()<|fim_middle|>def lclick(event):
print("Left")
def rclic... | code_fim | easy | {
"lang": "python",
"repo": "MarshallPramukh/TableauWorkshop",
"path": "/GUI/FifthProj.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>squares = map(lambda x: x**2, ints)
print squares<|fim_prefix|># repo: kenziebottoms/bangazon-python path: /orientation/exercises/08-random_squared.py
import random
# 20 numbers between 0 and 49 inclusive
ints = [random.randrange(50) for i in range(20)]
<|fim_middle|>print ints
| code_fim | easy | {
"lang": "python",
"repo": "kenziebottoms/bangazon-python",
"path": "/orientation/exercises/08-random_squared.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: kenziebottoms/bangazon-python path: /orientation/exercises/08-random_squared.py
import random
# 20 numbers between 0 and 49 inclusive
ints = [random.randrange(50) for i in range(20)]
<|fim_suffix|>squares = map(lambda x: x**2, ints)
print squares<|fim_middle|>print ints
| code_fim | easy | {
"lang": "python",
"repo": "kenziebottoms/bangazon-python",
"path": "/orientation/exercises/08-random_squared.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: speque/shallowspace path: /shallowspace/tests/test_map.py
'''
Created on Nov 14, 2010
@author: pekka
'''
import unittest
from shallowspace.eventmanager import EventManager
from shallowspace.event import CharactorPlaceEvent, FreeSectorAction
from shallowspace.map import Sector, MapState
from shal... | code_fim | hard | {
"lang": "python",
"repo": "speque/shallowspace",
"path": "/shallowspace/tests/test_map.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.actionExecuted = False
charactor = Charactor(self.event_manager)
charactor.sector = sector
map_state.occupied_sectors_by_actor_id[charactor.charactor_id] = charactor.sector
self.event_manager.post(free_sector_action)
self.assertFalse(self.actionExecuted... | code_fim | hard | {
"lang": "python",
"repo": "speque/shallowspace",
"path": "/shallowspace/tests/test_map.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: PySean/mutools path: /multimutect/multimutect.py
#!/usr/bin/env python
"""
'multimutect.py', by Sean Soderman
Parallelizer for MuTect.
"""
from itertools import izip
from synchrom import Synchrom
from time import time
import argparse
import multiprocessing
import os
import re
import subpr... | code_fim | hard | {
"lang": "python",
"repo": "PySean/mutools",
"path": "/multimutect/multimutect.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> synchrom = Synchrom(args)
infinity = infinigen()
start_time = 0
end_time = 0
with ThreadPoolExecutor(max_workers=numthreads) as threader:
results = threader.map(procfun, izip(infinity, synchrom.commands))
start_time = time()
for i in results:
print i... | code_fim | hard | {
"lang": "python",
"repo": "PySean/mutools",
"path": "/multimutect/multimutect.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arifgursel/Python-MVC-BoilerPlate path: /app/config/routes.py
"""
Routes Configuration File
"""
from system.core.router import routes
#=============
#Default Route
#=============
routes['default_controller'] = 'Pages'
#=============
#Access Routes
#=============
routes['GET']['/login'] = 'P... | code_fim | hard | {
"lang": "python",
"repo": "arifgursel/Python-MVC-BoilerPlate",
"path": "/app/config/routes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#=============
#Artist Routes
#=============
#------------------------------------
#Serve Form Views
#------------------------------------
routes['GET']['/artists/new'] = 'Artists#newArtist'
routes['GET']['/artists/profile/detailed/<int:artist_id>'] = 'Artists#newDetailProfile'
routes['GET']['/artists/pr... | code_fim | hard | {
"lang": "python",
"repo": "arifgursel/Python-MVC-BoilerPlate",
"path": "/app/config/routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for producto in sorted(productos, key=lambda k: k["orden"]):
if not tickets:
break
file.write('''
<div class="checkbox__row">
<svg class="login__icon pass svg-icon svg-phone" ''')
## viewBox="0 0 60 60">
## ... | code_fim | hard | {
"lang": "python",
"repo": "NachoCasta/FrutopiaWeb",
"path": "/utilidades.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NachoCasta/FrutopiaWeb path: /utilidades.py
import json
from grafica.difusion_multiple import crear_difusion_multiple
def mayus(string):
return " ".join([s[0].upper() + s[1:] for s in string.split()])
def obtener_productos(archivo="grafica/productos.json"):
with open(archivo, "... | code_fim | hard | {
"lang": "python",
"repo": "NachoCasta/FrutopiaWeb",
"path": "/utilidades.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@api.route('/posts/', methods=['POST'])
def new_post():
post = Post.from_json(request.json)
db.session.add(post)
db.session.commit()
return jsonify(post.to_json()), 201, {'Location': url_for('api.get_post', id=post.id, _external=True) }
@api.route('/posts/<int:id>', methods=['PUT'])
def e... | code_fim | hard | {
"lang": "python",
"repo": "dayinfinite/devblog",
"path": "/app/api_1_0/posts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> post = Post.query.get_or_404(id)
return jsonify(post.to_json())
@api.route('/posts/', methods=['POST'])
def new_post():
post = Post.from_json(request.json)
db.session.add(post)
db.session.commit()
return jsonify(post.to_json()), 201, {'Location': url_for('api.get_post', id=post.id... | code_fim | medium | {
"lang": "python",
"repo": "dayinfinite/devblog",
"path": "/app/api_1_0/posts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dayinfinite/devblog path: /app/api_1_0/posts.py
# -*- coding:utf-8 -*-
# __author__ = 'dayinfinte'
from flask import request, jsonify, url_for
from ..models import Post
from .. import db
from . import api
<|fim_suffix|>@api.route('/posts/<int:id>', methods=['PUT'])
def edit_post(id):
post =... | code_fim | hard | {
"lang": "python",
"repo": "dayinfinite/devblog",
"path": "/app/api_1_0/posts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mhaqir/CIAIP path: /Car_racing/explore_z.py
#!/bin/python3
import numpy as np
import random
import os
import matplotlib.pyplot as plt
from scipy.stats import norm
from copy import deepcopy
import tensorflow as tf
np.set_printoptions(precision=4, edgeitems=6, linewidth=100, suppress=True)
from ... | code_fim | hard | {
"lang": "python",
"repo": "mhaqir/CIAIP",
"path": "/Car_racing/explore_z.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# model_params, model_shapes, model_names = vae.get_model_params()
# for param in zip(model_snames, model_shapes):
# print(param[0], ': ', param[1])
# print('\n')
h, h1, h2, h3, h4, h5, h6, h7, h8, h9, y = vae.hidden(frame[:, 0:52, :])
print("h: ", np.shape(h))
print("h1: ", np.shape(h1))
print("h2: "... | code_fim | hard | {
"lang": "python",
"repo": "mhaqir/CIAIP",
"path": "/Car_racing/explore_z.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for num in word_indices:
x[num - 1] = 1 # adj for python indexing starting at 0
return x<|fim_prefix|># repo: mrech/MachineLearning_AndrewNg path: /6.SupportVectorMachines/machine-learning-ex6/ex6/emailFeatures.py
# EMAILFEATURES takes in a word_indices vector and produces a feature vect... | code_fim | medium | {
"lang": "python",
"repo": "mrech/MachineLearning_AndrewNg",
"path": "/6.SupportVectorMachines/machine-learning-ex6/ex6/emailFeatures.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mrech/MachineLearning_AndrewNg path: /6.SupportVectorMachines/machine-learning-ex6/ex6/emailFeatures.py
# EMAILFEATURES takes in a word_indices vector and produces a feature vector
# from the word indices
def emailFeatures(word_indices):
'''
x = EMAILFEATURES(word_indices) takes in a wor... | code_fim | medium | {
"lang": "python",
"repo": "mrech/MachineLearning_AndrewNg",
"path": "/6.SupportVectorMachines/machine-learning-ex6/ex6/emailFeatures.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: keshavmohta09/userflow09 path: /authentication/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('',views.home,name='home'),
path('sig<|fim_suffix|>t,name='logout'),
path('user-details/',views.details,name='user-details'),
path('delete-user/',views.del... | code_fim | medium | {
"lang": "python",
"repo": "keshavmohta09/userflow09",
"path": "/authentication/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ser,name='delete-user'),
path('update-details/',views.update_details,name='update-details'),
]
# urlpatterns = []<|fim_prefix|># repo: keshavmohta09/userflow09 path: /authentication/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('',views.home,name='home'),
path... | code_fim | medium | {
"lang": "python",
"repo": "keshavmohta09/userflow09",
"path": "/authentication/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def monticulizar(lista):
'''Convierte lista en montículo(la ordena como su fuese uno)'''
for i in range(len(lista)):
flotar(lista, i)
def heap_vacio(heap):
return heap.tamanio == 0
def buscar_H(heap, dato):
if dato in heap:
return heap.index(dato)
else:
retu... | code_fim | hard | {
"lang": "python",
"repo": "LuchoLesca/Alg-EstrDat",
"path": "/Tp's 7 - Arbol/TDA_Heap.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: LuchoLesca/Alg-EstrDat path: /Tp's 7 - Arbol/TDA_Heap.py
import random
class Heap():
def __init__(self, tamanio):
self.tamanio = 0
self.vector = [None]*tamanio
def agregar(heap, dato):
'''Agrega elemento y flota hasta ordenar heap'''
heap.vector[heap.tamanio] = dat... | code_fim | hard | {
"lang": "python",
"repo": "LuchoLesca/Alg-EstrDat",
"path": "/Tp's 7 - Arbol/TDA_Heap.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dthung1602/MyWebApp path: /MyHandlers/Welcome.py
import SignIn
import Signup
from Handler import Handler
<|fim_suffix|> page_title = "Welcome"
def get(self):
login_cookie = self.request.cookies.get("user", None)
if not login_cookie or not valid_login_cookie(login_cookie... | code_fim | medium | {
"lang": "python",
"repo": "dthung1602/MyWebApp",
"path": "/MyHandlers/Welcome.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> login_cookie = self.request.cookies.get("user", None)
if not login_cookie or not valid_login_cookie(login_cookie):
self.redirect("/signup")
else:
username = login_cookie.split('|')[0]
self.render("welcome.html", user=username)<|fim_prefix|># rep... | code_fim | medium | {
"lang": "python",
"repo": "dthung1602/MyWebApp",
"path": "/MyHandlers/Welcome.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Разбить текст на предложения.
sentences = text1.split(".")
# Вывод предложений с запятыми.
for sentence in sentences:
if "," in sentence:
print("{}.".format(sentence))<|fim_prefix|># repo: serbyshek/lb-7 path: /ex1.py
#!/usr/bin/env python3
# -*- coding: utf-... | code_fim | medium | {
"lang": "python",
"repo": "serbyshek/lb-7",
"path": "/ex1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Вывод предложений с запятыми.
for sentence in sentences:
if "," in sentence:
print("{}.".format(sentence))<|fim_prefix|># repo: serbyshek/lb-7 path: /ex1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
with open('text1.txt', 'r', enco... | code_fim | medium | {
"lang": "python",
"repo": "serbyshek/lb-7",
"path": "/ex1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: serbyshek/lb-7 path: /ex1.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
if __name__ == '__main__':
with open('text1.txt', 'r', encoding="utf8") as f:
text1 = f.read()
<|fim_suffix|> # Вывод предложений с запятыми.
for sentence in sentences:
if "," in sent... | code_fim | hard | {
"lang": "python",
"repo": "serbyshek/lb-7",
"path": "/ex1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Register your models here.
admin.site.register(Movie)
admin.site.register(Theatre)
admin.site.register(Showing)<|fim_prefix|># repo: tylerjames/CanopyCodeChallenge path: /movietheatre/boxoffice/admin.py
from django.contrib import admin
<|fim_middle|>from .models import Movie, Showing, Theatre
| code_fim | easy | {
"lang": "python",
"repo": "tylerjames/CanopyCodeChallenge",
"path": "/movietheatre/boxoffice/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tylerjames/CanopyCodeChallenge path: /movietheatre/boxoffice/admin.py
from django.contrib import admin
<|fim_suffix|># Register your models here.
admin.site.register(Movie)
admin.site.register(Theatre)
admin.site.register(Showing)<|fim_middle|>from .models import Movie, Showing, Theatre
| code_fim | easy | {
"lang": "python",
"repo": "tylerjames/CanopyCodeChallenge",
"path": "/movietheatre/boxoffice/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if random() > .8:
speed = 5*random()
if speed < 3:
speed = 3
elif speed > 7:
speed = 7
angle = random() - random()
if angle > 0.5:
angle = 0.5
elif angle < -0.5:
... | code_fim | hard | {
"lang": "python",
"repo": "jaysso/Simulator",
"path": "/floater.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def display(self, canvas):
x, y = self.get_location()
canvas.create_oval(x - Floater.radius, y - Floater.radius,
x + Floater.radius, y + Floater.radius,
fill="red")<|fim_prefix|># repo: jaysso/Simulator path: /floater.py
# A Fl... | code_fim | hard | {
"lang": "python",
"repo": "jaysso/Simulator",
"path": "/floater.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jaysso/Simulator path: /floater.py
# A Floater is Prey; it updates by moving mostly in
# a straight line, but with random changes to its
# angle and speed, and displays as ufo.gif (whose
# dimensions (width and height) are computed by
# calling .width()/.height() on the PhotoImage
... | code_fim | hard | {
"lang": "python",
"repo": "jaysso/Simulator",
"path": "/floater.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aynulislam/Django-Rest-Framework path: /myapp_2/migrations/0001_initial.py
# Generated by Django 2.2.5 on 2019-10-05 03:55
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]... | code_fim | hard | {
"lang": "python",
"repo": "aynulislam/Django-Rest-Framework",
"path": "/myapp_2/migrations/0001_initial.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>,
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('seen_date', models.DateTimeField()),
('conversation_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='myapp_... | code_fim | hard | {
"lang": "python",
"repo": "aynulislam/Django-Rest-Framework",
"path": "/myapp_2/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> ('phone', models.CharField(max_length=100, null=True)),
('password', models.CharField(max_length=255, null=True)),
('voice', models.BooleanField(null=True)),
('face', models.BooleanField(null=True)),
('salt', models.IntegerFie... | code_fim | hard | {
"lang": "python",
"repo": "aynulislam/Django-Rest-Framework",
"path": "/myapp_2/migrations/0001_initial.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # equalize the histogram of the Y channel
pixel = cv2.imread('test_16_test.jpg')
img_yuv = cv2.cvtColor(pixel, cv2.COLOR_BGR2YUV)
img_yuv[:,:,0] = cv2.equalizeHist(img_yuv[:,:,0])
# convert the YUV image back to RGB format
img_equalized = cv2.cvtColor(img_yuv, cv2.COLOR_YUV2BGR)
cv2.imwri... | code_fim | medium | {
"lang": "python",
"repo": "khayatjr/prosthetic-vision",
"path": "/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: khayatjr/prosthetic-vision path: /main.py
from pros import pros_vision_function
from time import sleep
import cv2
import numpy as np
from PIL import Image
i = 0
face_cascade = cv2.CascadeClassifier('haarcascade_frontalface_default.xml')
input_img = cv2.imread('C:/Users/hp/downloads/trekar.jpg')... | code_fim | medium | {
"lang": "python",
"repo": "khayatjr/prosthetic-vision",
"path": "/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> = 'pickles/'
SolrFilesPath = 'solr.files/'<|fim_prefix|># repo: etcluvic/sme.ParseMe path: /code/settingsFile.py
fullTextPath = '/mnt/datasets/erudit/'
extract<|fim_middle|>edTextPath = 'fullText/'
rankingsPath = 'rankings'
termsPath = 'terms/'
picklePath | code_fim | medium | {
"lang": "python",
"repo": "etcluvic/sme.ParseMe",
"path": "/code/settingsFile.py",
"mode": "spm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: etcluvic/sme.ParseMe path: /code/settingsFile.py
fullTextPath = '/mnt/datasets/erudit/'
extract<|fim_suffix|>kings'
termsPath = 'terms/'
picklePath = 'pickles/'
SolrFilesPath = 'solr.files/'<|fim_middle|>edTextPath = 'fullText/'
rankingsPath = 'ran | code_fim | easy | {
"lang": "python",
"repo": "etcluvic/sme.ParseMe",
"path": "/code/settingsFile.py",
"mode": "psm",
"license": "CC-BY-4.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chanhw3/Binance-api-step-by-step-guide path: /stop_loss_order.py
import os
from binance.client import Client
from binance.enums import *
from binance.exceptions import BinanceAPIException, BinanceOrderException
# init
api_key = os.environ.get('binance_api')
api_secret = os.environ.get('binance_... | code_fim | hard | {
"lang": "python",
"repo": "chanhw3/Binance-api-step-by-step-guide",
"path": "/stop_loss_order.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>try:
order = client.create_oco_order(
symbol='ETHUSDT',
side='SELL',
quantity=100,
price=250,
stopPrice=150,
stopLimitPrice=150,
stopLimitTimeInForce='GTC')
except BinanceAPIException as e:
# error handling goes here
print(e)
except BinanceOrderException as e:
# error handling goes here... | code_fim | medium | {
"lang": "python",
"repo": "chanhw3/Binance-api-step-by-step-guide",
"path": "/stop_loss_order.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># use exchange info to confirm order types
info = client.get_symbol_info('ETHUSDT')
print(info['orderTypes'])<|fim_prefix|># repo: chanhw3/Binance-api-step-by-step-guide path: /stop_loss_order.py
import os
from binance.client import Client
from binance.enums import *
from binance.exceptions import Binan... | code_fim | hard | {
"lang": "python",
"repo": "chanhw3/Binance-api-step-by-step-guide",
"path": "/stop_loss_order.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VB6Hobbyst7/roomba-localization path: /L_PyInterface/Filters/TestFilters.py
filters with. It is a bit dirty and undocumented, so be forewarned.
'''
from Data import models
import os
from numpy.random import randn
from Movement import MoveExplorer, Movement
from FilterManager import Filte... | code_fim | hard | {
"lang": "python",
"repo": "VB6Hobbyst7/roomba-localization",
"path": "/L_PyInterface/Filters/TestFilters.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: VB6Hobbyst7/roomba-localization path: /L_PyInterface/Filters/TestFilters.py
es: pygtk, gobject, cairo
Some hacky code to simulate filters with. It is a bit dirty and undocumented, so be forewarned.
'''
from Data import models
import os
from numpy.random import randn
from Movement impor... | code_fim | hard | {
"lang": "python",
"repo": "VB6Hobbyst7/roomba-localization",
"path": "/L_PyInterface/Filters/TestFilters.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Kluge fix -- need to fix the .mat file
measurement_model = measurement_model[0]
total_beacons = beacons.shape[0]
# Move Straight: Vector based on Motion Model measurements
#translation_vec = [dist_hypot, dist_hypot, translation_model[2,0]]... | code_fim | hard | {
"lang": "python",
"repo": "VB6Hobbyst7/roomba-localization",
"path": "/L_PyInterface/Filters/TestFilters.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tonghuaWN/gst-web path: /router/pipeline.py
from api.view.pipeline import *
def setup(app):
pre = '/api/pipelines'
app.router.add_get(pre, get_pipes)
app.router.add_put(pre, create_pipe)
app.router.add_get(pre + '/{id}', getPipelineInfo)
app.router.add_delete(pre + '/{id}... | code_fim | hard | {
"lang": "python",
"repo": "tonghuaWN/gst-web",
"path": "/router/pipeline.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> app.router.add_put(pre + '/{pipeId}/elements', addElement)
app.router.add_get(pre + '/{pipeId}/elements/{elementId}', getElementInfo)
app.router.add_post(pre + '/{pipeId}/elements/{elementId}', setElementInfo)
app.router.add_delete(pre + '/{pipeId}/elements/{elementId}', deleteElement)
... | code_fim | hard | {
"lang": "python",
"repo": "tonghuaWN/gst-web",
"path": "/router/pipeline.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> pattern_match = re.compile(r"(\+234|0)(0?)(8[01]|[79]0)(\d{8}$)")
matches = pattern_match.match(args1)
if matches != None:
if matches.group(2) == "0":
return "True, {0} is a Nigerian number but you don't have to add the '0' that follows the country code, conventionally the n... | code_fim | hard | {
"lang": "python",
"repo": "petlight45/Python-Scripts",
"path": "/nigerian_phone_number_checker.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: petlight45/Python-Scripts path: /nigerian_phone_number_checker.py
import re
def is_Nigerian(args1):
"""
This function checks if a given number is a Nigerian phone number.
Parameters:
args1 (str): the phone number to be checked.
Return
str: a remark t... | code_fim | hard | {
"lang": "python",
"repo": "petlight45/Python-Scripts",
"path": "/nigerian_phone_number_checker.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: openstack/tempest path: /tempest/lib/api_schema/response/volume/services.py
# Copyright 2018 ZTE Corporation. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a co... | code_fim | hard | {
"lang": "python",
"repo": "openstack/tempest",
"path": "/tempest/lib/api_schema/response/volume/services.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>disable_service = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'disabled': {'type': 'boolean'},
'status': {'enum': ['enabled', 'disabled']},
'host': {'type': 'string'},
'service': {'type': 'string'},
... | code_fim | hard | {
"lang": "python",
"repo": "openstack/tempest",
"path": "/tempest/lib/api_schema/response/volume/services.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|>people1 = [("c", 30), ("b", 200), ("a", 1000), ("d", 4)]
people2 = sorted(people1, key=lambda t:t[1])
print(people2)<|fim_prefix|># repo: watorutart/python_prog path: /testlambda.py
sum = lambda n1, n2: n1 + n2
<|fim_middle|>s1 = sum(10, 20)
print(s1)
| code_fim | easy | {
"lang": "python",
"repo": "watorutart/python_prog",
"path": "/testlambda.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: watorutart/python_prog path: /testlambda.py
sum = lambda n1, n2: n1 + n2
<|fim_suffix|>people1 = [("c", 30), ("b", 200), ("a", 1000), ("d", 4)]
people2 = sorted(people1, key=lambda t:t[1])
print(people2)<|fim_middle|>s1 = sum(10, 20)
print(s1)
| code_fim | easy | {
"lang": "python",
"repo": "watorutart/python_prog",
"path": "/testlambda.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>no.EEXIST:
pass
else:
raise<|fim_prefix|># repo: metabolize-forks/baiji path: /baiji/util/shutillib.py
def mkdir_p(path):
'''
Implements ``mkdir -p``.
'''
im<|fim_middle|>port errno
import os
if path:
try:
os.makedirs... | code_fim | medium | {
"lang": "python",
"repo": "metabolize-forks/baiji",
"path": "/baiji/util/shutillib.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gillemic/ProjectEuler path: /python/problem21.py
''' Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n).
If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers.
<|fim_suffix|>
d... | code_fim | hard | {
"lang": "python",
"repo": "gillemic/ProjectEuler",
"path": "/python/problem21.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
if len(sys.argv) > 1 and int(sys.argv[1]) >= 0:
n = int(sys.argv[1])
else:
n = 10000
amicable_numbers(n)
if __name__ == '__main__':
main()
print("Time elapsed: " + str(time.time() - start) + " seconds")
'''
> python3 problem21.py
[220, 284, 1184, 1210, 2620... | code_fim | hard | {
"lang": "python",
"repo": "gillemic/ProjectEuler",
"path": "/python/problem21.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if len(sys.argv) > 1 and int(sys.argv[1]) >= 0:
n = int(sys.argv[1])
else:
n = 10000
amicable_numbers(n)
if __name__ == '__main__':
main()
print("Time elapsed: " + str(time.time() - start) + " seconds")
'''
> python3 problem21.py
[220, 284, 1184, 1210, 2620, 2924, 5020... | code_fim | hard | {
"lang": "python",
"repo": "gillemic/ProjectEuler",
"path": "/python/problem21.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>frames = []
buf = []
#outfile = open('Pupil_Runout_10nov.txt', 'w')
outfile = open('../derotator2/pupil_0.txt', 'w')
outfile.write("%5s %16s %16s\n" % ( 'angle', 'x' , 'y'))
outfile.write("%5s %16s %16s\n" % ( '-----', '-------------', '---------'))
for i in order:
ax.clear()
ax.matshow(cutouts[i... | code_fim | hard | {
"lang": "python",
"repo": "soylentdeen/Graffity",
"path": "/src/CentroidFinder/pupil_finder.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: soylentdeen/Graffity path: /src/CentroidFinder/pupil_finder.py
import Graffity
import matplotlib.pyplot as pyplot
import numpy
import scipy
import glob
import PIL
import images2gif
import io
fig = pyplot.figure(0)
fig.clear()
ax = fig.add_axes([0.1, 0.1, 0.8, 0.8])
# Change this directory to th... | code_fim | hard | {
"lang": "python",
"repo": "soylentdeen/Graffity",
"path": "/src/CentroidFinder/pupil_finder.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> Returns
----------
Simbad ID's for a list of stars
"""
index_new_dataframe = [None]*len(dataframe_cat)
count_orig = 0
for index_star in range(len(dataframe_cat)):
result_table = Simbad.query_objectids(stars_dataframe_cat[index_star])
#print(count_orig)
i... | code_fim | hard | {
"lang": "python",
"repo": "tomas-silva/SNIP",
"path": "/Extracting_catalogs_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: tomas-silva/SNIP path: /Extracting_catalogs_functions.py
###
### Goals
###
# Select one main catalog. Checks all other selected catalogs for similar stars
# and creats a joint dataframe with all the gathered parameters
###
### Imports
###
import pickle
import galpy
import numpy as np
import ... | code_fim | hard | {
"lang": "python",
"repo": "tomas-silva/SNIP",
"path": "/Extracting_catalogs_functions.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> for index_star in range(len(dataframe_cat)):
result_table = Simbad.query_objectids(stars_dataframe_cat[index_star])
#print(count_orig)
if result_table != None:
names_star_Simbad = result_table['ID']
first_name = names_star_Simbad[0]
count_ori... | code_fim | hard | {
"lang": "python",
"repo": "tomas-silva/SNIP",
"path": "/Extracting_catalogs_functions.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: chmouel/nautilus-cloud-files-plugin path: /cloudfiles/nautilus/main.py
#!/usr/bin/env python
import os
import sys
import socket
import gtk.glade
import cloudfiles
from config import CloudFilesGconf
from constants import GLADE_DIR
from show_container import ShowContainersList
CF_CONNECTION = No... | code_fim | hard | {
"lang": "python",
"repo": "chmouel/nautilus-cloud-files-plugin",
"path": "/cloudfiles/nautilus/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> username = self.gconf_key.get_entry("username", "string")
api_key = self.gconf_key.get_entry("api_key", "string")
check_username = CheckUsernameKey()
if not(all([username, api_key]) and \
check_username.check(username, api_key)):
ask = AskUse... | code_fim | hard | {
"lang": "python",
"repo": "chmouel/nautilus-cloud-files-plugin",
"path": "/cloudfiles/nautilus/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __init__(self, stuff_to_upload):
self.gconf_key = CloudFilesGconf()
self.stuff_to_upload = stuff_to_upload
def main(self):
global USERNAME, API_KEY
username = self.gconf_key.get_entry("username", "string")
api_key = self.gconf_key.get_e... | code_fim | hard | {
"lang": "python",
"repo": "chmouel/nautilus-cloud-files-plugin",
"path": "/cloudfiles/nautilus/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>er is greater i.e.,",a)
else:
print("The Second number is greater i.e.,",b)<|fim_prefix|># repo: AakashJaiswal21998/Basic-Python-Examples path: /7.py
'''Program to print the greater number between two number
Developer:Aakash
Dat<|fim_middle|>e:21.02.2020
--------------------------------'''
a=int(inpu... | code_fim | medium | {
"lang": "python",
"repo": "AakashJaiswal21998/Basic-Python-Examples",
"path": "/7.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AakashJaiswal21998/Basic-Python-Examples path: /7.py
'''Program to print the greater number between two number
Developer:Aakash
Dat<|fim_suffix|>"))
b=int(input("Enter any other number="))
if(a>b):
print("The First number is greater i.e.,",a)
else:
print("The Second number is greater i.e.... | code_fim | medium | {
"lang": "python",
"repo": "AakashJaiswal21998/Basic-Python-Examples",
"path": "/7.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
print(app())<|fim_prefix|># repo: TiwariSimona/Hacktoberfest-2021 path: /RiturajGupta21/EulerQ25.py
import itertools
def app():
<|fim_middle|> n = 1000
b = 1
m = 0
for i in itertools.count():
if len(str(m)) > n:
raise RuntimeError("Not f... | code_fim | hard | {
"lang": "python",
"repo": "TiwariSimona/Hacktoberfest-2021",
"path": "/RiturajGupta21/EulerQ25.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TiwariSimona/Hacktoberfest-2021 path: /RiturajGupta21/EulerQ25.py
import itertools
def app():
<|fim_suffix|>if __name__ == "__main__":
print(app())<|fim_middle|> n = 1000
b = 1
m = 0
for i in itertools.count():
if len(str(m)) > n:
raise RuntimeError("Not f... | code_fim | hard | {
"lang": "python",
"repo": "TiwariSimona/Hacktoberfest-2021",
"path": "/RiturajGupta21/EulerQ25.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def get_attack_name(self):
return "GrabAPIToken"
def get_target_node(self):
return 'EC2Instance'
def get_source_node(self):
return 'EC2Instance'<|fim_prefix|># repo: firewood1996/CloudSimulation path: /modules/attack_methods/aws/ec2_role_compromise.py
from modules.at... | code_fim | easy | {
"lang": "python",
"repo": "firewood1996/CloudSimulation",
"path": "/modules/attack_methods/aws/ec2_role_compromise.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: firewood1996/CloudSimulation path: /modules/attack_methods/aws/ec2_role_compromise.py
from modules.attack_methods.base_neo4j import BaseAttackMethod
<|fim_suffix|> return ['UserPublicIPAddress']
def get_attack_difficult(self):
return 30
def get_attack_name(self):
... | code_fim | medium | {
"lang": "python",
"repo": "firewood1996/CloudSimulation",
"path": "/modules/attack_methods/aws/ec2_role_compromise.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: NicoBlc/ipnd-starter-code-master path: /stage_2/lesson_2.4_control_flow_loops/loops.py
# Lesson 2.4: While Loops
# Loops are an important concept in computer programming.
# Loops let us run blocks of code many times which can be
# really useful when we have to repeat tasks.
# https://classroom.... | code_fim | hard | {
"lang": "python",
"repo": "NicoBlc/ipnd-starter-code-master",
"path": "/stage_2/lesson_2.4_control_flow_loops/loops.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Make sure your procedure prints "upwards", so
# from 1 up to the input number.
def print_numbers(n):
count = 1
while count != n+1:
print count
count = count +1
print_numbers(3)
#>>> 1
#>>> 2
#>>> 3<|fim_prefix|># repo: NicoBlc/ipnd-starter-code-master path: /stage_2/lesson_2... | code_fim | hard | {
"lang": "python",
"repo": "NicoBlc/ipnd-starter-code-master",
"path": "/stage_2/lesson_2.4_control_flow_loops/loops.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
####################################################################################################
# Send data to influxdb
####################################################################################################
def write_database(client, data):
"""
Writes a given data record to th... | code_fim | hard | {
"lang": "python",
"repo": "GiantMolecularCloud/homeclimate",
"path": "/scripts/backup_database.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: GiantMolecularCloud/homeclimate path: /scripts/backup_database.py
"""
Home Climate Monitoring
author: GiantMolecularCloud
This script is part of a collection of scripts to log climate information in python and send them
to influxdb and graphana for plotting.
Manually back up the homeclimate di... | code_fim | hard | {
"lang": "python",
"repo": "GiantMolecularCloud/homeclimate",
"path": "/scripts/backup_database.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
####################################################################################################
# Try backup up to five times
####################################################################################################
for i in range(5):
success, data = copy_data()
write_database(c... | code_fim | hard | {
"lang": "python",
"repo": "GiantMolecularCloud/homeclimate",
"path": "/scripts/backup_database.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ime number.")
n = int(input("Check this number: "))
prime_checker(number=n)<|fim_prefix|># repo: sdearth/pythoncourse path: /day008/prime.py
def prime_checker(number):
isPrime = True
for n in range(2, number)<|fim_middle|>:
if number % n == 0:
isPrime = False
if isPrime:... | code_fim | medium | {
"lang": "python",
"repo": "sdearth/pythoncourse",
"path": "/day008/prime.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> print("It's a prime number.")
else:
print("It's not a prime number.")
n = int(input("Check this number: "))
prime_checker(number=n)<|fim_prefix|># repo: sdearth/pythoncourse path: /day008/prime.py
def prime_checker(number):
isPrime = True
for n in range(2, number)<|fim_middle|... | code_fim | medium | {
"lang": "python",
"repo": "sdearth/pythoncourse",
"path": "/day008/prime.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sdearth/pythoncourse path: /day008/prime.py
def prime_checker(number):
isPrime = True
for n in range(2, number)<|fim_suffix|> print("It's a prime number.")
else:
print("It's not a prime number.")
n = int(input("Check this number: "))
prime_checker(number=n)<|fim_middle|... | code_fim | medium | {
"lang": "python",
"repo": "sdearth/pythoncourse",
"path": "/day008/prime.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#STUDY DRILLS
print("Another Line") #1
#2: print only one line (delete or comment out)
# this turns lines into comments - this code does not run<|fim_prefix|># repo: aewaddell/lpthw path: /excercises/ex1.py
print("Hello World!")
print("Hello Again")
print("I like typing this")
print("This is fun")
print(... | code_fim | easy | {
"lang": "python",
"repo": "aewaddell/lpthw",
"path": "/excercises/ex1.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aewaddell/lpthw path: /excercises/ex1.py
print("Hello World!")
print("Hello Again")
print("I like typing this")
print("This is fun")
print("Yay! Printing.")
print("I'd much rather you 'not'.")
print('I "said" do not touch this.')
<|fim_suffix|>#STUDY DRILLS
print("Another Line") #1
#2: print onl... | code_fim | easy | {
"lang": "python",
"repo": "aewaddell/lpthw",
"path": "/excercises/ex1.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TsingH-googl/PNR path: /code/split_train_test/main_split_train_test.py
import networkx as nx
import os
from split_train_test import *
def read_graph(weighted=0, input=None, directed=0):
'''
Reads the input network in networkx.
'''
if weighted:
G = nx.read_edgelist(input,... | code_fim | hard | {
"lang": "python",
"repo": "TsingH-googl/PNR",
"path": "/code/split_train_test/main_split_train_test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # nx.write_edgelist(G_train, train_write_path, data=False)
with open(train_write_path, 'w+') as f:
for edge in sorted(train_E):
f.write(str(edge[0]-1)+' ' + str(edge[1]-1) + '\n')
f.close()
with open(test_write_path, ... | code_fim | hard | {
"lang": "python",
"repo": "TsingH-googl/PNR",
"path": "/code/split_train_test/main_split_train_test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: renjiraND/similar-fabelio path: /products/urls.py
from django.urls import path
from products.models import Products
import csv
from . import views
<|fim_suffix|>def ready():
Products.objects.all().delete()
dataReader = csv.reader(open('intern-test-data.csv'), delimiter=',', quotechar='"'... | code_fim | medium | {
"lang": "python",
"repo": "renjiraND/similar-fabelio",
"path": "/products/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Products.objects.all().delete()
dataReader = csv.reader(open('intern-test-data.csv'), delimiter=',', quotechar='"')
next(dataReader)
for row in dataReader:
_, product = Products.objects.get_or_create(
product_name = row[0],
price = row[1],
dimens... | code_fim | medium | {
"lang": "python",
"repo": "renjiraND/similar-fabelio",
"path": "/products/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: franciscorgodoy/sistema-gastronomico path: /sis_gastronomico/turnos/models.py
from django.db import models
from sis_gastronomico.empleados.models import Empleado
# Create your models here.
<|fim_suffix|> horario = models.CharField(max_length=35)
desde = models.TimeField()
hasta = mo... | code_fim | medium | {
"lang": "python",
"repo": "franciscorgodoy/sistema-gastronomico",
"path": "/sis_gastronomico/turnos/models.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return "{:s} - De {:s} a {:s}".format(
self.horario.title(),
self.desde.strftime("%H:%M"),
self.hasta.strftime("%H:%M"),
)
class Turno(models.Model):
horario = models.ForeignKey(Horario, models.CASCADE)
fecha = models.Da... | code_fim | medium | {
"lang": "python",
"repo": "franciscorgodoy/sistema-gastronomico",
"path": "/sis_gastronomico/turnos/models.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.