text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|>iew(), name='signup'),
path("register/", views.register, name="register"),
path("user_cad_sucess/", views.user_cad_sucesso, name="user_cad_sucesso"),
]<|fim_prefix|># repo: fabioost/thunderbolt path: /users/urls.py
from django.urls import path
from .views import SignUpView, register, user_cad_<|f... | code_fim | medium | {
"lang": "python",
"repo": "fabioost/thunderbolt",
"path": "/users/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> path("user_cad_sucess/", views.user_cad_sucesso, name="user_cad_sucesso"),
]<|fim_prefix|># repo: fabioost/thunderbolt path: /users/urls.py
from django.urls import path
from .views import SignUpView, register, user_cad_sucesso
from . import views
urlpatterns = [
path('signup/', SignUpView.as_v<|... | code_fim | medium | {
"lang": "python",
"repo": "fabioost/thunderbolt",
"path": "/users/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: fabioost/thunderbolt path: /users/urls.py
from django.urls import path
from .views import SignUpView, register, user_cad_<|fim_suffix|>iew(), name='signup'),
path("register/", views.register, name="register"),
path("user_cad_sucess/", views.user_cad_sucesso, name="user_cad_sucesso"),
]<|f... | code_fim | medium | {
"lang": "python",
"repo": "fabioost/thunderbolt",
"path": "/users/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Panuwat8296/Panuwat-Tiprat path: /6010210562.py
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26)<|fim_suffix|>"credits" or "license()" for more information.
>>> j = 9
>>> for i in range(1,10,2):
print(" "*j+i*"*")
j=j-1<|fim_middle|> [MSC v.1500 64 bit (AMD64)] on win32
Type "copy... | code_fim | easy | {
"lang": "python",
"repo": "Panuwat8296/Panuwat-Tiprat",
"path": "/6010210562.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
>>> for i in range(1,10,2):
print(" "*j+i*"*")
j=j-1<|fim_prefix|># repo: Panuwat8296/Panuwat-Tiprat path: /6010210562.py
Python 2.7.15 (v2.7.15:ca079a3ea3, Apr 30 2018, 16:30:26)<|fim_middle|> [MSC v.1500 64 bit (AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.
>... | code_fim | medium | {
"lang": "python",
"repo": "Panuwat8296/Panuwat-Tiprat",
"path": "/6010210562.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>33[1;34m... \033[0m"
sys.displayhook = pprint.pprint<|fim_prefix|># repo: walterl/dotfiles path: /startup.py
import pprint
import sys
# The ANSI colours below break Conjure's ability to parse REPL input/output
<|fim_middle|># sys.ps1 = "\033[0;34m>>> \033[0m"
# sys.ps2 = "\0 | code_fim | easy | {
"lang": "python",
"repo": "walterl/dotfiles",
"path": "/startup.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: walterl/dotfiles path: /startup.py
import pprint
import sys
# The ANSI colours below <|fim_suffix|># sys.ps1 = "\033[0;34m>>> \033[0m"
# sys.ps2 = "\033[1;34m... \033[0m"
sys.displayhook = pprint.pprint<|fim_middle|>break Conjure's ability to parse REPL input/output
| code_fim | easy | {
"lang": "python",
"repo": "walterl/dotfiles",
"path": "/startup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: walterl/dotfiles path: /startup.py
import pprint
import sys
# The ANSI colours below break Conjure's ability to parse REPL input/output
<|fim_suffix|>33[1;34m... \033[0m"
sys.displayhook = pprint.pprint<|fim_middle|># sys.ps1 = "\033[0;34m>>> \033[0m"
# sys.ps2 = "\0 | code_fim | easy | {
"lang": "python",
"repo": "walterl/dotfiles",
"path": "/startup.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def main():
obj1 = BankAccount();
obj1.Display();
obj1.Deposit();
obj1.Display();
obj1.Withdraw();
obj1.Display();
print("Before Calculating Interest: ");
obj1.Display();
obj1.CalculateIntrest();
print("After Calculating Interest: ");
obj1.Display();
if __name... | code_fim | hard | {
"lang": "python",
"repo": "ftczohaib/python_Assignments",
"path": "/Assignment_7/Assignment7_2.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ftczohaib/python_Assignments path: /Assignment_7/Assignment7_2.py
class BankAccount:
ROI = 10.5;
def __init__(self):
self.Name = input("Enter The Name: ");
self.Amount = float(input("Enter The Amount: "));
def Deposit(self):
self.Amount = self.Amount + int(in... | code_fim | hard | {
"lang": "python",
"repo": "ftczohaib/python_Assignments",
"path": "/Assignment_7/Assignment7_2.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == "POST":
author_name = request.form.get("author_name")
author = Author()
author.name = author_name
author.save()
return jsonify(msg="ok")
@author_blueprint.route("/author/<id>", methods=["GET", "PUT", "DELETE"])
def author_one(id):
"根据id... | code_fim | hard | {
"lang": "python",
"repo": "songyang1996/flask_rest_api_demo",
"path": "/api_v1/author_views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: songyang1996/flask_rest_api_demo path: /api_v1/author_views.py
# -*- coding: utf-8 -*-
from flask import Blueprint, jsonify, request, render_template
author_blueprint = Blueprint("author", __name__)
from models import Author
# @author_blueprint.route("/", methods=["GET"])
# def index():
# "... | code_fim | hard | {
"lang": "python",
"repo": "songyang1996/flask_rest_api_demo",
"path": "/api_v1/author_views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@author_blueprint.route("/author/<id>", methods=["GET", "PUT", "DELETE"])
def author_one(id):
"根据id进行指定作者操作的视图"
if request.method == "GET":
# 根据id查询作者
author = Author.query.get(id)
print(id, author)
return jsonify(author=author.to_dict())
if request.method == "... | code_fim | hard | {
"lang": "python",
"repo": "songyang1996/flask_rest_api_demo",
"path": "/api_v1/author_views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
category = Category.objects.get(pk=pk)
category.delete()
return Response({}, status=status.HTTP_204_NO_CONTENT)
except Category.DoesNotExist as ex:
return Response({'message': ex.args[0]}, status=status.HTTP_404_NOT_FOUND)
except Exce... | code_fim | hard | {
"lang": "python",
"repo": "nswalters/rare-rest-rare-api-arches",
"path": "/rareserverapi/views/categories.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: nswalters/rare-rest-rare-api-arches path: /rareserverapi/views/categories.py
from django.core.exceptions import ValidationError
from rest_framework import status
from django.http import HttpResponseServerError
from rest_framework.viewsets import ViewSet
from rest_framework.response import Respons... | code_fim | medium | {
"lang": "python",
"repo": "nswalters/rare-rest-rare-api-arches",
"path": "/rareserverapi/views/categories.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># Step 9 Subclasing
def test_sphere_volume():
s = Sphere(5)
print(s.volume())
assert s.volume() == 654.4984694978737
def test_sphere_area():
s = Sphere(4)
assert NotImplementedError
def test_str_sphere():
s = Sphere(5)
assert str(s) == "Sphere with radius: 5"
def te... | code_fim | hard | {
"lang": "python",
"repo": "Zach-Cooper/Fall2018-PY210A",
"path": "/students/ZachCooper/session08/test_circle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> s = Sphere(5)
print(s.volume())
assert s.volume() == 654.4984694978737
def test_sphere_area():
s = Sphere(4)
assert NotImplementedError
def test_str_sphere():
s = Sphere(5)
assert str(s) == "Sphere with radius: 5"
def test_repr_sphere():
s = Sphere(12)
asse... | code_fim | hard | {
"lang": "python",
"repo": "Zach-Cooper/Fall2018-PY210A",
"path": "/students/ZachCooper/session08/test_circle.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Zach-Cooper/Fall2018-PY210A path: /students/ZachCooper/session08/test_circle.py
from circle import Circle
from circle import Sphere
from math import pi
def test_init():
Circle(10)
#Step 1
def test_radius():
c = Circle(25)
assert c.radius == 25
# Step 2
def test_diameter():
c ... | code_fim | hard | {
"lang": "python",
"repo": "Zach-Cooper/Fall2018-PY210A",
"path": "/students/ZachCooper/session08/test_circle.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> read_and_convert()
combine_json_data()
def get_champion_data():
script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in
# combines the layout of gameplay.json with the data from english.ini
with open(os.path.join(script_dir, "newgameplay.json"), "r") as gameplay:
... | code_fim | medium | {
"lang": "python",
"repo": "Here2peer/battlestatsbackend",
"path": "/Battlerite/championData/ChampionData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Here2peer/battlestatsbackend path: /Battlerite/championData/ChampionData.py
# creates a newgameplay.json with all the data you need
from Battlerite.championData.dataParser.inireader import read_and_convert
from Battlerite.championData.dataParser.jsonreader import combine_json_data
from flask impo... | code_fim | medium | {
"lang": "python",
"repo": "Here2peer/battlestatsbackend",
"path": "/Battlerite/championData/ChampionData.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def get_champion_data():
script_dir = os.path.dirname(__file__) # <-- absolute dir the script is in
# combines the layout of gameplay.json with the data from english.ini
with open(os.path.join(script_dir, "newgameplay.json"), "r") as gameplay:
return jsonify(json.load(gameplay)), 200<... | code_fim | medium | {
"lang": "python",
"repo": "Here2peer/battlestatsbackend",
"path": "/Battlerite/championData/ChampionData.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vdmitriyev/twitter-data-to-sap-hana-loader path: /src/twitter_data_loader.py
# coding: utf-8
import dbapi
import traceback
import sap_hana_credentials as credentials
from twitterstream import TwitterFetcher
META_INFO_DIRECTORY = 'meta-info'
TABLE_NAME = '"DEMOUSER00"."uni.vlba.gdelt.data::twitte... | code_fim | hard | {
"lang": "python",
"repo": "vdmitriyev/twitter-data-to-sap-hana-loader",
"path": "/src/twitter_data_loader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """
(obj) -> NoneType
Fetching data from CSV with GDELT data and loading to database (with insert statements).
"""
table_fields_names, table_fields_types = self.identify_table_mask('twitter_stream_table-mask.txt')
# Truncating table
if truncate_table:
query = 'TRUNCATE TABLE ' + TAB... | code_fim | hard | {
"lang": "python",
"repo": "vdmitriyev/twitter-data-to-sap-hana-loader",
"path": "/src/twitter_data_loader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def insert_data(self, row, table_fields_names, table_fields_types):
"""
(obj, list, list, list) -> NoneType
Inserting one single row to table.
"""
query = ''
try:
query = self.form_insert_query(TABLE_NAME, row, table_fields_names, table_fields_types)
# print query
self.execu... | code_fim | hard | {
"lang": "python",
"repo": "vdmitriyev/twitter-data-to-sap-hana-loader",
"path": "/src/twitter_data_loader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aznxed/HandSanitation-Detector path: /test.py
import serial.tools.list_ports
import numpy
import matplotlib
import cv2
from pyfirmata import Arduino, util
from time import clock, sleep
def wait(lengthMS):
s = clock()
while (clock() - s) * 1000 < lengthMS:
pass
def callback(v... | code_fim | hard | {
"lang": "python",
"repo": "aznxed/HandSanitation-Detector",
"path": "/test.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> elif key == ord('q') or key == 27:
cv2.destroyAllWindows()
camera.release()
break
processedImage , contours = processImage(image)
cv2.imshow("Original", processedImage)
if len(contours) > 0:
c = max(contours, key=cv2.contourArea)
... | code_fim | hard | {
"lang": "python",
"repo": "aznxed/HandSanitation-Detector",
"path": "/test.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> assert_equal(func([1, 12, 15, 26, 38], [2, 13, 17, 30, 45]), 16)
assert_equal(func([1, 10, 13, 15], [2, 4, 6, 7]), 6.5)
assert_equal(func([1, 2], [4, 5]), 3)
print("TESTS PASSED")
t = medianTest()
t.test(median)<|fim_prefix|># repo: iSkylake/Algorithms path: /Array/Median.py
from nose.tools impo... | code_fim | medium | {
"lang": "python",
"repo": "iSkylake/Algorithms",
"path": "/Array/Median.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def test(self, func):
assert_equal(func([1, 12, 15, 26, 38], [2, 13, 17, 30, 45]), 16)
assert_equal(func([1, 10, 13, 15], [2, 4, 6, 7]), 6.5)
assert_equal(func([1, 2], [4, 5]), 3)
print("TESTS PASSED")
t = medianTest()
t.test(median)<|fim_prefix|># repo: iSkylake/Algorithms path: /Array/Median.... | code_fim | hard | {
"lang": "python",
"repo": "iSkylake/Algorithms",
"path": "/Array/Median.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: iSkylake/Algorithms path: /Array/Median.py
from nose.tools import assert_equal
def median(arr1, arr2):
i = j = k = 0
<|fim_suffix|> return (before + current)/2
class medianTest:
def test(self, func):
assert_equal(func([1, 12, 15, 26, 38], [2, 13, 17, 30, 45]), 16)
assert_equal(func([1, 1... | code_fim | medium | {
"lang": "python",
"repo": "iSkylake/Algorithms",
"path": "/Array/Median.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: joelastuvilca/caso-libro-autor path: /app.py
from flask import Flask, render_template, request, redirect, url_for, flash
from flask_mysqldb import MySQL
app = Flask(__name__)
# mysql database
app.config['MYSQL_HOST'] = 'localhost'
app.config['MYSQL_USER'] = 'root'
app.config['MYSQL_PASSWORD'] =... | code_fim | hard | {
"lang": "python",
"repo": "joelastuvilca/caso-libro-autor",
"path": "/app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@app.route('/update/<id>',methods=['POST'])
def update_libro(id):
if request.method == 'POST':
nom = request.form['nombre']
dips = request.form['disponible']
isbn = request.form['isbn']
print('UPDATE', id, nom, dips, isbn)
cur = mysql.connection.cursor()
... | code_fim | hard | {
"lang": "python",
"repo": "joelastuvilca/caso-libro-autor",
"path": "/app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: leolion0/490-LAB-1 path: /problem 5.py
import numpy as np
import pandas as pd
from sklearn.datasets import load_iris
from sklearn.metrics import f1_score
from sklearn.model_selection import train_test_split
from sklearn.naive_bayes import GaussianNB
from sklearn import svm, neighbors
#https://st... | code_fim | hard | {
"lang": "python",
"repo": "leolion0/490-LAB-1",
"path": "/problem 5.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># print(data1.isnull().sum())
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.33)
gauss = GaussianNB()
gauss.fit(X_train, y_train.values.ravel())
y_pred = dict()
y_pred['gauss'] = gauss.predict(X_test)
# print(y_pred)
svmModel = svm.SVC(gamma='scale')
svmModel.fit(X_train, y_train.... | code_fim | hard | {
"lang": "python",
"repo": "leolion0/490-LAB-1",
"path": "/problem 5.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Tahlil-992/bugophobia.back-end path: /bugophobia_back/user_profile/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('comment/', views.CreateCommentView.as_view()),
path('comments/', views.ListCommentView.as_view()),
path('comment/update_delete/<id>/', vie... | code_fim | hard | {
"lang": "python",
"repo": "Tahlil-992/bugophobia.back-end",
"path": "/bugophobia_back/user_profile/urls.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>ngeVisitDurationTimeView.as_view()),
path('doctor/update/<str:username>/', views.UpdateDoctorProfView.as_view()),
path('patient/update/<str:username>/', views.UpdatePatientProfView.as_view()),
path('change_password/',views.ChangePasswordView.as_view()),
]<|fim_prefix|># repo: Tahlil-992/bugoph... | code_fim | hard | {
"lang": "python",
"repo": "Tahlil-992/bugophobia.back-end",
"path": "/bugophobia_back/user_profile/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>iews.SaveProfileView.as_view()),
path('remove_save/<id>/', views.RemoveSavedProfileView.as_view()),
path('is_saved/', views.IsProfileSavedView.as_view()),
path('list_doctors/', views.ListDoctorsView.as_view()),
path('change_visit_duration/', views.ChangeVisitDurationTimeView.as_view()),
... | code_fim | hard | {
"lang": "python",
"repo": "Tahlil-992/bugophobia.back-end",
"path": "/bugophobia_back/user_profile/urls.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: eodcgmbh/openeo-eodc-driver path: /gateway/_old/endpoints/data.py
""" Data Discovery '/data' """
from flask.views import MethodView
from .. import gateway as gw
class ProductApi(MethodView):
decorators = [
gw.get_decorator("validate"),
gw.get_decorator("auth")
]
de... | code_fim | hard | {
"lang": "python",
"repo": "eodcgmbh/openeo-eodc-driver",
"path": "/gateway/_old/endpoints/data.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|># # rpc_response = gateway.rpc.data.get_records(
# # qtype="product_details",
# # qname=data_id)
# # if rpc_response["status"] == "error":
# # raise gateway.res.map_exceptions(rpc_response, user_id)
# # return gateway.re... | code_fim | hard | {
"lang": "python",
"repo": "eodcgmbh/openeo-eodc-driver",
"path": "/gateway/_old/endpoints/data.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cucapra/JpegNN path: /src/model/cnn.py
learning/>`__ and
# `here <https://ruder.io/transfer-learning/>`__.
#
# In general both transfer learning methods follow the same few steps:
#
# - Initialize the pretrained model
# - Reshape the final layer(s) to have the same number of outputs as the
# ... | code_fim | hard | {
"lang": "python",
"repo": "cucapra/JpegNN",
"path": "/src/model/cnn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: cucapra/JpegNN path: /src/model/cnn.py
e, epoch_loss, epoch_acc))
# if(epoch_acc < 0.5):
# for name, param in model.named_parameters():
# if 'quantize' in name:
# print(param*255)
# torch.save(model.state_dict(), ... | code_fim | hard | {
"lang": "python",
"repo": "cucapra/JpegNN",
"path": "/src/model/cnn.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> reg_loss = 0
factor = 0.1
if args.regularize:
reg_crit = nn.L1Loss(size_average=True)
target = torch.Tensor(3,8,8).cuda()
target.fill_(0)
for name, pa... | code_fim | hard | {
"lang": "python",
"repo": "cucapra/JpegNN",
"path": "/src/model/cnn.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if data['enabled'] and not active:
self.add_desires([self.teleop_desire])
active = True
elif not data['enabled'] and active:
self.remove_desires([self.teleop_desire.id])
active = False
self.last_mutex.acquire()
self.desire_ac... | code_fim | medium | {
"lang": "python",
"repo": "introlab/securbot",
"path": "/ros_pkg/securbot_pkg/scripts/teleop_generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: introlab/securbot path: /ros_pkg/securbot_pkg/scripts/teleop_generator.py
#! /usr/bin/python
import rospy
import json
from threading import Lock
from std_msgs.msg import String
from hbba_msgs.msg import Desire
from hbba_msgs.srv import AddDesires
from hbba_msgs.srv import RemoveDesires
class T... | code_fim | hard | {
"lang": "python",
"repo": "introlab/securbot",
"path": "/ros_pkg/securbot_pkg/scripts/teleop_generator.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.last_mutex.acquire()
self.desire_active = active
self.last_mutex.release()
def electron_callback(self, msg):
self.last_mutex.acquire()
self.last = rospy.Time.now()
active = self.desire_active
self.last_mutex.release()
data = json.l... | code_fim | hard | {
"lang": "python",
"repo": "introlab/securbot",
"path": "/ros_pkg/securbot_pkg/scripts/teleop_generator.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KacieHawkinsdev98/Superheroes_Project path: /superheroes/super_heroes/models.py
from django.db import models
<|fim_suffix|>
class Superheroes(super_heroes.Superheroes):
name = super_heroes.Charfield(max_length=50)<|fim_middle|># Create your models here.
| code_fim | easy | {
"lang": "python",
"repo": "KacieHawkinsdev98/Superheroes_Project",
"path": "/superheroes/super_heroes/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> name = super_heroes.Charfield(max_length=50)<|fim_prefix|># repo: KacieHawkinsdev98/Superheroes_Project path: /superheroes/super_heroes/models.py
from django.db import models
<|fim_middle|># Create your models here.
class Superheroes(super_heroes.Superheroes):
| code_fim | medium | {
"lang": "python",
"repo": "KacieHawkinsdev98/Superheroes_Project",
"path": "/superheroes/super_heroes/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Formats a node for return to the user."""
return {'fullName': node.fullName, 'start': node.start, 'finish': node.finish, 'own': node.own, 'tag': node.tag}
@APP.route('/data')
def data():
"""Returns root level data in json format."""
result = {}
for thread in DATA.threads:
result[thread]... | code_fim | medium | {
"lang": "python",
"repo": "anil291987/hookshot-master",
"path": "/bin/server.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: anil291987/hookshot-master path: /bin/server.py
# Copyright 2012 The hookshot Authors.
#
# 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 copy of the License at
#
# http://www.apache.org/lic... | code_fim | hard | {
"lang": "python",
"repo": "anil291987/hookshot-master",
"path": "/bin/server.py",
"mode": "psm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Returns root level data in json format."""
result = {}
for thread in DATA.threads:
result[thread] = [formatNode(node) for node in DATA.threads[thread].tree]
return json.dumps({
'checkpoints': DATA.checkpoints,
'threads': result
})
@APP.route('/details/<thread>/<path>')
def detai... | code_fim | hard | {
"lang": "python",
"repo": "anil291987/hookshot-master",
"path": "/bin/server.py",
"mode": "spm",
"license": "LicenseRef-scancode-unknown-license-reference",
"source": "the-stack-v2"
} |
<|fim_suffix|> df = pd.read_csv('300k.csv')
df = df[(df != '?').all(axis=1)]
target = df['class']
# preprocess
used_col = ['latitude', 'longitude','appearedTimeOfDay','appearedDayOfWeek','terrainType','closeToWater','continent','temperature','urban','rural','weatherIcon','population density','gymDist... | code_fim | medium | {
"lang": "python",
"repo": "pe310186/pokemonPredict",
"path": "/Code/data.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pe310186/pokemonPredict path: /Code/data.py
import pandas as pd
from sklearn import preprocessing
def get_data():
df = pd.read_csv('300k.csv')
df = df[(df != '?').all(axis=1)]
target = df['class']
target = pd.get_dummies(target,columns=['class'])
# preprocess
used_col = [... | code_fim | medium | {
"lang": "python",
"repo": "pe310186/pokemonPredict",
"path": "/Code/data.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trivial-search/Python_the_hard_way path: /Modules_code/Module 2/argv.py
#import the argv method from the sys module
from sys import argv
#declare the expected command line arguments
script,first_var,second_var,third_var = argv
print("The script using which the program was run" , script)
print("... | code_fim | medium | {
"lang": "python",
"repo": "trivial-search/Python_the_hard_way",
"path": "/Modules_code/Module 2/argv.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>#declare the expected command line arguments
script,first_var,second_var,third_var = sys.argv
print("The script using which the program was run" , script)
print("The first argument passed was",first_var)
#print the lenght of the number of arguments
print(f"The total number of arguments is {len(sys.argv)}"... | code_fim | medium | {
"lang": "python",
"repo": "trivial-search/Python_the_hard_way",
"path": "/Modules_code/Module 2/argv.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>if __name__ == "__main__":
# Generating ordered list
number_list = random.sample(range(100), 20)
number_list.sort()
print("\n Standard Search ")
print(number_list)
standard_search(12, number_list)
binary_search(12, number_list)<|fim_prefix|># repo: Dszymczk/Practice_py... | code_fim | hard | {
"lang": "python",
"repo": "Dszymczk/Practice_python_exercises",
"path": "/20_Element_search.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dszymczk/Practice_python_exercises path: /20_Element_search.py
# Write a function that takes an ordered list of numbers (a list where the elements are in order
# from smallest to largest) and another number. The function decides whether or not the given number
# is inside the list and returns (... | code_fim | hard | {
"lang": "python",
"repo": "Dszymczk/Practice_python_exercises",
"path": "/20_Element_search.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class up(nn.Module):
def __init__(self, in_ch, out_ch, bilinear, layer_factor, network, dilation, unet_norm, activation,
doubleConvTranspose, padding, padding_mode, convtranspose_kernel, up_mode, output_padding1=0):
super(up, self).__init__()
self.padding_mode = paddin... | code_fim | hard | {
"lang": "python",
"repo": "yael-vinker/unpaired_hdr_tmo",
"path": "/models/unet_multi_filters/unet_parts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yael-vinker/unpaired_hdr_tmo path: /models/unet_multi_filters/unet_parts.py
# sub-parts of the U-Net model
import torch
import torch.nn as nn
import torch.nn.functional as F
from utils import params
class double_conv(nn.Module):
'''(conv => BN => ReLU) * 2'''
def __init__(self, in_ch... | code_fim | hard | {
"lang": "python",
"repo": "yael-vinker/unpaired_hdr_tmo",
"path": "/models/unet_multi_filters/unet_parts.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> x = self.mpconv(x)
return x
class up(nn.Module):
def __init__(self, in_ch, out_ch, bilinear, layer_factor, network, dilation, unet_norm, activation,
doubleConvTranspose, padding, padding_mode, convtranspose_kernel, up_mode, output_padding1=0):
super(up, self).... | code_fim | hard | {
"lang": "python",
"repo": "yael-vinker/unpaired_hdr_tmo",
"path": "/models/unet_multi_filters/unet_parts.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>human_entity = Entity(Coord(1,1))
cloud_entity = Entity(Coord(1,1))
print( f"I see {colorSeen(human_entity, cloud_entity)}" )<|fim_prefix|># repo: pabloguarneros/Haikcode path: /lookUp/colorSeen.py
class Coord:
def __init__(self,x=0,y=0):
self.x = x
self.y = y
def __su... | code_fim | medium | {
"lang": "python",
"repo": "pabloguarneros/Haikcode",
"path": "/lookUp/colorSeen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>def colorSeen(human, cloud):
if cloud.coord + human.coord < 5:
return("grey")
return("blue")
human_entity = Entity(Coord(1,1))
cloud_entity = Entity(Coord(1,1))
print( f"I see {colorSeen(human_entity, cloud_entity)}" )<|fim_prefix|># repo: pabloguarneros/Haikcode path: /lookUp/colorSe... | code_fim | medium | {
"lang": "python",
"repo": "pabloguarneros/Haikcode",
"path": "/lookUp/colorSeen.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pabloguarneros/Haikcode path: /lookUp/colorSeen.py
class Coord:
def __init__(self,x=0,y=0):
self.x = x
self.y = y
def __sum__(self, other):
x_distance = (self.x - other.x)**2
y_distance = (self.y - other.y)**2
return ( (x_distance+y_dis... | code_fim | medium | {
"lang": "python",
"repo": "pabloguarneros/Haikcode",
"path": "/lookUp/colorSeen.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: akulakov/explore path: /explore/items.py
from shared import Object
class Item(Object):
pass
celtic_knife = Item("Knife", '🔪', 1000)
celtic_knife.description = """
A knife with a celtic knot engraved on the hilt. The knife is sunk into a heavy stone
and cannot be removed.
"""
<|fim_suffi... | code_fim | hard | {
"lang": "python",
"repo": "akulakov/explore",
"path": "/explore/items.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>lent_doll = Item("Doll", '࿄', 1000)
lent_doll.description = """
A doll, crudely sown out of burlap with a simple linen clothes with
a repeating geometric pattern, wearing a small lump of vaguely shaped
wrought iron as a medallion; its face is left blank without features. It
is suspended from a coarse pol... | code_fim | medium | {
"lang": "python",
"repo": "akulakov/explore",
"path": "/explore/items.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Max-Profi/youtube_channel_stats_in_json path: /youtube_api.py
from statistics import YouTubeStats
API_KEY = 'set your youtube data api here'
channel_id ='channel id'
channel_title = 'channel title'
<|fim_suffix|> channel_stats.stats_to_json_file()<|fim_middle|>if __name__ == "__main__":
... | code_fim | medium | {
"lang": "python",
"repo": "Max-Profi/youtube_channel_stats_in_json",
"path": "/youtube_api.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> channel_stats.get_channel_stats()
channel_stats.stats_to_json_file()<|fim_prefix|># repo: Max-Profi/youtube_channel_stats_in_json path: /youtube_api.py
from statistics import YouTubeStats
API_KEY = 'set your youtube data api here'
channel_id ='channel id'
<|fim_middle|>channel_title = 'channe... | code_fim | medium | {
"lang": "python",
"repo": "Max-Profi/youtube_channel_stats_in_json",
"path": "/youtube_api.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vishnuku/mars_rover path: /plateau.py
class Plateau(object):
def __init__(self, plateau_size):
self.plateau_size = plateau_size
def set_robotic_rover(self, robotic_rover):
<|fim_suffix|> def move_robotic_rover(self, moves):
for move in moves:
if move == 'L'... | code_fim | easy | {
"lang": "python",
"repo": "vishnuku/mars_rover",
"path": "/plateau.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def move_robotic_rover(self, moves):
for move in moves:
if move == 'L' or move == 'R':
self.robotic_rover.rotate(move)
else: # M
self.robotic_rover.move()<|fim_prefix|># repo: vishnuku/mars_rover path: /plateau.py
class Plateau(object):
... | code_fim | hard | {
"lang": "python",
"repo": "vishnuku/mars_rover",
"path": "/plateau.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def set_robotic_rover(self, robotic_rover):
self.robotic_rover = robotic_rover
def move_robotic_rover(self, moves):
for move in moves:
if move == 'L' or move == 'R':
self.robotic_rover.rotate(move)
else: # M
self.robotic_rove... | code_fim | easy | {
"lang": "python",
"repo": "vishnuku/mars_rover",
"path": "/plateau.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: prrn-pg/Shojin path: /Practice/atcoder/others/code-festival-2015-qualb/src/b.py
n, m = map(int, input().split())
arr = list(map(int, input().split()))
d = {}
for a in arr:
if a in d:
d[a] += 1
else:
d<|fim_suffix|>: x[1])
if dd[-1][1] > n // 2:
print(dd[-1][0])
else:
... | code_fim | medium | {
"lang": "python",
"repo": "prrn-pg/Shojin",
"path": "/Practice/atcoder/others/code-festival-2015-qualb/src/b.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>[a] = 1
dd = [[k, v] for k, v in d.items()]
dd = sorted(dd, key=lambda x: x[1])
if dd[-1][1] > n // 2:
print(dd[-1][0])
else:
print("?")<|fim_prefix|># repo: prrn-pg/Shojin path: /Practice/atcoder/others/code-festival-2015-qualb/src/b.py
n, m = map(int, input().split())
arr = list(map(int, input(... | code_fim | medium | {
"lang": "python",
"repo": "prrn-pg/Shojin",
"path": "/Practice/atcoder/others/code-festival-2015-qualb/src/b.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>AUC=[] #empty auc array to store AUCs of each k fold
#make a kfold data structure with 10 folds, a shuffle, and a random seed of 5
kfold = StratifiedKFold(y = Y, n_folds = 10, shuffle = True, random_state=5)
#empty global prediction array to store prediction probability of each k fold (Y value in ... | code_fim | hard | {
"lang": "python",
"repo": "Dmaa/CS188-Project",
"path": "/gnb.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dmaa/CS188-Project path: /gnb.py
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
Created on Wed May 10 23:19:43 2017
@author: dharma naidu and vikashsingh
"""
#CS 188 Medical Imaging Project
import pandas as pd
import sklearn
import numpy as np
import matplotlib.pyplot as plt
... | code_fim | hard | {
"lang": "python",
"repo": "Dmaa/CS188-Project",
"path": "/gnb.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
AUC.append(roc_auc_score(Y[test], predictionsproba)) #append predict proba to our auc array
globpred += predictionsproba.tolist() #add predictproba info to globred (for use in AUC graph)
globy_test += Y[test].tolist() #add Y test info to globytest(for use in AUC graph)
print(np.mean... | code_fim | hard | {
"lang": "python",
"repo": "Dmaa/CS188-Project",
"path": "/gnb.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>alues = []
for i in product([0, 1], repeat = 14):
cont = 0
v = acumulate(i)
values.append(sum([piramid[j][next(v)] for j in range(1, len(piramid))]) + 75)
print(max(values))<|fim_prefix|># repo: dolefeast/ProjectEuler path: /problem18.py
from itertools import product
from time im... | code_fim | hard | {
"lang": "python",
"repo": "dolefeast/ProjectEuler",
"path": "/problem18.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: dolefeast/ProjectEuler path: /problem18.py
from itertools import product
from time import sleep
def acumulate(tuple):
cont = 0
for i in tuple:
cont+=i
yield cont
piramid = """75
95 64
17 47 82
18 35 87 10
20 04 82 47<|fim_suffix|>alues = []
for i in product([0, 1], repeat ... | code_fim | hard | {
"lang": "python",
"repo": "dolefeast/ProjectEuler",
"path": "/problem18.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #determin the angle of the next move.
angle = np.arccos(cosin_angle)
print "angle" , angle
# change angle from rad to deg.
angle_deg = angle *(180/3.142)
print "angle_deg", angle_deg
#dict_delta = state_calc()
print_out1 = dict_delta["x"]
print_out_2 = dict_delta["y"]
print "x iteration = "... | code_fim | hard | {
"lang": "python",
"repo": "MegaYEye/Hose_pulling_MPC",
"path": "/next_state.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: MegaYEye/Hose_pulling_MPC path: /next_state.py
import numpy as np
import ur_data as ur
import goal_calc as goal
import cPickle as pickle
import force_calculator as f
'''
NOTES... Do i need all the offsetting calculations if
im only using relative move commands? I think
i could just add th... | code_fim | hard | {
"lang": "python",
"repo": "MegaYEye/Hose_pulling_MPC",
"path": "/next_state.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #print "delta_x" , delta_x
#print "delta_y" , delta_y
#subtract the delta poss' from origin??
# Not needed as we calibrated our positions relative to the origin to begin with.
#square the deltas to find length of hyp(beam bend equ)
delta_x_sq = delta_x**2
delta_y_sq = delta_y**2
print delta_x
... | code_fim | hard | {
"lang": "python",
"repo": "MegaYEye/Hose_pulling_MPC",
"path": "/next_state.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='hospital',
name='hospitalprofile',
field=models.ImageField(upload_to='hospitalimage'),
),
migrations.AlterField(
model_name='hospital',
name='login_date',
f... | code_fim | medium | {
"lang": "python",
"repo": "pradip026/Digital-Report",
"path": "/patientreport/Hospital/migrations/0004_auto_20191004_1306.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: pradip026/Digital-Report path: /patientreport/Hospital/migrations/0004_auto_20191004_1306.py
# Generated by Django 2.2.4 on 2019-10-04 07:21
import datetime
from django.db import migrations, models
<|fim_suffix|> operations = [
migrations.AlterField(
model_name='hospital'... | code_fim | medium | {
"lang": "python",
"repo": "pradip026/Digital-Report",
"path": "/patientreport/Hospital/migrations/0004_auto_20191004_1306.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> dependencies = [
('Hospital', '0003_auto_20191003_2226'),
]
operations = [
migrations.AlterField(
model_name='hospital',
name='hospitalprofile',
field=models.ImageField(upload_to='hospitalimage'),
),
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "pradip026/Digital-Report",
"path": "/patientreport/Hospital/migrations/0004_auto_20191004_1306.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if self.disControl.checkState() == 2:
mel.eval("vray addAttributesFromGroup %s vray_displacement %s" % (shape, onOff))
if onOff == 1:
if self.dis_none.checkState() != 2:
cmds.setAttr("%s.vrayDisplacementNone" % sha... | code_fim | hard | {
"lang": "python",
"repo": "davidwilliamsDK/maya",
"path": "/vrayTools/vrayShapeAttr.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davidwilliamsDK/maya path: /vrayTools/vrayShapeAttr.py
import os,sys,sip
from PyQt4 import QtGui, QtCore, uic
import maya.cmds as cmds
import maya.mel as mel
import dsCommon.dsProjectUtil as projectUtil
reload(projectUtil)
#Decalring Paths
dev = "dsDev"
live = "dsGlobal"
status = live
... | code_fim | hard | {
"lang": "python",
"repo": "davidwilliamsDK/maya",
"path": "/vrayTools/vrayShapeAttr.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> idx += 1
answer[idx] = i+1
print(" ".join(list(map(str, answer))))<|fim_prefix|># repo: Deserve82/KK_Algorithm_Study path: /Kangho/BOJ_1138.py
N = int(input())
cnt = list(map(int, input().split()))
answer = [-1] * N
for<|fim_middle|> i, num in enumerate(cnt):
curr_num = num
idx = 0
... | code_fim | medium | {
"lang": "python",
"repo": "Deserve82/KK_Algorithm_Study",
"path": "/Kangho/BOJ_1138.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Deserve82/KK_Algorithm_Study path: /Kangho/BOJ_1138.py
N = int(input())
cnt = list(map(int, input().split()))
answer = [-1] * N
for i, num in enumerate(cnt):
curr_num = num
idx = 0
while curr_num o<|fim_suffix|> idx += 1
answer[idx] = i+1
print(" ".join(list(map(str, answe... | code_fim | medium | {
"lang": "python",
"repo": "Deserve82/KK_Algorithm_Study",
"path": "/Kangho/BOJ_1138.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.driver.quit()
def goto_mainpage(self):
return MainPage(self.driver)<|fim_prefix|># repo: zaezjf/Hog_Homework04_AppiumPO path: /page/po00_app.py
import yaml
from appium import webdriver
from page.po01_mainpagge import MainPage
from page.basepage import BasePage
class App(BaseP... | code_fim | hard | {
"lang": "python",
"repo": "zaezjf/Hog_Homework04_AppiumPO",
"path": "/page/po00_app.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: zaezjf/Hog_Homework04_AppiumPO path: /page/po00_app.py
import yaml
from appium import webdriver
from page.po01_mainpagge import MainPage
from page.basepage import BasePage
<|fim_suffix|> if self.driver is None:
self.driver = webdriver.Remote("http://localhost:4723/wd/hub", s... | code_fim | medium | {
"lang": "python",
"repo": "zaezjf/Hog_Homework04_AppiumPO",
"path": "/page/po00_app.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if id in self._all:
self._all[id].value = value
def main(init_qt=True):
import sys
if init_qt: # used for the test suite
app = QtWidgets.QApplication(sys.argv)
widget = QtWidgets.QWidget()
prog = SetupSVG(widget)
widget.show()
if init_qt:
sys... | code_fim | hard | {
"lang": "python",
"repo": "jerlfan/PyMoDAQ",
"path": "/src/pymodaq/examples/logger_image/setup_svg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jerlfan/PyMoDAQ path: /src/pymodaq/examples/logger_image/setup_svg.py
# -*- coding: utf-8 -*-
"""
Created the 30/01/2023
@author: Sebastien Weber
"""
from qtpy import QtWidgets, QtCore, QtSvg, QtGui
from pymodaq.daq_utils.config import Config
from pyqtgraph.widgets.SpinBox import SpinBox
confi... | code_fim | hard | {
"lang": "python",
"repo": "jerlfan/PyMoDAQ",
"path": "/src/pymodaq/examples/logger_image/setup_svg.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def __init__(self, parent_widget: QtWidgets.QWidget):
super().__init__()
self.parent = parent_widget
self.svg_widget = QtSvg.QSvgWidget('setup.svg')
self.settings_widget = QtWidgets.QWidget()
self.settings_widget.setLayout(QtWidgets.QVBoxLayout())
sel... | code_fim | hard | {
"lang": "python",
"repo": "jerlfan/PyMoDAQ",
"path": "/src/pymodaq/examples/logger_image/setup_svg.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SkotarenkoEvgeny/scrapy_test_3 path: /spiders/tesco.py
from itertools import zip_longest
import json
import scrapy
import logging
from items.items import ProductTescoItem
array_test = lambda i:(None if len(i) == 0 else '\n'.join(i))
class TescoSpider(scrapy.Spider):
name = 'tesco'
all... | code_fim | hard | {
"lang": "python",
"repo": "SkotarenkoEvgeny/scrapy_test_3",
"path": "/spiders/tesco.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
NEXT_PAGE_SELECTOR = "//*[@name='go-to-results-page']/@href"
PRODUCT_ON_PAGE_SELECTOR = "//*[@data-auto='product-tile--title']/@href"
next_page = response.xpath(NEXT_PAGE_SELECTOR).get()
product_list_on_page = response.xpath(PRODUCT_ON_PAGE_SELECTOR).getall()
for p... | code_fim | hard | {
"lang": "python",
"repo": "SkotarenkoEvgeny/scrapy_test_3",
"path": "/spiders/tesco.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> NEXT_PAGE_SELECTOR = "//*[@name='go-to-results-page']/@href"
PRODUCT_ON_PAGE_SELECTOR = "//*[@data-auto='product-tile--title']/@href"
next_page = response.xpath(NEXT_PAGE_SELECTOR).get()
product_list_on_page = response.xpath(PRODUCT_ON_PAGE_SELECTOR).getall()
for pr... | code_fim | hard | {
"lang": "python",
"repo": "SkotarenkoEvgeny/scrapy_test_3",
"path": "/spiders/tesco.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: davejonesbkk/web_crawler path: /crawler.py
#Get website url
#Crawler function
#inits the crawl
#makes a thread for each page being crawled
#tracks pages that have been crawled already
#Threading function
#create queues
#Crawled data function
#stores & handles all data from crawled pages
fr... | code_fim | hard | {
"lang": "python",
"repo": "davejonesbkk/web_crawler",
"path": "/crawler.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user_url = args.website_url
crawler(user_url)
def crawler(user_url):
r = requests.get(user_url)
print 'Fetching ', user_url, '. Returns: ', r.status_code
soup = BeautifulSoup(r.text, 'html.parser')
for l in soup.find_all('a'):
all_links.append(l.get('href'))
for al in all_links:
if al[0:... | code_fim | hard | {
"lang": "python",
"repo": "davejonesbkk/web_crawler",
"path": "/crawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> funcs = check_response()
try:
funcs()
except Exception:
print 'Error, stopping'
print problem_links
if __name__ == '__main__':
get_data()<|fim_prefix|># repo: davejonesbkk/web_crawler path: /crawler.py
#Get website url
#Crawler function
#inits the crawl
#makes a thread for each page ... | code_fim | hard | {
"lang": "python",
"repo": "davejonesbkk/web_crawler",
"path": "/crawler.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ###
op.drop_constraint(None, 'questions', type_='foreignkey')
op.drop_column('questions', 'correct_answer_id')
op.drop_table('upvotes')
# ### end Alembic commands ###<|fim_prefix|># repo: gfgullo/FlaskAsk path: /migrations/vers... | code_fim | medium | {
"lang": "python",
"repo": "gfgullo/FlaskAsk",
"path": "/migrations/versions/6dca8c020d2d_added_upvoted.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: gfgullo/FlaskAsk path: /migrations/versions/6dca8c020d2d_added_upvoted.py
"""added upvoted
Revision ID: 6dca8c020d2d
Revises:
Create Date: 2021-02-17 18:03:15.218694
"""
from alembic import op
import sqlalchemy as sa
# revision identifiers, used by Alembic.
revision = '6dca8c020d2d'
down_rev... | code_fim | medium | {
"lang": "python",
"repo": "gfgullo/FlaskAsk",
"path": "/migrations/versions/6dca8c020d2d_added_upvoted.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sbtries/class_pandaaaa path: /Code/AshtonSmith/django_labs/musiclab/musicstore_proj/musicapp/templatetags/musicapp_extras.py
from django import template
import string
from ..api import request_song
register = template.Library()
@register.simple_tag
def get_slug(value):
<|fim_suffix|>@register.si... | code_fim | medium | {
"lang": "python",
"repo": "sbtries/class_pandaaaa",
"path": "/Code/AshtonSmith/django_labs/musiclab/musicstore_proj/musicapp/templatetags/musicapp_extras.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>@register.simple_tag
def get_liked_songs(list):
my_list = str(list).split(",")
final_list = []
for i in my_list:
final_list.append(request_song(i))
return final_list<|fim_prefix|># repo: sbtries/class_pandaaaa path: /Code/AshtonSmith/django_labs/musiclab/musicstore_proj/musicapp/... | code_fim | medium | {
"lang": "python",
"repo": "sbtries/class_pandaaaa",
"path": "/Code/AshtonSmith/django_labs/musiclab/musicstore_proj/musicapp/templatetags/musicapp_extras.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.