text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> # find out user choice and redirect to relevant page. def user_choice(request): df = shuffle_dataframe() # shuffles df books = df book = [] tempo = [] if 'yes_enter' in request.POST: for i in range(6): flag = False while not flag: rand_...
code_fim
hard
{ "lang": "python", "repo": "SOFTWARE-ENGINEERING-CSE343/Book-Worm-App", "path": "/pages_app/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sasankadarbha/dsp path: /otp_m13523468/src/decrypt.py import sys #decrypt function def decrypt_otp(cipher,key): msg = "" #compare length of key and cipher if len(cipher) != len(key): print ("Error!! Cipher and Key are of different lengths.") return msg ...
code_fim
hard
{ "lang": "python", "repo": "sasankadarbha/dsp", "path": "/otp_m13523468/src/decrypt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#opening key.txt key_file = open(keypath,'r') key = key_file.read() print ("Key is: ",key) #opening result.txt msg_file = open("../data/result.txt", "w") #function calling and writing output to a file msg_file.write(decrypt_otp(cipher,key)) #closing result file msg_file.close()<|fim_pre...
code_fim
hard
{ "lang": "python", "repo": "sasankadarbha/dsp", "path": "/otp_m13523468/src/decrypt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CrCliff/psa-dataset path: /ecs/invoke.py from typing import Dict, Tuple import boto3 import time START=0 STOP=60 SUBNETS = ["subnet-1f26da53", "subnet-47113d21"] SECURITY_GROUPS = ["sg-0ce615b54d6fb23c1"] ECS_CLUSTER = "arn:aws:ecs:us-east-1:027517924056:cluster/psa-process" ECS_TASK_DEFINITION...
code_fim
hard
{ "lang": "python", "repo": "CrCliff/psa-dataset", "path": "/ecs/invoke.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(START, STOP): s3_in, s3_out = s3_urls(i) params = get_params(s3_in, s3_out) resp = ecs.run_task(**params) print(i, resp) if i != 0 and i % 49 == 0: # We can only run 50 tasks concurrently, wait for these to finish ...
code_fim
hard
{ "lang": "python", "repo": "CrCliff/psa-dataset", "path": "/ecs/invoke.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ameliacgraham/hb_challenges path: /reverse_ll.py def reverse_linked_list(head): """Given LL head node, return head node of new, reversed linked list. >>> ll = Node(1, Node(2, Node(3))) >>> reverse_linked_list(ll).as_string() '321' """ <|fim_suffix|> while n: print ...
code_fim
easy
{ "lang": "python", "repo": "ameliacgraham/hb_challenges", "path": "/reverse_ll.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': import doctest if doctest.testmod().failed == 0: print "\n*** ALL TESTS PASSED. GREAT!\n"<|fim_prefix|># repo: ameliacgraham/hb_challenges path: /reverse_ll.py def reverse_linked_list(head): """Given LL head node, return head node of new, reversed linked lis...
code_fim
medium
{ "lang": "python", "repo": "ameliacgraham/hb_challenges", "path": "/reverse_ll.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pdg0709/LeetCode_Python3_Solution path: /数组/59_Spiral_Matrix_II.py # -*- coding:utf-8 -*- # &Author AnFany # 59_Spiral_Matrix_II 螺旋矩阵II class Solution: def generateMatrix(self, n: int) -> List[List[int]]: # 也就是按照右、下、左、上的方向循环放置数字 # 首先新建二维列表,如下形式建立,不可以用[list(range(n)]*n的形式,是...
code_fim
hard
{ "lang": "python", "repo": "pdg0709/LeetCode_Python3_Solution", "path": "/数组/59_Spiral_Matrix_II.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 然后向左填充 while l >= 0 and (c, l) not in fill_dict : spiral_matrix[c][l] = fill_numer # 填充数 fill_numer += 1 # 数加1 fill_sign = 1 # 填充标识符号 fill_dict[(c, l)] = 0 l -= 1 # 列索引减1 if not fill_s...
code_fim
hard
{ "lang": "python", "repo": "pdg0709/LeetCode_Python3_Solution", "path": "/数组/59_Spiral_Matrix_II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 然后向上填充 while c >= 0 and (c, l) not in fill_dict: spiral_matrix[c][l] = fill_numer # 填充数 fill_numer += 1 # 数加1 fill_sign = 1 # 填充标识符号 fill_dict[(c, l)] = 0 c -= 1 # 行索引减1 if not fill_si...
code_fim
hard
{ "lang": "python", "repo": "pdg0709/LeetCode_Python3_Solution", "path": "/数组/59_Spiral_Matrix_II.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class King(Piece): def __init__(self, color, y, x): super().__init__(color, y, x) self.sprite = pygame.image.load("images/{}King.png".format(self.color)) self.sprite = pygame.transform.scale(self.sprite, (50, 50)) self.symbol = "K" self.image.blit(self.sprite, ...
code_fim
hard
{ "lang": "python", "repo": "Zamp98-zz/chessPygame", "path": "/modules/pieces.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Zamp98-zz/chessPygame path: /modules/pieces.py import pygame def captureTile(pieceColor, y, x, board): piece = board.array[y][x] if piece == None: return False else: if piece.color != pieceColor: return True else: return False def mo...
code_fim
hard
{ "lang": "python", "repo": "Zamp98-zz/chessPygame", "path": "/modules/pieces.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Queen(Piece): def __init__(self, color, y, x): super().__init__(color, y, x) self.sprite = pygame.image.load( "images/{}Queen.png".format(self.color)) self.sprite = pygame.transform.scale(self.sprite, (50, 50)) self.symbol = "Q" self.image.blit...
code_fim
hard
{ "lang": "python", "repo": "Zamp98-zz/chessPygame", "path": "/modules/pieces.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: buelmanager/python_edu path: /level2/day7_3.py # 파일출력 ## 쓰기 # score_file = open("score.txt", "w", encoding="utf8") # print("수학 : 0", file=score_file) # print("영어 : 10", file=score_file) # score_file.close() <|fim_suffix|>score_file.close(); ## 읽기 반복문으로 읽기 score_file = open("score.txt", "r", e...
code_fim
hard
{ "lang": "python", "repo": "buelmanager/python_edu", "path": "/level2/day7_3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>## 읽기 모두 score_file = open("score.txt", "r", encoding="utf8") print(score_file.read()) score_file.close(); ## 읽기 한줄 score_file = open("score.txt", "r", encoding="utf8") print(score_file.readline()) print(score_file.readline()) print(score_file.readline()) print(score_file.readline()) score_file.close();...
code_fim
medium
{ "lang": "python", "repo": "buelmanager/python_edu", "path": "/level2/day7_3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mathesh099/Arithmetic-Exam-Application path: /Arithmetic Exam Application/Stage-3.py import random mark = 0 Input = 0 for _ in range(5): operations = [" + ", " - ", " * "] question = str(random.randint(2, 9)) + random.choice(operations) + str(random.randint(2, 9)) print(question) ...
code_fim
medium
{ "lang": "python", "repo": "Mathesh099/Arithmetic-Exam-Application", "path": "/Arithmetic Exam Application/Stage-3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> break except ValueError: print("Incorrect format.") continue print("Your mark is {}/5.".format(mark))<|fim_prefix|># repo: Mathesh099/Arithmetic-Exam-Application path: /Arithmetic Exam Application/Stage-3.py import random mark = 0 Input = 0 for _ in range(5): o...
code_fim
medium
{ "lang": "python", "repo": "Mathesh099/Arithmetic-Exam-Application", "path": "/Arithmetic Exam Application/Stage-3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tmuweh/tutorial.py path: /make_shirt.py """Make a shirt for""" def make_shirt(t_size, message): <|fim_suffix|> print(summary) make_shirt("XL", "I Love Python") make_shirt(message ="I love Python 3", t_size = "M")<|fim_middle|> summary = "Size: " + t_size + "; message: " + message + "!"
code_fim
medium
{ "lang": "python", "repo": "tmuweh/tutorial.py", "path": "/make_shirt.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(summary) make_shirt("XL", "I Love Python") make_shirt(message ="I love Python 3", t_size = "M")<|fim_prefix|># repo: tmuweh/tutorial.py path: /make_shirt.py """Make a shirt for""" def make_shirt(t_size, message): <|fim_middle|> summary = "Size: " + t_size + "; message: " + message + "!"
code_fim
medium
{ "lang": "python", "repo": "tmuweh/tutorial.py", "path": "/make_shirt.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pankhuri-52/Machine-Learning-with-Foxmula path: /PythonPrograms/add_2_numbers.py # -*- coding: utf-8 -*- ''' Created on Sat Jun 1 22:47:51 2019 @author: Pankhuri Trikha ''' #single line comment <|fim_suffix|>weight=int(input('Enter the weight of fuel')) height=int(input('Enter the height of fu...
code_fim
medium
{ "lang": "python", "repo": "pankhuri-52/Machine-Learning-with-Foxmula", "path": "/PythonPrograms/add_2_numbers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>weight=int(input('Enter the weight of fuel')) height=int(input('Enter the height of fuel')) height=height/100; bmi=weight/(height*height) print(bmi) if bmi<25: print('You do hard work,eat well and sleep well, that life') print('get a job at sweet shop') elif bmi>25 and bmi<30: print('you are f...
code_fim
medium
{ "lang": "python", "repo": "pankhuri-52/Machine-Learning-with-Foxmula", "path": "/PythonPrograms/add_2_numbers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: l3n0nr/dev_ksp path: /Python/kerbal/falkinho/boostback_burn.py #!/usr/bin/env python # import module import sys sys.path.insert(0, '../') from base import boostback <|fim_suffix|> ######################################################################### # X Value Profile Weight # ##...
code_fim
medium
{ "lang": "python", "repo": "l3n0nr/dev_ksp", "path": "/Python/kerbal/falkinho/boostback_burn.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ######################################################################### # X Value Profile Weight # ######################################################################### # value = -90 # deorbit garra IIII - +/- 07.125 kg # value = -115 # dragao capsula II - +/- 12.300 kg ...
code_fim
medium
{ "lang": "python", "repo": "l3n0nr/dev_ksp", "path": "/Python/kerbal/falkinho/boostback_burn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: StanislavDanilov/vk_photo path: /vk_photo.py import requests import vk_api from vk_api.longpoll import VkLongPoll, VkEventType from vk_api import VkUpload vk_session = vk_api.VkApi(token='c05dfc0e6bc4911809c7d06f5d497a4bfb587e64839f3aaf36c532c121e682b86cf41332e6f5aedc4aa7f') attachments = []...
code_fim
hard
{ "lang": "python", "repo": "StanislavDanilov/vk_photo", "path": "/vk_photo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> user_id=event.user_id, attachment=','.join(attachments), message='Ваш текст' ) elif event.from_chat: vk.messages.send( chat_id=event.chat_id, message='Ваш текст')...
code_fim
hard
{ "lang": "python", "repo": "StanislavDanilov/vk_photo", "path": "/vk_photo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamesjakeies/python-api-tesing path: /selenium_examples/ch5/copy_google_dirive_files_firefox.py #!/usr/bin/python3 # -*- coding: utf-8 -*- # 讨论钉钉免费群21745728 qq群144081101 567351477 # CreateDate: 2018-10-20 import time from selenium import webdriver from selenium.webdriver.common.action_chains impo...
code_fim
hard
{ "lang": "python", "repo": "jamesjakeies/python-api-tesing", "path": "/selenium_examples/ch5/copy_google_dirive_files_firefox.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>element = driver.find_element_by_class_name("l-u-Ab-zb-Pn-ve") ActionChains(driver).context_click(element).send_keys(Keys.DOWN,Keys.DOWN,Keys.DOWN,Keys.DOWN,Keys.DOWN,Keys.DOWN,Keys.ENTER).perform() input('Press ENTER to close the automated browser') driver.quit()<|fim_prefix|># repo: jamesjakeies/python...
code_fim
hard
{ "lang": "python", "repo": "jamesjakeies/python-api-tesing", "path": "/selenium_examples/ch5/copy_google_dirive_files_firefox.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattsteinpreis/hr path: /Contests/WeekOfCode27/DrawingBook.py def min_turns(n, k): ''' Naive solution: check both ways, pick lowest :param n: int, number of pages in book :param k: int, desired page number :return: int, minimum number of page turns ''' n = n + 1 if n ...
code_fim
medium
{ "lang": "python", "repo": "mattsteinpreis/hr", "path": "/Contests/WeekOfCode27/DrawingBook.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> n = int(input()) k = int(input()) print(min_turns(n, k)) if __name__ == '__main__': hackerrank()<|fim_prefix|># repo: mattsteinpreis/hr path: /Contests/WeekOfCode27/DrawingBook.py def min_turns(n, k): ''' Naive solution: check both ways, pick lowest :param n: int, number of...
code_fim
hard
{ "lang": "python", "repo": "mattsteinpreis/hr", "path": "/Contests/WeekOfCode27/DrawingBook.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vlad9913/ManagementApplication_Server path: /repository/project_technology_repository.py class ProjectTechnologyRepository: def getAll(self): from domain.project_technology import Project_Technology pt = Project_Technology.query.all() return pt <|fim_suffix|> ...
code_fim
medium
{ "lang": "python", "repo": "vlad9913/ManagementApplication_Server", "path": "/repository/project_technology_repository.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def remove(self, project_tech): from controller import db db.session.delete(project_tech) db.session.commit()<|fim_prefix|># repo: vlad9913/ManagementApplication_Server path: /repository/project_technology_repository.py class ProjectTechnologyRepository: def getAll(sel...
code_fim
hard
{ "lang": "python", "repo": "vlad9913/ManagementApplication_Server", "path": "/repository/project_technology_repository.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from domain.project_technology import Project_Technology pt = Project_Technology.query.filter(Project_Technology.project_id == projectId).all() return pt def getAllForTechnology(self, techId): from domain.project_technology import Project_Technology p...
code_fim
hard
{ "lang": "python", "repo": "vlad9913/ManagementApplication_Server", "path": "/repository/project_technology_repository.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> six("hello",-1,"deadbeef") #gdb.attach(p) p.interactive()<|fim_prefix|># repo: De4dCr0w/ctf-pwn path: /护网杯/huwang/huwang-exp1.py from pwn import * context.log_level = 'debug' p = process("./huwang") def six(name,rounds,secret): <|fim_middle|> p.recvuntil("command>>") p.sendline("666") p.recvunt...
code_fim
hard
{ "lang": "python", "repo": "De4dCr0w/ctf-pwn", "path": "/护网杯/huwang/huwang-exp1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: De4dCr0w/ctf-pwn path: /护网杯/huwang/huwang-exp1.py from pwn import * context.log_level = 'debug' p = process("./huwang") def six(name,rounds,secret): <|fim_suffix|> six("hello",-1,"deadbeef") #gdb.attach(p) p.interactive()<|fim_middle|> p.recvuntil("command>>") p.sendline("666") p.recvunt...
code_fim
hard
{ "lang": "python", "repo": "De4dCr0w/ctf-pwn", "path": "/护网杯/huwang/huwang-exp1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _fit_thetas(self, raw_thetas, malm_integrals): thetas = np.array(raw_thetas) thetas[:-1] = np.array([malm_integrals[-1]/Mi * p for Mi, p in zip(malm_integrals[:-1], raw_thetas[:-1])]) return thetas def _integrate_malmquist(self, malm_pars, q0, q1): ...
code_fim
hard
{ "lang": "python", "repo": "kgullikson88/BinaryInference", "path": "/MassRatioDistribution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kgullikson88/BinaryInference path: /MassRatioDistribution.py An iterable of any size The iterable should parameterize a function f(q) = malm_pars[0] + q*malm_pars[1] + q^2 * malm_pars[2] + ... such that the probability ...
code_fim
hard
{ "lang": "python", "repo": "kgullikson88/BinaryInference", "path": "/MassRatioDistribution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kgullikson88/BinaryInference path: /MassRatioDistribution.py _gamma + self.ln_completeness - self.lnp summation = np.nanmean(np.exp(ln_summand[self.good_idx]), axis=1) return np.sum(np.log(summation)) - self.integral_fcn(f_bin, gamma, malm_pars=self.malm_pars, Pobs=self.Pobs) ...
code_fim
hard
{ "lang": "python", "repo": "kgullikson88/BinaryInference", "path": "/MassRatioDistribution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stjordanis/cuIBM path: /examples/flapping/Re75/scripts/plotVorticity.py """ Plots the vorticity field of a 2D cuIBM simulation. """ import os from snake.cuibm.simulation import CuIBMSimulation from snake.body import Body <|fim_suffix|>for time_step in simulation.get_time_steps(): body = Body...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/cuIBM", "path": "/examples/flapping/Re75/scripts/plotVorticity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for time_step in simulation.get_time_steps(): body = Body(file_path=os.path.join('{:0>7}'.format(time_step), 'bodies')) simulation.read_fields('vorticity', time_step) simulation.plot_contour('vorticity', field_range=(-20.0, 20.0, 20), filled_contou...
code_fim
hard
{ "lang": "python", "repo": "stjordanis/cuIBM", "path": "/examples/flapping/Re75/scripts/plotVorticity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amarlokman110/Data-Scientist-with-Python-datacamp- path: /09 Foundations of Predictive Analytics in Python (Part 1)/01 Building Logistic Regression Models/05-making-predictions.py # Fit a logistic regression model from sklearn import linear_model X = basetable[["age","gender_F","time_since_last_g...
code_fim
medium
{ "lang": "python", "repo": "amarlokman110/Data-Scientist-with-Python-datacamp-", "path": "/09 Foundations of Predictive Analytics in Python (Part 1)/01 Building Logistic Regression Models/05-making-predictions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Make a prediction for each observation in new_data and assign it to predictions predictions = logreg.predict_proba(new_data) print(predictions[0:5])<|fim_prefix|># repo: amarlokman110/Data-Scientist-with-Python-datacamp- path: /09 Foundations of Predictive Analytics in Python (Part 1)/01 Building Logis...
code_fim
medium
{ "lang": "python", "repo": "amarlokman110/Data-Scientist-with-Python-datacamp-", "path": "/09 Foundations of Predictive Analytics in Python (Part 1)/01 Building Logistic Regression Models/05-making-predictions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>num_int = 100 print("Before modification {}".format(num_int)) modifyInt(num_int) print("After modification {}".format(num_int)) num_float = 100.5 print("Before modification {}".format(num_float)) modifyFloat(num_float) print("After modification {}".format(num_float)) var_string = "original" print("Befo...
code_fim
medium
{ "lang": "python", "repo": "nammo123/python_tutorial", "path": "/Class11/function_call_by_value_and_reference.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>var_list = [1,2,3,4,5] print("Before modification {}".format(var_list)) modifyList(var_list) print("After modification {}".format(var_list)) var_dict = {1:"abc", 2: "xyz"} print("Before modification {}".format(var_dict)) modifyDict(var_dict) print("After modification {}".format(var_dict))<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "nammo123/python_tutorial", "path": "/Class11/function_call_by_value_and_reference.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: nammo123/python_tutorial path: /Class11/function_call_by_value_and_reference.py def modifyInt(a): print(a) a = 10 print(a) def modifyFloat(b): b = 10.5 def modifyString(c): c = "modified" def modifyList(l): <|fim_suffix|>var_list = [1,2,3,4,5] print("Before modification {}"...
code_fim
hard
{ "lang": "python", "repo": "nammo123/python_tutorial", "path": "/Class11/function_call_by_value_and_reference.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: coosoti/ret-trip path: /src/migrations/0010_auto_20211026_1925.py # Generated by Django 3.1.3 on 2021-10-26 19:25 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AddField( model_name='task', ...
code_fim
hard
{ "lang": "python", "repo": "coosoti/ret-trip", "path": "/src/migrations/0010_auto_20211026_1925.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='task', name='delivered_at', field=models.DateTimeField(blank=True, null=True), ), migrations.AddField( model_name='task', name='delivery_photo', field=models....
code_fim
hard
{ "lang": "python", "repo": "coosoti/ret-trip", "path": "/src/migrations/0010_auto_20211026_1925.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pusateri/vsd path: /webapp/ui/admin.py from library.ui.models import Media, Resource, Fileinfo, Screening from django.contrib import admin class ResourceAdmin(admin.ModelAdmin): list_per_page = 500 list_display = ('id', 'title', 'duration') search_fields = ('id', 'title', 'subject', ...
code_fim
medium
{ "lang": "python", "repo": "pusateri/vsd", "path": "/webapp/ui/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class FileinfoAdmin(admin.ModelAdmin): list_per_page = 500 list_display = ('id', 'secs', 'filename') search_fields = ('filename',) class ScreeningAdmin(admin.ModelAdmin): list_per_page = 500 list_display = ('timestamp', 'user', 'media') search_fields = ('user__username', 'media__t...
code_fim
hard
{ "lang": "python", "repo": "pusateri/vsd", "path": "/webapp/ui/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: handsomeAQ/beautiful-palm-trees path: /game1/Ball.py import pygame, sys from pygame.locals import * pygame.init() icon = pygame.image.load("tb01.png") size = width, height = 1000, 600 FPS = 200 #设置帧数的方法 fclock = pygame.time.Clock() speed = [4,1] Black = 0,0,0 still = False #设置游戏的分辨率 ...
code_fim
hard
{ "lang": "python", "repo": "handsomeAQ/beautiful-palm-trees", "path": "/game1/Ball.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if pygame.display.get_active() : ballrect = ballrect.move(speed[0],speed[1]) if ballrect.left < 0 or ballrect.right > width: speed[0] = - speed[0] if ballrect.right > width and ballrect.right+speed[0] > ballrect.right: speed[0] = - speed[0] if ballrect...
code_fim
hard
{ "lang": "python", "repo": "handsomeAQ/beautiful-palm-trees", "path": "/game1/Ball.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: iamlab-cmu/stable-baselines path: /stable_baselines_custom/td3/__init__.py from stable_baselines_custom.common.noise import NormalActio<|fim_suffix|>ustom.td3.td3 import TD3 from stable_baselines_custom.td3.policies import MlpPolicy, CnnPolicy, LnMlpPolicy, LnCnnPolicy<|fim_middle|>nNoise, Ornste...
code_fim
medium
{ "lang": "python", "repo": "iamlab-cmu/stable-baselines", "path": "/stable_baselines_custom/td3/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>licies import MlpPolicy, CnnPolicy, LnMlpPolicy, LnCnnPolicy<|fim_prefix|># repo: iamlab-cmu/stable-baselines path: /stable_baselines_custom/td3/__init__.py from stable_baselines_custom.common.noise import NormalActionNoise, OrnsteinUhlenbeckActionNoise from stable_baselines_c<|fim_middle|>ustom.td3.td3 ...
code_fim
medium
{ "lang": "python", "repo": "iamlab-cmu/stable-baselines", "path": "/stable_baselines_custom/td3/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pipe_ord.fit(x_train, y_train) print(f"accuracy = {pipe_ord.score(x_test, y_test):.4f}")<|fim_prefix|># repo: TheDataGirl/vaccinated_classifier path: /random_forest.py from category_encoders import OrdinalEncoder from sklearn.impute import SimpleImputer from sklearn.ensemble import RandomForestClassifier...
code_fim
hard
{ "lang": "python", "repo": "TheDataGirl/vaccinated_classifier", "path": "/random_forest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheDataGirl/vaccinated_classifier path: /random_forest.py from category_encoders import OrdinalEncoder from sklearn.impute import SimpleImputer from sklearn.ensemble import RandomForestClassifier from sklearn.pipeline import make_pipeline from preprocesses.preprocess2 import x_train, y_train, x_...
code_fim
hard
{ "lang": "python", "repo": "TheDataGirl/vaccinated_classifier", "path": "/random_forest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pipe_ord = make_pipeline( OrdinalEncoder(), SimpleImputer(), RandomForestClassifier( n_estimators=150, random_state=10, max_depth=15, oob_score=True, n_jobs=-1, criterion="gini", min_samples_split=5, max_features=6 ) ...
code_fim
medium
{ "lang": "python", "repo": "TheDataGirl/vaccinated_classifier", "path": "/random_forest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: psegedy/schemathesis path: /src/schemathesis/cli/context.py import os import shutil from dataclasses import dataclass, field from queue import Queue from typing import List, Optional, Union import hypothesis from ..constants import CodeSampleStyle from ..runner.serialization import SerializedTe...
code_fim
medium
{ "lang": "python", "repo": "psegedy/schemathesis", "path": "/src/schemathesis/cli/context.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> queue: Queue filename: Optional[str] = None @dataclass class ExecutionContext: """Storage for the current context of the execution.""" hypothesis_settings: hypothesis.settings hypothesis_output: List[str] = field(default_factory=list) workers_num: int = 1 rate_limit: Optiona...
code_fim
medium
{ "lang": "python", "repo": "psegedy/schemathesis", "path": "/src/schemathesis/cli/context.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SardarDawar/BorrowStore path: /ecom1/orders/models.py from django.db import models from shop.models import Product from django.dispatch import receiver from django.db.models.signals import post_save from django.contrib.auth.models import User class staff_contractor_company(models.Model):#bana d...
code_fim
medium
{ "lang": "python", "repo": "SardarDawar/BorrowStore", "path": "/ecom1/orders/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: verbose_name_plural='Location' def __str__(self): return self.locatio class history_order(models.Model): user = models.ForeignKey(User,on_delete=models.CASCADE,null = True) item = models.CharField(max_length=200) date = models.DateField(auto_now_add=True) ...
code_fim
medium
{ "lang": "python", "repo": "SardarDawar/BorrowStore", "path": "/ecom1/orders/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global msg choice=input("Enter your selection:\n").upper() if choice=="E": msg=input("Enter the message:\n") menu() elif choice=="V": print("The message is:",msg) menu() elif choice=="L": print("List of files: 42.txt, 1015.txt") ...
code_fim
medium
{ "lang": "python", "repo": "MrHamdulay/csc3-capstone", "path": "/examples/data/Assignment_5/mrnjem001/question1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MrHamdulay/csc3-capstone path: /examples/data/Assignment_5/mrnjem001/question1.py def menu(): choice="none" print("Welcome to UCT BBS\nMENU\n(E)nter a message\n(V)iew message\n(L)ist files\n(D)isplay file\ne(X)it") selection() <|fim_suffix|> global msg choice=i...
code_fim
medium
{ "lang": "python", "repo": "MrHamdulay/csc3-capstone", "path": "/examples/data/Assignment_5/mrnjem001/question1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> period = cms.int32(4096), invert = cms.bool(True), mightGet = cms.optional.untracked.vstring )<|fim_prefix|># repo: cms-sw/cmssw-cfipython path: /HLTrigger/special/hltEventNumberFilter_cfi.py import FWCore.ParameterSet.Config as cms hltEvent<|fim_middle|>NumberFilter = cms.EDFilter('HLTEventNumbe...
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw-cfipython", "path": "/HLTrigger/special/hltEventNumberFilter_cfi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cms-sw/cmssw-cfipython path: /HLTrigger/special/hltEventNumberFilter_cfi.py import FWCore.ParameterSet.Config as cms hltEventNumberFilter = cms.EDFilter('HLTEventNumberFilter',<|fim_suffix|>rue), mightGet = cms.optional.untracked.vstring )<|fim_middle|> period = cms.int32(4096), invert = c...
code_fim
easy
{ "lang": "python", "repo": "cms-sw/cmssw-cfipython", "path": "/HLTrigger/special/hltEventNumberFilter_cfi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @admin.register(File) class FileAdmin(admin.ModelAdmin): list_display = ('id', 'origin_file', 'origin_mime', 'processed_file', 'progress', 'origin_text', 'processed_text')<|fim_prefix|># repo: 2la/KEKTEXT path: /document_processing/admin.py from django.contrib import admin <|fim_middle|>from .model...
code_fim
easy
{ "lang": "python", "repo": "2la/KEKTEXT", "path": "/document_processing/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: 2la/KEKTEXT path: /document_processing/admin.py from django.contrib import admin <|fim_suffix|>@admin.register(File) class FileAdmin(admin.ModelAdmin): list_display = ('id', 'origin_file', 'origin_mime', 'processed_file', 'progress', 'origin_text', 'processed_text')<|fim_middle|>from .models...
code_fim
easy
{ "lang": "python", "repo": "2la/KEKTEXT", "path": "/document_processing/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list_display = ('id', 'origin_file', 'origin_mime', 'processed_file', 'progress', 'origin_text', 'processed_text')<|fim_prefix|># repo: 2la/KEKTEXT path: /document_processing/admin.py from django.contrib import admin from .models import File <|fim_middle|>@admin.register(File) class FileAdmin(admi...
code_fim
easy
{ "lang": "python", "repo": "2la/KEKTEXT", "path": "/document_processing/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # extract 3d pts pts3d_curr = [] pts2d_near_filtered = [] # keep only feature points with depth in the current frame for i, pt2d in enumerate(pts2d_curr): # print(pt2d) u, v = pt2d[0], pt2d[1] z = depth_dilated[v, u] if z > 0: xyz_curr = P_2D_3D(u, v, ...
code_fim
hard
{ "lang": "python", "repo": "bhatiaabhishek/sparse-to-dense.pytorch", "path": "/estimate_pose.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhatiaabhishek/sparse-to-dense.pytorch path: /estimate_pose.py import cv2 import sys import numpy as np import matplotlib.pyplot as plt def P_2D_3D(u,v,d,K): u0 = K[0][2] v0 = K[1][2] fy = K[1][1] fx = K[0][0] x = (u-u0)*d/fx y = (v-v0)*d/fy return (x,y,d) def fea...
code_fim
hard
{ "lang": "python", "repo": "bhatiaabhishek/sparse-to-dense.pytorch", "path": "/estimate_pose.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_pose(rgb,depth,rgb_near,K): rgb_gray = cv2.cvtColor(rgb, cv2.COLOR_RGB2GRAY) rgb_near_gray = cv2.cvtColor(rgb_near, cv2.COLOR_RGB2GRAY) pts2d_curr, pts2d_near = feature_match(rgb_gray,rgb_near_gray) #dilating depth kernel = np.ones((4,4), np.uint8) depth_dilated = cv2.d...
code_fim
hard
{ "lang": "python", "repo": "bhatiaabhishek/sparse-to-dense.pytorch", "path": "/estimate_pose.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> base_question_dir = os.path.join(settings.MEDIA_ROOT, '{0}'.format(self.interview_question.pk)) instance_question_dir = os.path.join(base_question_dir, 'instances/{0}'.format(self.question_instance_pk)) shutil.rmtree(instance_question_dir)<|fim_prefix|># repo: mike2151/encompass p...
code_fim
medium
{ "lang": "python", "repo": "mike2151/encompass", "path": "/submission_result/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mike2151/encompass path: /submission_result/models.py from django.conf import settings import shutil import os from django.db import models class SubmissionResult(models.Model): tests_passed_body = models.TextField(default='') results_body = models.TextField(default='') visability_b...
code_fim
medium
{ "lang": "python", "repo": "mike2151/encompass", "path": "/submission_result/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TugberkArkose/MLScheduler path: /benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_ml/backup_results_unknownr/cmp_omnetpp/power.py 'Execution Unit/Register Files/Floating Point RF/Peak Dynamic': 0.000129532, 'Execution Unit/Register Files/Floating Point RF/Runtime Dynamic': 0.00256...
code_fim
hard
{ "lang": "python", "repo": "TugberkArkose/MLScheduler", "path": "/benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_ml/backup_results_unknownr/cmp_omnetpp/power.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Store Unit/LoadQ/Gate Leakage': 0.00059896, 'Load Store Unit/LoadQ/Peak Dynamic': 0.0213349, 'Load Store Unit/LoadQ/Runtime Dynamic': 0.0213349, 'Load Store Unit/LoadQ/Subthreshold Leakage': 0.00941961, 'Load Store Unit/LoadQ/Subthreshold Leakage with power gati...
code_fim
hard
{ "lang": "python", "repo": "TugberkArkose/MLScheduler", "path": "/benchmarks/SimResults/_bigLittle_hrrs_spec_tugberk_ml/backup_results_unknownr/cmp_omnetpp/power.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def getFloorHex(targets): ''' 根据楼层获取协议hex编码(8个字节) :param targets: :return: ''' floors = [['0'], ['0'], ['0'], ['0'], ['0'], ['0'], ['0'], ['0'] # 1 - 8楼 ,['0'], ['0'], ['0'], ['0'], ['0'], ['0'], ['0'], ['0'] ,['0'], ['0'], ['0'], ['0'], ['0'], ['0'], [...
code_fim
hard
{ "lang": "python", "repo": "lengyue1024/notes", "path": "/Python/practice/door/CommonUtils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lengyue1024/notes path: /Python/practice/door/CommonUtils.py import time def bytesToHex(bins): ''' 把字节数组转换为16进制字符串,不带0x前缀 :param bins: :return: ''' return ''.join([hex(i).replace('0x','').zfill(2).upper() for i in bins]) def hexToBytes(hexStr): ''' 16进制字符串,转换为字节数...
code_fim
hard
{ "lang": "python", "repo": "lengyue1024/notes", "path": "/Python/practice/door/CommonUtils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ''' 获取指定16进制的反码,不包含0x前缀 :param hex_num: :return: ''' if type(num) == str: num = int(num,16) return hex(0xFF - num).replace('0x','').zfill(2).upper() def now(): ''' 获取当前时间字符串 :return: ''' return time.strftime("%Y-%m-%d %H:%M:%S") def getFloorHex(ta...
code_fim
hard
{ "lang": "python", "repo": "lengyue1024/notes", "path": "/Python/practice/door/CommonUtils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>IN = [line for line in open("circles.in")] N = int(IN[0]) def dis(x1, y1, x2, y2): return (x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2) A = [] for i in range(1, N + 1): x1, y1, x2, y2, x3, y3 = [int(x) for x in IN[i].split()] a = dis(x1, y1, x2, y2) b = dis(x1, y1, x3, y3) c = dis(...
code_fim
hard
{ "lang": "python", "repo": "lavandalia/work", "path": "/Yandex Algorithm 2013/Test Round/A/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>A = [] for i in range(1, N + 1): x1, y1, x2, y2, x3, y3 = [int(x) for x in IN[i].split()] a = dis(x1, y1, x2, y2) b = dis(x1, y1, x3, y3) c = dis(x2, y2, x3, y3) cos = b + c - a, 4 * b * c cos = cos[0] * cos[0], cos[1] sin = cos[1] - cos[0], cos[1] R = a * sin[1], sin[0...
code_fim
hard
{ "lang": "python", "repo": "lavandalia/work", "path": "/Yandex Algorithm 2013/Test Round/A/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lavandalia/work path: /Yandex Algorithm 2013/Test Round/A/main.py def cmp_to_key(mycmp): 'Convert a cmp= function into a key= function' class K(object): def __init__(self, obj, *args): self.obj = obj def __lt__(self, other): return mycmp(self.obj, o...
code_fim
hard
{ "lang": "python", "repo": "lavandalia/work", "path": "/Yandex Algorithm 2013/Test Round/A/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: willji/cmd_controller path: /tools/get_nginx.py from salt_act.api import SaltHttp from pyzabbix import ZabbixAPI import os import sys from threading import Thread, activeCount import time reload(sys) sys.setdefaultencoding('utf-8') MASTER = 'saltapi.pro.ymatou.cn' TOKEN = '0cdffd479c53928502c41...
code_fim
hard
{ "lang": "python", "repo": "willji/cmd_controller", "path": "/tools/get_nginx.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_configs(minion, ipaddress): SaltTool(minion, ipaddress).get_configs() fail_ips = [] for ip in ips: while activeCount() > 10: print activeCount() time.sleep(1) Thread(target=get_configs, args=(str(ip.replace('.', '')), str(ip))).start() while True: time.sleep(1) ...
code_fim
hard
{ "lang": "python", "repo": "willji/cmd_controller", "path": "/tools/get_nginx.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(len(array)): if target in array[i]: return 'true' return 'false' while True: try: S = Solution() # 字符串转为list L = list(eval(input())) array = L[1] target = L[0] print(S.Find(target, array)) except: ...
code_fim
hard
{ "lang": "python", "repo": "fsym-fs/Python_AID", "path": "/剑指office/demo01.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fsym-fs/Python_AID path: /剑指office/demo01.py """ 时间限制: C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32M,其他语言64M 热度指数:1521915 本题知识点: 查找 数组 题目描述: 在一个二维数组中(每个一维数组的长度相同), 每一行都按照从左到右递增的顺序排序, 每一列都按照从上到下递增的顺序排序。 请完成一个函数,输入这样的一个二维数组和一个整数,判断数组中是否含有该整数。 """ # -*- coding:utf-8 -*- class Solution: # ...
code_fim
medium
{ "lang": "python", "repo": "fsym-fs/Python_AID", "path": "/剑指office/demo01.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>while True: try: S = Solution() # 字符串转为list L = list(eval(input())) array = L[1] target = L[0] print(S.Find(target, array)) except: break<|fim_prefix|># repo: fsym-fs/Python_AID path: /剑指office/demo01.py """ 时间限制: C/C++ 1秒,其他语言2秒 空间限制:C/...
code_fim
hard
{ "lang": "python", "repo": "fsym-fs/Python_AID", "path": "/剑指office/demo01.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: asymmetry/leetcode path: /0083_remove_duplicates_from_sorted_list/solution_1.py #!/usr/bin/env python3 # Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None def __repr__(self): p = self result = f'{p.v...
code_fim
medium
{ "lang": "python", "repo": "asymmetry/leetcode", "path": "/0083_remove_duplicates_from_sorted_list/solution_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print(Solution().deleteDuplicates(_makeList([1, 1, 2]))) print(Solution().deleteDuplicates(_makeList([1, 1, 2, 3, 3])))<|fim_prefix|># repo: asymmetry/leetcode path: /0083_remove_duplicates_from_sorted_list/solution_1.py #!/usr/bin/env python3 # Definition for singly-...
code_fim
hard
{ "lang": "python", "repo": "asymmetry/leetcode", "path": "/0083_remove_duplicates_from_sorted_list/solution_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vanna011/youtube-dl-streisand path: /youtube_dl/extractor/tiktok.py # coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor class TikTokIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?tiktok.com/@([a-zA-Z0-9\._]+)/video/(?P<id>[0-9]+)' # _VALID_URL...
code_fim
hard
{ "lang": "python", "repo": "Vanna011/youtube-dl-streisand", "path": "/youtube_dl/extractor/tiktok.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> watermarkedVideo = self._download_webpage(watermarkedURL, '') idPosition = watermarkedVideo.index('vid:') try: secretVideoID = watermarkedVideo[idPosition + 4: idPosition + 36] except ValueError: url = watermarkedURL else: url = ...
code_fim
hard
{ "lang": "python", "repo": "Vanna011/youtube-dl-streisand", "path": "/youtube_dl/extractor/tiktok.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>UDP_IP = "0.0.0.0" UDP_PORT = 5005 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind((UDP_IP, UDP_PORT)) while True: data, addr = sock.recvfrom(1024) rcv_timestamp = convert_to_ntp_time(time.time()) packet = NTPPacket() packet.conve...
code_fim
hard
{ "lang": "python", "repo": "thatgeekyperson/NTPServer", "path": "/ntp_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thatgeekyperson/NTPServer path: /ntp_server.py import socket import struct import datetime import time NTP_DELTA = (datetime.date(*time.gmtime(0)[0:3]) - datetime.date(1900, 1, 1)).days * 24 * 60 * 60 def convert_to_ntp_time(timestamp): return timestamp + NTP_DELTA class NTPPacket: _P...
code_fim
hard
{ "lang": "python", "repo": "thatgeekyperson/NTPServer", "path": "/ntp_server.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>while True: data, addr = sock.recvfrom(1024) rcv_timestamp = convert_to_ntp_time(time.time()) packet = NTPPacket() packet.convert_to_obj(data) packet.mode = 4 packet.org_timestamp = packet.xmt_timestamp packet.rcv_timestamp = rcv_timestamp packet.xmt_timestamp = convert_t...
code_fim
hard
{ "lang": "python", "repo": "thatgeekyperson/NTPServer", "path": "/ntp_server.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SumAllFoundation/powerpoetry-twitter-demo path: /pptwitter/tasks.py import logging import os from celery.task.schedules import crontab from celery.task import periodic_task from tweepy import Cursor, TweepError import pptwitter from pptwitter.app import celery # NOQA from pptwitter.app import...
code_fim
hard
{ "lang": "python", "repo": "SumAllFoundation/powerpoetry-twitter-demo", "path": "/pptwitter/tasks.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>@periodic_task(run_every=crontab(minute="*/1")) def poll_twitter(): logger.info("Processing poems...") q = app.config.get("QUERY") count = app.config.get("COUNT") kwargs = dict(q=q, count=count, result_type="recent", lang="en") try: config_since_id = Config.get(Config.name == "...
code_fim
hard
{ "lang": "python", "repo": "SumAllFoundation/powerpoetry-twitter-demo", "path": "/pptwitter/tasks.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> async def prove(self): await self.get_url() if self.base_url: async with ClientSession() as session: for path in self.url_normpath(self.url, ['./php7cms/', './']): postData = { 'data': '<?php phpinfo()?>' ...
code_fim
hard
{ "lang": "python", "repo": "gladiopeace/Tentacle", "path": "/script/php7cms/php7cms_getshell.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gladiopeace/Tentacle path: /script/php7cms/php7cms_getshell.py #!/usr/bin/env python # -*- coding: utf-8 -*- # @author: 'orleven' from lib.utils.connect import ClientSession from lib.core.enums import VUL_LEVEL from lib.core.enums import VUL_TYPE from lib.core.enums import SERVICE_PORT_MAP from ...
code_fim
hard
{ "lang": "python", "repo": "gladiopeace/Tentacle", "path": "/script/php7cms/php7cms_getshell.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lzhw1991/XIBEM path: /BEM3D/Meshes.py xi2=np.asarray(xi2,np.float).reshape(-1,) xb=np.array(xi1);yb=np.ones(xi1.shape);zb=np.array(xi2); xx=xb**2;yy=yb**2;zz=zb**2; dxdxi1 = 1.0*np.sqrt(1.0 - yy/2.0 - zz/2.0 + yy*zz/3.0) dxdxi2 = 1.0*xb*0.5*(1.0 - yy/2.0 -...
code_fim
hard
{ "lang": "python", "repo": "lzhw1991/XIBEM", "path": "/BEM3D/Meshes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lzhw1991/XIBEM path: /BEM3D/Meshes.py 0)**-0.5 * (-xb+2.0*xb*zz/3.0) dydxi2 = 1.0*yb*0.5*(1.0 - xx/2.0 - zz/2.0 + xx*zz/3.0)**-0.5 * (-zb+2.0*xx*zb/3.0) dzdxi1 = 1.0*zb*0.5*(1.0 - xx/2.0 - yy/2.0 + xx*yy/3.0)**-0.5 * (-xb+2.0*xb*yy/3.0) dzdxi2 = 1.0*np.sqrt(1.0 - xx/2.0 - ...
code_fim
hard
{ "lang": "python", "repo": "lzhw1991/XIBEM", "path": "/BEM3D/Meshes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> xi1=np.asarray(xi1,np.float).reshape(-1,) xi2=np.asarray(xi2,np.float).reshape(-1,) xb=np.array(xi1);yb=np.array(xi2);zb=-np.ones(xi1.shape); xx=xb**2;yy=yb**2;zz=zb**2; x = xb*np.sqrt(1.0 - yy/2.0 - zz/2.0 + yy*zz/3.0) y = yb*np.sqrt(1.0 - xx/2.0 - zz/2.0 +...
code_fim
hard
{ "lang": "python", "repo": "lzhw1991/XIBEM", "path": "/BEM3D/Meshes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if pos.y() >= self._origin.y(): self._rect.setBottom(pos.y()) else: self._rect.setTop(pos.y()) self._rect = self._rect.normalized() self.update() return else: super().mouseMoveEvent(event) if ...
code_fim
hard
{ "lang": "python", "repo": "mdalboni/PySide2-Widgets", "path": "/widgets/resizable_rect_item.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mdalboni/PySide2-Widgets path: /widgets/resizable_rect_item.py from PySide2.QtWidgets import * from PySide2.QtCore import * from PySide2.QtGui import * import sys class ResizableRectItem(QGraphicsObject): rectChanged = Signal(QRect) def __init__(self, rect: QRect()): super()._...
code_fim
hard
{ "lang": "python", "repo": "mdalboni/PySide2-Widgets", "path": "/widgets/resizable_rect_item.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }