text stringlengths 232 16.3k | domain stringclasses 1
value | difficulty stringclasses 3
values | meta dict |
|---|---|---|---|
<|fim_suffix|> print predictions
print accuracy_score(Y_test, predictions)
=======
def prepare_data():
"""Prepare data for classifier to use"""
#data, label = load_ta_data(), load_ta_target()
data, label = load_own_data(), load_own_target()
tra_x, tst_x = split_samples(data)
tra_y, tst_y = sp... | code_fim | hard | {
"lang": "python",
"repo": "Rakhee06/Weather-Forecasting",
"path": "/classification.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> #kf = KFold(n_splits=10)
#print (kf.get_n_splits(X))
#for training_index, test_index in kf.split(X):
# print("TRAIN:", training_index, "TEST:", test_index)
# X_training, X_test = X[training_index], X[test_index]
# Y_training, Y_test = Y[training_index], Y[test_index]
... | code_fim | hard | {
"lang": "python",
"repo": "Rakhee06/Weather-Forecasting",
"path": "/classification.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: trinh-dat/Video-Addon-Kodi path: /Python scripts/addon_demo.py
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import requests
from bs4 import BeautifulSoup
url = "http://javmobile.net/?s=julia"
r = requests.get(url)
soup = BeautifulSoup(r.content, "html.parser")
imgs = soup.f... | code_fim | medium | {
"lang": "python",
"repo": "trinh-dat/Video-Addon-Kodi",
"path": "/Python scripts/addon_demo.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
images = []
titles = []
srcs = []
for img in imgs:
images.append(img.get("src"))
titles.append(img.get("title"))
srcs.append(img.get("href"))
videos = []
for src in srcs:
url2 = "http://javmobile.net/censored/oppai/pppd-524-spence-mammary-gland-development-clinic-special-julia.html"
... | code_fim | medium | {
"lang": "python",
"repo": "trinh-dat/Video-Addon-Kodi",
"path": "/Python scripts/addon_demo.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Nicolas-le/argumentRetrieval path: /code_base/ES/indices.py
from connect_to_elasticsearch import *
<|fim_suffix|> indicies = set()
for index in connect_to_elasticsearch().indices.get_alias( "*" ):
indicies.add( index )
print( index )
return indicies<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "Nicolas-le/argumentRetrieval",
"path": "/code_base/ES/indices.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> indicies = set()
for index in connect_to_elasticsearch().indices.get_alias( "*" ):
indicies.add( index )
print( index )
return indicies<|fim_prefix|># repo: Nicolas-le/argumentRetrieval path: /code_base/ES/indices.py
from connect_to_elasticsearch import *
<|fim_middle|>... | code_fim | medium | {
"lang": "python",
"repo": "Nicolas-le/argumentRetrieval",
"path": "/code_base/ES/indices.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
class CalcResultAdmin(MyAdmin):
list_display = ('result', 'message', 'time',)
search_fields = ('result', 'message', 'time',)
admin.site.register(CalcResult, CalcResultAdmin)<|fim_prefix|># repo: rezolvent/simple_calc path: /calc/admin.py
from django.contrib import admin
from calc.models import... | code_fim | easy | {
"lang": "python",
"repo": "rezolvent/simple_calc",
"path": "/calc/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rezolvent/simple_calc path: /calc/admin.py
from django.contrib import admin
from calc.models import CalcResult
class MyAdmin(admin.ModelAdmin):
def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return Fals... | code_fim | medium | {
"lang": "python",
"repo": "rezolvent/simple_calc",
"path": "/calc/admin.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def has_add_permission(self, request, obj=None):
return False
def has_delete_permission(self, request, obj=None):
return False
class CalcResultAdmin(MyAdmin):
list_display = ('result', 'message', 'time',)
search_fields = ('result', 'message', 'time',)
admin.site.registe... | code_fim | easy | {
"lang": "python",
"repo": "rezolvent/simple_calc",
"path": "/calc/admin.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: mboker/EPI_Problems path: /EPI_arrays/quicksort_keys.py
import random
#quicksort a list of objects based on keys, which can be any of 3 values
# done in O(n) time in one pass, and O(1) additional space complexity
def quicksort(x, pivot_index):
<|fim_suffix|> key_values = [{'key': key, 'value'... | code_fim | hard | {
"lang": "python",
"repo": "mboker/EPI_Problems",
"path": "/EPI_arrays/quicksort_keys.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return x
if __name__ == '__main__':
keys = ['key1', 'key2', 'key3']
values = [0, 1, 2, 3, 4]
key_values = [{'key': key, 'value': value} for key in keys for value in values]
random.shuffle(key_values)
print(quicksort(key_values, 7))<|fim_prefix|># repo: mboker/EPI_Problems path:... | code_fim | hard | {
"lang": "python",
"repo": "mboker/EPI_Problems",
"path": "/EPI_arrays/quicksort_keys.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> operations = [
migrations.AddField(
model_name='otpsecrets',
name='issuer_name',
field=models.CharField(blank=True, db_index=True, max_length=40),
),
]<|fim_prefix|># repo: hiroaki-yamamoto/django-good-otp path: /django_otp/migrations/0002_otpse... | code_fim | medium | {
"lang": "python",
"repo": "hiroaki-yamamoto/django-good-otp",
"path": "/django_otp/migrations/0002_otpsecrets_issuer_name.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # print(cast_and_character)
# print(len(cast_and_character))
return cast_and_character
def checkvalidtext(txt):
if(txt.isspace()):
return False
arr = ["|", "See more", "\u00bb", ","]
if txt in arr:
return False
if txt.strip() in arr:
return False
re... | code_fim | hard | {
"lang": "python",
"repo": "arnab-api/IMDb-Scraper",
"path": "/2_imdb_scrape_movie_pages_one_by_one.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: arnab-api/IMDb-Scraper path: /2_imdb_scrape_movie_pages_one_by_one.py
from selenium import webdriver
from bs4 import BeautifulSoup
from selenium.webdriver.common.action_chains import ActionChains
import time
import json
import re
import os
import datetime
########################################... | code_fim | hard | {
"lang": "python",
"repo": "arnab-api/IMDb-Scraper",
"path": "/2_imdb_scrape_movie_pages_one_by_one.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Dolck/kivy-gaming path: /tests/pong-box2d/pong.py
#Kivy + Box2d test
#Not working...
from Box2D import *
from random import random
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.properties import NumericProperty, ObjectProperty
from kivy.lang import Builder
from kivy.cloc... | code_fim | hard | {
"lang": "python",
"repo": "Dolck/kivy-gaming",
"path": "/tests/pong-box2d/pong.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def update_from_body(self):
#constant speed
vel = self._body.linearVelocity
if(vel.length > 0 and (vel.length > 1.05 or vel.length < 0.95)):
t = self.speed/vel.length
vel.x = vel.x*t
vel.y = vel.y*t
self._body.linearVelocity = vel
self.pos = self._body.position.x, self._body.position... | code_fim | hard | {
"lang": "python",
"repo": "Dolck/kivy-gaming",
"path": "/tests/pong-box2d/pong.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>class PongGame(App):
ball = ObjectProperty(None)
player1 = ObjectProperty(None)
player2 = ObjectProperty(None)
def touchdown(self, instance, touch):
self.serve_ball()
def serve_ball(self):
vel = self.ball._body.linearVelocity
vel.x = random()-0.5
vel.y = random()-0.5
self.ball._body.linea... | code_fim | hard | {
"lang": "python",
"repo": "Dolck/kivy-gaming",
"path": "/tests/pong-box2d/pong.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
if __name__ == "__main__":
report_path = os.path.dirname(__file__) + "/report/" + "TestCRM_report.html"
suite = unittest.TestLoader().loadTestsFromTestCase(TestCRM)
runer = HTMLTestRunner(title="悟空CRM测试报告", description="登录", stream=open(report_path, "wb"),
verbosity... | code_fim | medium | {
"lang": "python",
"repo": "yuxichen2019/AotuTestStudy",
"path": "/python_workspace/appiumTraining/testcase/TestCRMcreateCustomer.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yuxichen2019/AotuTestStudy path: /python_workspace/appiumTraining/testcase/TestCRMcreateCustomer.py
# -*- encoding:utf-8 -*-
import os
import unittest
from HTMLTestRunner_cn import HTMLTestRunner
from time import sleep
from framework.SunFlower import SunFlower
from testcase.TestCRM import TestCR... | code_fim | hard | {
"lang": "python",
"repo": "yuxichen2019/AotuTestStudy",
"path": "/python_workspace/appiumTraining/testcase/TestCRMcreateCustomer.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> import os
test_dir = os.path.join(os.path.dirname(__file__), "data")
test_file = os.path.join(test_dir, "TMS-758.csv")
test_file = os.path.join(test_dir, "TMS-441.csv")
# test_file = os.path.join(test_dir, "TMS-310.csv")
points = read_and_transform.read_csv_file(test_file)
fi... | code_fim | medium | {
"lang": "python",
"repo": "deherinu/TmsViewer",
"path": "/tms/tms_timing.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: deherinu/TmsViewer path: /tms/tms_timing.py
from __future__ import division
import numpy as np
import scipy.stats
from tms import read_and_transform
__author__ = 'Diego'
def estimate_vrpn_clock_drift(points):
# clocks = [map(np.datetime64,(p.date,p.ref_date,p.point_date)) for p in point... | code_fim | medium | {
"lang": "python",
"repo": "deherinu/TmsViewer",
"path": "/tms/tms_timing.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Flamigero/fakeTwitter path: /users/models.py
"""
Users model
"""
# Django
from django.conf import settings
from django.db import models
from django.contrib.auth.models import AbstractUser
from django.core.validators import RegexValidator
class User(AbstractUser):
"""User model"""... | code_fim | hard | {
"lang": "python",
"repo": "Flamigero/fakeTwitter",
"path": "/users/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> email = models.EmailField(
'email address',
unique=True,
error_messages={
'unique': 'A user with that email already exists'
}
)
phone_regex = RegexValidator(
regex=r'\+?1?\d{9,15}$',
message='Phone number must be entered in t... | code_fim | medium | {
"lang": "python",
"repo": "Flamigero/fakeTwitter",
"path": "/users/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
def __str__(self):
return self.user.username<|fim_prefix|># repo: Flamigero/fakeTwitter path: /users/models.py
"""
Users model
"""
# Django
from django.conf import settings... | code_fim | hard | {
"lang": "python",
"repo": "Flamigero/fakeTwitter",
"path": "/users/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BobiAce/prune_distill_test path: /model/resnext_cifar.py
"""
Creates a ResNeXt Model as defined in:
Xie, S., Girshick, R., Dollar, P., Tu, Z., & He, K. (2016).
Aggregated residual transformations for deep neural networks.
arXiv preprint arXiv:1611.05431.
import from https://github.com/prlz77/Res... | code_fim | hard | {
"lang": "python",
"repo": "BobiAce/prune_distill_test",
"path": "/model/resnext_cifar.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# """
# resneXt for cifar with pytorch
# Reference:
# [1] S. Xie, G. Ross, P. Dollar, Z. Tu and K. He Aggregated residual transformations for deep neural networks. In CVPR, 2017
# """
#
# import torch
# import torch.nn as nn
# import math
#
#
# class Bottleneck(nn.Module):
# expansio... | code_fim | hard | {
"lang": "python",
"repo": "BobiAce/prune_distill_test",
"path": "/model/resnext_cifar.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: ZDHades/Chemathstry path: /app/blueprints/authentication/routes.py
from .import bp as authentication
from app import db
from flask import current_app as app, render_template, request, redirect, url_for, flash, session
from flask_login import login_user, logout_user, current_user, login_required
f... | code_fim | medium | {
"lang": "python",
"repo": "ZDHades/Chemathstry",
"path": "/app/blueprints/authentication/routes.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # check if the info is correct
if user is None or not user.check_password(request.form.get('password')):
flash("You have entered incorrect details, please try again", 'danger')
return redirect(url_for('authentication.login'))
login_user(user)
flash("... | code_fim | medium | {
"lang": "python",
"repo": "ZDHades/Chemathstry",
"path": "/app/blueprints/authentication/routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> user = User.query.filter_by(email=request.form.get('email')).first()
if form.validate_on_submit():
# check if the info is correct
if user is None or not user.check_password(request.form.get('password')):
flash("You have entered incorrect details, please try again", 'da... | code_fim | hard | {
"lang": "python",
"repo": "ZDHades/Chemathstry",
"path": "/app/blueprints/authentication/routes.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DiegoGtz/bio-samples path: /viral/alignment-free/compare_features.py
olumns[0])
DIST_mega = mega_dist_csv.values
DIST_mega[np.isnan(DIST_mega)] = 0 # lllenamos con ceros los valores nan
DIST_mega = DIST_mega + DIST_mega.T #copiamos el triangulo inferior al superir en la matriz
distances_mega = DI... | code_fim | hard | {
"lang": "python",
"repo": "DiegoGtz/bio-samples",
"path": "/viral/alignment-free/compare_features.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>full_distances_lbp = np.array(full_distances_lbp)
print("full_distances_lbp", full_distances_lbp.shape)
###################################################################################################################3
# procesamos las distancias con MLBP
###############################################... | code_fim | hard | {
"lang": "python",
"repo": "DiegoGtz/bio-samples",
"path": "/viral/alignment-free/compare_features.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DiegoGtz/bio-samples path: /viral/alignment-free/compare_features.py
data_features_glcm[j][mapping_type])**2))
row[j] = dist
DIST_glcm[i] = row
DIST_glcm = DIST_glcm + DIST_glcm.T - np.diag(np.diag(DIST_glcm))
DIST_glcm = (DIST_glcm - np.min(DIST_glcm)) / (np.max... | code_fim | hard | {
"lang": "python",
"repo": "DiegoGtz/bio-samples",
"path": "/viral/alignment-free/compare_features.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # with settings(warn_only=True):
# with cd(APP_DIR):
# run('sudo ./deploy.sh')<|fim_prefix|># repo: paige0701/flaskproject path: /fabfile.py
# fabric이 실행할 대상을 제어.
from fabric.api import *
AWS_EC2_01 = 'ec2-52-78-143-155.ap-northeast-2.compute.amazonaws.com' # Running
PROJECT_... | code_fim | medium | {
"lang": "python",
"repo": "paige0701/flaskproject",
"path": "/fabfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: paige0701/flaskproject path: /fabfile.py
# fabric이 실행할 대상을 제어.
from fabric.api import *
AWS_EC2_01 = 'ec2-52-78-143-155.ap-northeast-2.compute.amazonaws.com' # Running
PROJECT_DIR = '/var/www/kamper'
APP_DIR = '%s/app' % PROJECT_DIR
"""
# the user to use for the remote commands
env.user =... | code_fim | medium | {
"lang": "python",
"repo": "paige0701/flaskproject",
"path": "/fabfile.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
# local('git push origin master', capture=False)
def deploy():
print('deploying')
pass
# with settings(warn_only=True):
# with cd(APP_DIR):
# run('sudo ./deploy.sh')<|fim_prefix|># repo: paige0701/flaskproject path: /fabfile.py
# fabric이 실행할 대상을 제어.
from fabric.ap... | code_fim | hard | {
"lang": "python",
"repo": "paige0701/flaskproject",
"path": "/fabfile.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> previous += 1
current += 1
return seen_a_double
def part_2() -> int:
start = 382345
end = 843167
total = 0
for number in range(start, end + 1):
if check_number_2(str(number)):
total += 1
return total
def main():
x = "111111"
print(... | code_fim | hard | {
"lang": "python",
"repo": "sj175/AoC_2019",
"path": "/day4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return total
def main():
x = "111111"
print(check_number(x) is True)
x = "223450"
print(check_number(x) is False)
x = "123789"
print(check_number(x) is False)
print("PART 1:", part_1()) # should be 460
x = "112233"
print(check_number_2(x) is True)
x = "1234... | code_fim | hard | {
"lang": "python",
"repo": "sj175/AoC_2019",
"path": "/day4.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: sj175/AoC_2019 path: /day4.py
def part_1() -> int:
start = 382345
end = 843167
total = 0
for number in range(start, end + 1):
if check_number(str(number)):
total += 1
return total
def check_number(problem_input: str) -> bool:
<|fim_suffix|> print("PA... | code_fim | hard | {
"lang": "python",
"repo": "sj175/AoC_2019",
"path": "/day4.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> if request.method == 'POST':
name=request.POST['name']
email=request.POST['email']
subject=request.POST['subject']
phone=request.POST['phone']
message=request.POST['message']
cfm=ContactForm(name=name,email=email,subject=subject,phone=phone,message=messa... | code_fim | hard | {
"lang": "python",
"repo": "Harsh-2811/carzone",
"path": "/carapp/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Harsh-2811/carzone path: /carapp/views.py
from django.shortcuts import render
from .models import Team,ContactForm
from cars.models import Car
from django.contrib import messages
# Create your views here.
def index(request):
<|fim_suffix|>def service(request):
return render(request,'pages/ser... | code_fim | hard | {
"lang": "python",
"repo": "Harsh-2811/carzone",
"path": "/carapp/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: DamonKoy/python_exercises path: /work20200612.py
# -*- coding: utf-8 -*-
# @Time : 2020/6/12 20:19
# @Author : damon
# @Site :
# @File : work0612
# @Software: PyCharm
import math
"""
1、给定n=10,计算1! + 2! + 3! + ... + n!的值
"""
# 解法1:
n = 10
factorial = 1
sum = 0
for i in range(1, n+1)... | code_fim | hard | {
"lang": "python",
"repo": "DamonKoy/python_exercises",
"path": "/work20200612.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>"""
3、我的关注列表follow_list = {"status":"ok","data":{"follow_list":[{"user_id":"32804516","nickname":"羽秋璃1111233","is_friend":0,"is_vip":1},{"user_id":"35742446","nickname":"我是你的宝贝哦","is_friend":1,"is_vip":1},{"user_id":"264844","nickname":"大鱼噢大鱼","is_friend":0,"is_vip":1},{"user_id":"34362681","nickname":"薛一... | code_fim | hard | {
"lang": "python",
"repo": "DamonKoy/python_exercises",
"path": "/work20200612.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>c", th3)
cv.imshow("Threshold2", th2)
cv.imshow("Threshold", th1)
cv.imshow("Image",img)
cv.imshow("th4", th4)
cv.imshow("th5", th5)
cv.waitKey(0)
cv.destroyAllWindows()<|fim_prefix|># repo: guilhermerbueno/python-computer-vision path: /simple_thresholding.py
import cv2 as cv
img = cv.imread('images/gr... | code_fim | hard | {
"lang": "python",
"repo": "guilhermerbueno/python-computer-vision",
"path": "/simple_thresholding.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: guilhermerbueno/python-computer-vision path: /simple_thresholding.py
import cv2 as cv
img = cv.imread('images/gradient.png', 0)
_,th1 = cv.threshold(img, 127,255, cv.THRESH_BINARY)
_,th2 = cv.threshold(img, 127, 255, cv.THRESH_BINARY_INV<|fim_suffix|>ld will be zero
_,th5 = cv.threshold(img, 127... | code_fim | medium | {
"lang": "python",
"repo": "guilhermerbueno/python-computer-vision",
"path": "/simple_thresholding.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> try:
reaction, user = await client.wait_for('reaction_add', timeout=600.0, check=check)
except asyncio.TimeoutError:
pass
else:
await message_sent.delete()
client.run(TOKEN)<|fim_prefix|># repo: 4skl/TranslatorBot path: /TranslatorBot.py... | code_fim | hard | {
"lang": "python",
"repo": "4skl/TranslatorBot",
"path": "/TranslatorBot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: 4skl/TranslatorBot path: /TranslatorBot.py
import discord, requests
from random import choice
TOKEN = 'TOKEN'
CONTACT_EMAIL = None #'Contact email for getting 10000 words/day instead of 1000'
translate_command = '$t'
id_start = '<@!'
client = discord.Client()
def unescape(text):
... | code_fim | medium | {
"lang": "python",
"repo": "4skl/TranslatorBot",
"path": "/TranslatorBot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def check(reaction, user):
return user == message.author and str(reaction.emoji) == '❌'
try:
reaction, user = await client.wait_for('reaction_add', timeout=600.0, check=check)
except asyncio.TimeoutError:
pass
else:
... | code_fim | medium | {
"lang": "python",
"repo": "4skl/TranslatorBot",
"path": "/TranslatorBot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>(word[i+1:],substring[1:]):
yield ((i,word[:i]),*sub_sequance)
if __name__ == '__main__':
word = input('')
substring = input('')
maxNum = 0
for lefts in map(list,get_all_lefts(word,substring)):
if -1 in lefts:
continue
print(lefts)
p... | code_fim | hard | {
"lang": "python",
"repo": "TheKillerAboy/programming-olympiad",
"path": "/Python_Solutions/CodeForces/#579/Remove_the_Substring_(easy_version).py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: TheKillerAboy/programming-olympiad path: /Python_Solutions/CodeForces/#579/Remove_the_Substring_(easy_version).py
def get_all_lefts(word,substring):
if len(substring) == 0:
yield ((len(word),word),)
else:
if substring[0] not in word:
yield (-1,)
else:
... | code_fim | hard | {
"lang": "python",
"repo": "TheKillerAboy/programming-olympiad",
"path": "/Python_Solutions/CodeForces/#579/Remove_the_Substring_(easy_version).py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
dependencies = [
('chat', '0005_user_image'),
]
operations = [
migrations.AlterField(
model_name='user',
name='first_name',
field=models.CharField(max_length=255, verbose_name='Имя'),
),
migrations.AlterField(
mo... | code_fim | medium | {
"lang": "python",
"repo": "Reiko1337/messenger",
"path": "/chat/migrations/0006_auto_20210820_0101.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Reiko1337/messenger path: /chat/migrations/0006_auto_20210820_0101.py
# Generated by Django 3.2.6 on 2021-08-19 22:01
from django.db import migrations, models
<|fim_suffix|> dependencies = [
('chat', '0005_user_image'),
]
operations = [
migrations.AlterField(
... | code_fim | medium | {
"lang": "python",
"repo": "Reiko1337/messenger",
"path": "/chat/migrations/0006_auto_20210820_0101.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: SeisSol/SeisSol path: /preprocessing/partitioning/gambit2seissol/partition/partitioner.py
#!/usr/bin/python
##
# @file
# This file is part of SeisSol.
#
# @author Sebastian Rettenberger (rettenbs AT in.tum.de, http://www5.in.tum.de/wiki/index.php/Sebastian_Rettenberger,_M.Sc.)
#
# @section LICENS... | code_fim | hard | {
"lang": "python",
"repo": "SeisSol/SeisSol",
"path": "/preprocessing/partitioning/gambit2seissol/partition/partitioner.py",
"mode": "psm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Write metis mesh
metis.MeshWriter(metisMesh, mesh.elements())
# Convert to graph
metisGraph = tmpdir.path(METIS_GRAPH)
p = subprocess.Popen(['m2gmetis', '-ncommon=3', metisMesh, metisGraph],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
... | code_fim | hard | {
"lang": "python",
"repo": "SeisSol/SeisSol",
"path": "/preprocessing/partitioning/gambit2seissol/partition/partitioner.py",
"mode": "spm",
"license": "BSD-3-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>def a_star(source: str, target: str, heuristic: Callable[[str, str], float]) -> list:
"""
Returns path from source to target using A* search algorithm.
"""
visited: set = set((source))
cur: Article = Article(source, target, None, heuristic)
queue = PQ()
while not compare_title... | code_fim | hard | {
"lang": "python",
"repo": "BinyuanZhu/Wikipedia-Graph-Net",
"path": "/graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> return self.f >= other.f
class PQ:
"""
MinHeap implementation of a priority queue for A* search.
"""
heap = []
def __init__(self):
self.heap = []
def insert(self, to_insert: Article) -> None:
"""
Insert new element in Priority queue
"""
... | code_fim | hard | {
"lang": "python",
"repo": "BinyuanZhu/Wikipedia-Graph-Net",
"path": "/graph.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: BinyuanZhu/Wikipedia-Graph-Net path: /graph.py
from __future__ import annotations
import typing
import requests
import heapq
from sklearn.metrics.pairwise import cosine_similarity
from sklearn.feature_extraction.text import TfidfVectorizer
from bs4 import BeautifulSoup
from wikiAPI import get_JSO... | code_fim | hard | {
"lang": "python",
"repo": "BinyuanZhu/Wikipedia-Graph-Net",
"path": "/graph.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def __str__(self):
return f"Quote. Author: {self.author}, q: {self.quote[:10]}..."
def __repr__(self):
return self.__str__()<|fim_prefix|># repo: parfenov1976/Flask1_08_08 path: /api/models/quote.py
from api import db
from api.models.author import AuthorModel
class QuoteModel(d... | code_fim | medium | {
"lang": "python",
"repo": "parfenov1976/Flask1_08_08",
"path": "/api/models/quote.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> return f"Quote. Author: {self.author}, q: {self.quote[:10]}..."
def __repr__(self):
return self.__str__()<|fim_prefix|># repo: parfenov1976/Flask1_08_08 path: /api/models/quote.py
from api import db
from api.models.author import AuthorModel
class QuoteModel(db.Model):
id = db.C... | code_fim | hard | {
"lang": "python",
"repo": "parfenov1976/Flask1_08_08",
"path": "/api/models/quote.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: parfenov1976/Flask1_08_08 path: /api/models/quote.py
from api import db
from api.models.author import AuthorModel
class QuoteModel(db.Model):
<|fim_suffix|> def __init__(self, author, quote, rating=1):
self.author = author
self.quote = quote
self.rate = rating
de... | code_fim | hard | {
"lang": "python",
"repo": "parfenov1976/Flask1_08_08",
"path": "/api/models/quote.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: jsimmond/App-Jing path: /backend/Person/models.py
from django.db import models
from django.contrib.auth.models import User
from Event.models import Event
from University.models import University
from django.core.validators import validate_email
<|fim_suffix|> user = models.ForeignKey(
... | code_fim | medium | {
"lang": "python",
"repo": "jsimmond/App-Jing",
"path": "/backend/Person/models.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> person = models.ForeignKey(Person, on_delete=models.CASCADE)
code = models.IntegerField()
expiration_date = models.DateTimeField()
def __str__(self):
return f'{self.person} - {self.code} -- {self.expiration_date}'<|fim_prefix|># repo: jsimmond/App-Jing path: /backend/Person/model... | code_fim | hard | {
"lang": "python",
"repo": "jsimmond/App-Jing",
"path": "/backend/Person/models.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: yoshteam/hashcode2013 path: /second-day/sergey.py
# hi :)
import numpy as np
import random
from copy import deepcopy
# initialization....
# see also prepare.sh
header = np.loadtxt("header.txt", dtype=int)
TIME = header[2]
CARS = header[3]
STARTPOINT = header[4]
GRAPH = np.loadtxt("links.... | code_fim | hard | {
"lang": "python",
"repo": "yoshteam/hashcode2013",
"path": "/second-day/sergey.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|># the main code
def best_neighbour(current_node, current_cost):
# fix
neighbours = VOIS[current_node]
# filter very costly
good_neighbours_indexes = []
for n in range(len(neighbours)):
if current_cost + TPS[current_node][n] <= TIME:
good_neighbours_indexes... | code_fim | hard | {
"lang": "python",
"repo": "yoshteam/hashcode2013",
"path": "/second-day/sergey.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Return the sound file.
return send_file('converted_text.mp3', mimetype='audio/mpeg')
# Get suggestions for words that the user typed in.
@app.route('/get_suggestion', methods=['GET','POST'])
def get_suggestion():
# Raise an exception if the required parameters are not specified.
if "words" not in r... | code_fim | hard | {
"lang": "python",
"repo": "KelvinKKLin/MEC-2018",
"path": "/backend/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> # Extract the required information from the request body.
text = request.values['text']
to_number = request.values['to']
# Set up the account credentials - in a production project, this would be placed in a "secrets" file.
account_sid = "ACbbd2cff98bcbbad08f76b03701a0f2d9"
auth_token = "7d786ff14c... | code_fim | hard | {
"lang": "python",
"repo": "KelvinKKLin/MEC-2018",
"path": "/backend/main.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: KelvinKKLin/MEC-2018 path: /backend/main.py
from flask import Flask, jsonify, request, send_file, render_template
from flask_cors import CORS
from twilio.rest import Client
import autocomplete
from gtts import gTTS
import os
# Set up the model.
autocomplete.load()
app = Flask(__name__)
CORS(app)... | code_fim | hard | {
"lang": "python",
"repo": "KelvinKKLin/MEC-2018",
"path": "/backend/main.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> asciilist = ""
server_count = 0
for server in servers:
try:
entry = server['ip'] + ':' + str(server['port']) + ' ' # ip:port
entry += 'local ' if server['remote'] == 0 else 'mirror ' # 'local' or 'mirror'
entry += 'publ... | code_fim | hard | {
"lang": "python",
"repo": "stijnstijn/j2lsnek",
"path": "/handlers/asciilist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.cleanup()
servers = fetch_all(
"SELECT * FROM servers WHERE max > 0 ORDER BY prefer DESC, private ASC, (players = max) ASC, players DESC, created ASC")
asciilist = ""
server_count = 0
for server in servers:
try:
entry =... | code_fim | hard | {
"lang": "python",
"repo": "stijnstijn/j2lsnek",
"path": "/handlers/asciilist.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: stijnstijn/j2lsnek path: /handlers/asciilist.py
import time
from helpers.handler import port_handler
from helpers.functions import fetch_all
class ascii_handler(port_handler):
"""
Serve ASCII server list
"""
<|fim_suffix|> asciilist = ""
server_count = 0
fo... | code_fim | hard | {
"lang": "python",
"repo": "stijnstijn/j2lsnek",
"path": "/handlers/asciilist.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> f = open(filename, 'w')
f.write('')
f.close()
col = dimension[0]
row = dimension[1]
s = ''
# write new file
with open(filename, 'w', encoding='ISO-8859-1') as file:
header[0] = 'P2\n'
for h in header:
# decoding
s += h
for i... | code_fim | hard | {
"lang": "python",
"repo": "aunpyz/ImageProcessing2017-2",
"path": "/ImageProcessing/ImgReader.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: aunpyz/ImageProcessing2017-2 path: /ImageProcessing/ImgReader.py
import re
import numpy as np
# only read pgm file
def readfile(filename:str)->tuple:
'''read given pgm file'''
col = 0
row = 0
lst = list()
with open(filename, 'rb') as file:
header = list()
ls =... | code_fim | hard | {
"lang": "python",
"repo": "aunpyz/ImageProcessing2017-2",
"path": "/ImageProcessing/ImgReader.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def getWater(self) -> int:
pass
def setWater(self, water: int) -> None:
pass
def getMilk(self) -> int:
return self.__milk
def setMilk(self, milk: int) -> None:
self.__milk = milk
def getBlackTea(self) -> int:
return self.__blackTea
def s... | code_fim | hard | {
"lang": "python",
"repo": "bamin0422/kakao-cafe",
"path": "/com/kakao/cafe/menu/tea/matchaMilkTea.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> def setName(self, name: str) -> None:
self.name = name
def getPrice(self) -> int:
return self.__price
def setPrice(self, price: int) -> None:
self.__price = price
def isIced(self) -> bool:
return self.iced
def setIced(self, iced: bool) -> None:
... | code_fim | medium | {
"lang": "python",
"repo": "bamin0422/kakao-cafe",
"path": "/com/kakao/cafe/menu/tea/matchaMilkTea.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: bamin0422/kakao-cafe path: /com/kakao/cafe/menu/tea/matchaMilkTea.py
from com.kakao.cafe.menu.tea.milkTea import MilkTea
class MatchaMilkTea(MilkTea):
def __init__(self):
super().__init__()
self.__matcha = 1
self.__condensedMilk = 1
self.name = "MatchaMilkTe... | code_fim | hard | {
"lang": "python",
"repo": "bamin0422/kakao-cafe",
"path": "/com/kakao/cafe/menu/tea/matchaMilkTea.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> list_filter = ("next_run", "schedule_type", "cluster")
search_fields = ("func",)
list_display_links = ("id", "name")
class QueueAdmin(admin.ModelAdmin):
"""queue admin for ORM broker"""
list_display = ("id", "key", "task_id", "name", "func", "lock")
def save_model(self, request... | code_fim | hard | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: Javedgouri/django-q path: /django_q/admin.py
"""Admin module for Django."""
from django.contrib import admin
from django.utils.translation import gettext_lazy as _
from django_q.conf import Conf, croniter
from django_q.models import Failure, OrmQ, Schedule, Success
from django_q.tasks import asy... | code_fim | hard | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/admin.py",
"mode": "psm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> """Don't allow adds."""
return False
actions = [retry_failed]
search_fields = ("name", "func")
list_filter = ("group",)
readonly_fields = []
def get_readonly_fields(self, request, obj=None):
"""Set all fields readonly."""
return list(self.readonly_fiel... | code_fim | hard | {
"lang": "python",
"repo": "Javedgouri/django-q",
"path": "/django_q/admin.py",
"mode": "spm",
"license": "MIT",
"source": "the-stack-v2"
} |
<|fim_suffix|> # disconnect signals for this request
# runs even if change logging is disabled in case it was disabled after the signal was created
signals.audit_presave.disconnect(dispatch_uid=(settings.DISPATCH_UID, request,))
return response
def pre_action_handler(self, sender, m... | code_fim | hard | {
"lang": "python",
"repo": "blueprinthealth/django-auditlog",
"path": "/auditlog/middleware.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|> return response
def pre_action_handler(self, sender, model_instance, audit_meta, update_kwargs=None, **kwargs):
if audit_meta and getattr(audit_meta, 'audit') and update_kwargs is not None:
audit_meta.update_additional_kwargs(update_kwargs)<|fim_prefix|># repo: blueprinthe... | code_fim | hard | {
"lang": "python",
"repo": "blueprinthealth/django-auditlog",
"path": "/auditlog/middleware.py",
"mode": "spm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: blueprinthealth/django-auditlog path: /auditlog/middleware.py
from __future__ import unicode_literals
from functools import partial
from django.contrib.auth import get_user_model
from .default_settings import settings
from . import signals
class AuditMiddleware(object):
"""
middleware... | code_fim | hard | {
"lang": "python",
"repo": "blueprinthealth/django-auditlog",
"path": "/auditlog/middleware.py",
"mode": "psm",
"license": "BSD-2-Clause",
"source": "the-stack-v2"
} |
<|fim_suffix|>class UploadView(TemplateView):
template_name = 'budget/upload.html'
def get(self, request):
form = UploadFileForm()
return render(request, self.template_name, {'form': form})
def post(self, request):
if request.method == 'POST':
form = UploadFileForm(requ... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderPR/Webb",
"path": "/mysite/budget/views.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: AlexanderPR/Webb path: /mysite/budget/views.py
from django.shortcuts import render, HttpResponse
from django.views.generic import TemplateView
from .models import Person, Stock_history
from django.http import Http404, HttpResponseRedirect
from .forms import NameForm, UploadFileForm
from .back im... | code_fim | hard | {
"lang": "python",
"repo": "AlexanderPR/Webb",
"path": "/mysite/budget/views.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: lctagnes/AI_Learning123 path: /src/NLP/useful_point/stop_word.py
# 出现频率特别高的和频率特别低的词对于文本分析帮助不大,一般在预处理阶段会过滤掉。
# 在英文里,经典的停用词为 “The”, "an"....
# 方法1: 自己建立一个停用词词典
stop_words = ["the", "an", "is", "there"]
# 在使用时: 假设 word_list包含了文本里的单词
word_list = ["we", "are", "the", "students"]
filtered_word... | code_fim | medium | {
"lang": "python",
"repo": "lctagnes/AI_Learning123",
"path": "/src/NLP/useful_point/stop_word.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>test_strs = ['caresses', 'flies', 'dies', 'mules', 'denied',
'died', 'agreed', 'owned', 'humbled', 'sized',
'meeting', 'stating', 'siezing', 'itemization',
'sensational', 'traditional', 'reference', 'colonizer',
'plotted']
singles = [stemmer.stem(word) for word i... | code_fim | medium | {
"lang": "python",
"repo": "lctagnes/AI_Learning123",
"path": "/src/NLP/useful_point/stop_word.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: JamesMax314/FPM_Code path: /C++/build/objects.py
import numpy as np
import cv2 as cv
import methods as meth
from numpy.fft import fft2, fftshift, ifft2, ifftshift
import pandas
import os
import noGPU as h
import matplotlib.pyplot as plt
class fullSys():
def __init__(self, dir, file, size, li... | code_fim | hard | {
"lang": "python",
"repo": "JamesMax314/FPM_Code",
"path": "/C++/build/objects.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
def getDevisor(self, splitSize):
imgName = self.images[0]
img = self.readImage(self.dir, imgName)
imgSize = img.shape[0]
while True:
if imgSize % splitSize == 0:
devisor = splitSize
break
splitSize += 1
n... | code_fim | hard | {
"lang": "python",
"repo": "JamesMax314/FPM_Code",
"path": "/C++/build/objects.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
print("----------验证二维互相关运算的结果--------------")
X = tf.constant([[0,1,2], [3,4,5], [6,7,8]])
K = tf.constant([[0,1], [2,3]])
"""
<tf.Variable 'Variable:0' shape=(2, 2) dtype=float32, numpy=
array([[19., 25.],
[37., 43.]], dtype=float32)>
"""
print(corr2d(X, K))<|fim_prefix|># repo: shengqianfeng/dee... | code_fim | hard | {
"lang": "python",
"repo": "shengqianfeng/deeplearning",
"path": "/pystudy/deep_learning/hands_book/conv_tensorflow/corr2d.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: shengqianfeng/deeplearning path: /pystudy/deep_learning/hands_book/conv_tensorflow/corr2d.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@File : corr2d.py
@Author : jeffsheng
@Date : 2020/1/3
@Desc : 卷积层中的互相关(cross-correlation)运算
卷积层需要学习的参数是:卷积核和偏置大小
"""
import tensorflow as tf
def corr... | code_fim | hard | {
"lang": "python",
"repo": "shengqianfeng/deeplearning",
"path": "/pystudy/deep_learning/hands_book/conv_tensorflow/corr2d.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>print(max(d1.values()))
print(min(d1.values()))<|fim_prefix|># repo: vaishakh183/mypython-codes path: /venv/My programs/Exercises/Exercise23.py
#Write a Python program to get the maximum and minimum value in a dictionary.
<|fim_middle|>d1={6: 10, 2: 20, 5: 30, 4: 40, 1: 50, 3: 60}
| code_fim | easy | {
"lang": "python",
"repo": "vaishakh183/mypython-codes",
"path": "/venv/My programs/Exercises/Exercise23.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vaishakh183/mypython-codes path: /venv/My programs/Exercises/Exercise23.py
#Write a Python program to get the maximum and minimum value in a dictionary.
<|fim_suffix|>print(max(d1.values()))
print(min(d1.values()))<|fim_middle|>d1={6: 10, 2: 20, 5: 30, 4: 40, 1: 50, 3: 60}
| code_fim | easy | {
"lang": "python",
"repo": "vaishakh183/mypython-codes",
"path": "/venv/My programs/Exercises/Exercise23.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> Q = 0.7*p/b**0.57/sqrt(cos(chi))
if Q > 1:
A = 1
else:
A = Q
return A*b**2/p**2*sin(chi)*cos(chi)
P0 = 0.3
Pend = 1
B12 = 4
dx = 0.0001
for i in range(450):
xi0 = i/5 + 0.1
x0 = pi/180*xi0
P = P0
x = x0
while 0.7*P/B12**0.57/sqrt(cos(x)... | code_fim | hard | {
"lang": "python",
"repo": "IstominArseniy/Pulsars",
"path": "/PPdot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: IstominArseniy/Pulsars path: /PPdot.py
import numpy as np
import matplotlib.pyplot as plt
from math import *
from scipy.integrate import *
from pylab import *
from scipy.integrate import quad
MHD = np.zeros((80, 90, 5), dtype=float)
BGI = np.zeros((80, 90, 5), dtype=float)
Fp = np.z... | code_fim | hard | {
"lang": "python",
"repo": "IstominArseniy/Pulsars",
"path": "/PPdot.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>
#fig, ax = plt.subplots()
#x = np.linspace(0, 1)
#plt.xlim(0.0001, 1.0)
#plt.ylim(0, 0.1)
#plt.plot(x, x**2*(cos(ch)*(1 - x**2) + 1/2*sin(ch)*(x - x**3))**3, label="fitting")
#plt.title(''+str(PSR)+', $n_{\pm}$ (P = '+str(P)+', $B_{12}$ = '+str(B12)+', $\chi$ = '+str(chi)+'$^{\circ}$), $\lambda = 9... | code_fim | hard | {
"lang": "python",
"repo": "IstominArseniy/Pulsars",
"path": "/PPdot.py",
"mode": "spm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|> def read_key_args(self):
self.link_level_policy = self.args.pop('link_level_policy')
def wizard_mode_input_args(self):
self.args['link_level_policy'] = input_key_args()
if not self.delete:
self.args['optional_args'] = input_optional_args()
def delete_mo(se... | code_fim | hard | {
"lang": "python",
"repo": "baronschon/ACI",
"path": "/configuration-python/generic_code/apicPython/createLinkLevelPolicy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: baronschon/ACI path: /configuration-python/generic_code/apicPython/createLinkLevelPolicy.py
from cobra.model.fabric import HIfPol
from createMo import *
DEFAULT_AUTO_NEGOTIATION = 'on'
DEFAULT_SPEED = '10G'
DEFAULT_LINK_DEBOUNCE_INTERVAL = 100
AUTO_NEGOTIATION_CHOICES = ['on', 'off']
SPEED_CHO... | code_fim | medium | {
"lang": "python",
"repo": "baronschon/ACI",
"path": "/configuration-python/generic_code/apicPython/createLinkLevelPolicy.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> self.check_if_mo_exist('uni/infra/hintfpol-', self.link_level_policy, HIfPol, description='Link Level Policy')
super(CreateLinkLevelPolicy, self).delete_mo()
def main_function(self):
# Query to parent
self.look_up_mo('uni/infra/', '')
create_link_level_policy(s... | code_fim | hard | {
"lang": "python",
"repo": "baronschon/ACI",
"path": "/configuration-python/generic_code/apicPython/createLinkLevelPolicy.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: rakesh-lagare/Thesis_Work path: /Sax/old/untitled1.py
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 3 17:16:12 2019
@author: Meagatron
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from collections import defaultdict
import math
import itertools
from dtw import dt... | code_fim | hard | {
"lang": "python",
"repo": "rakesh-lagare/Thesis_Work",
"path": "/Sax/old/untitled1.py",
"mode": "psm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_suffix|> if(v1[i] != v1[j]):
row1 = df_dtw_prep.loc[df_dtw_prep['indices'] == v1[i]]
row2 = df_dtw_prep.loc[df_dtw_prep['indices'] == v1[j]]
sub_section1 = row1.iloc[0]['sub_s... | code_fim | hard | {
"lang": "python",
"repo": "rakesh-lagare/Thesis_Work",
"path": "/Sax/old/untitled1.py",
"mode": "spm",
"license": "Apache-2.0",
"source": "the-stack-v2"
} |
<|fim_prefix|># repo: vamshikumar-alt/vamshi path: /chinna.py
import streamlit as st
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
username=st.text_input ("use<|fim_suffix|>pload)
st.write(df.head())
fig = plt.figure()
my = fig.add_subplot(1,1,1)
my.... | code_fim | medium | {
"lang": "python",
"repo": "vamshikumar-alt/vamshi",
"path": "/chinna.py",
"mode": "psm",
"license": "unknown",
"source": "the-stack-v2"
} |
<|fim_suffix|>.length"],df["petal.length"],)
my.set_xlabel("sepal.length")
my.set_ylabel("petal.length")
st.write(fig)<|fim_prefix|># repo: vamshikumar-alt/vamshi path: /chinna.py
import streamlit as st
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
username=st... | code_fim | hard | {
"lang": "python",
"repo": "vamshikumar-alt/vamshi",
"path": "/chinna.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.