text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: BrianLTJ/se-project path: /book/category.py ''' Author: Tingjun Li Create Time: 2017-04-10 Function: Find and show book details ''' from django.http import JsonResponse from django.core import serializers, exceptions import json from django.views.decorators.csrf import csrf_exempt, csrf_protect f...
code_fim
hard
{ "lang": "python", "repo": "BrianLTJ/se-project", "path": "/book/category.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> response_data = {} response_data['result'] = 'error' try: tags = Tag.objects.all() respdata = list() for item in tags: tagitem = {} tagitem['id']=item.id tagitem['text']=item.text tagitem['note']=item.note resp...
code_fim
hard
{ "lang": "python", "repo": "BrianLTJ/se-project", "path": "/book/category.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': ExportObjectGroupToFBX('Loop_A') ExportObjectGroupToFBX('Road_A') ExportObjectGroupToFBX('Road_B') ExportObjectGroupToFBX('Road_C') ExportObjectGroupToFBX('Road_D') ExportObjectGroupToFBX('Road_E') ExportObjectGroupToFBX('Road_Building_01')<|fim_prefi...
code_fim
medium
{ "lang": "python", "repo": "purpl3grape/Blender-Scripting", "path": "/BL_BatchSelectedExporter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if(ob.name.startswith(objectName)): bpy.context.view_layer.objects.active = ob bpy.data.objects[ob.name].select_set(True) obsToExport.add(bpy.data.objects[ob.name]) else: bpy.data.objects[ob.name].select_set(False) #ob.select = True ...
code_fim
hard
{ "lang": "python", "repo": "purpl3grape/Blender-Scripting", "path": "/BL_BatchSelectedExporter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: purpl3grape/Blender-Scripting path: /BL_BatchSelectedExporter.py import bpy import os # get the path where the blend file is located ExportDir = bpy.path.abspath('C:/Users/peter/Documents/Purpl3grapeLaptop/GitHub/Blender/FlightRunnerLevel/Export2') def ExportObjectGroupToFBX(objectName): <|fi...
code_fim
hard
{ "lang": "python", "repo": "purpl3grape/Blender-Scripting", "path": "/BL_BatchSelectedExporter.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>total = 0 with open(strong, 'r') as file: for line in file: total += 1 file.close() print("Total strong: ", total)<|fim_prefix|># repo: Gabriel0110/ML_Password_Classifier path: /get_list_totals.py weak = "weak_master_list.txt" strong = "strong_master_list.txt" total = 0 <|...
code_fim
medium
{ "lang": "python", "repo": "Gabriel0110/ML_Password_Classifier", "path": "/get_list_totals.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gabriel0110/ML_Password_Classifier path: /get_list_totals.py weak = "weak_master_list.txt" strong = "strong_master_list.txt" total = 0 with open(weak, 'r') as file: for line in file: total += 1 file.close() <|fim_suffix|>with open(strong, 'r') as file: for line i...
code_fim
easy
{ "lang": "python", "repo": "Gabriel0110/ML_Password_Classifier", "path": "/get_list_totals.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(n): if abs(a - (t-h[i]*0.006)) < near: ans = i+1 near = abs(a - (t-h[i]*0.006)) print(ans)<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03220/s070097212.py import sys n = int(input()) t,a = map(int,input().split()) h = list(map(int,input().split())) <|fim_mid...
code_fim
easy
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03220/s070097212.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Aasthaengg/IBMdataset path: /Python_codes/p03220/s070097212.py import sys n = int(input()) t,a = map(int,input().split()) h = list(map(int,input().split())) <|fim_suffix|>for i in range(n): if abs(a - (t-h[i]*0.006)) < near: ans = i+1 near = abs(a - (t-h[i]*0.006)) print(ans)<|fim_mid...
code_fim
easy
{ "lang": "python", "repo": "Aasthaengg/IBMdataset", "path": "/Python_codes/p03220/s070097212.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: YuLiuCU/summer-research path: /preprocessing_0729.py #!/usr/bin/env python # coding: utf-8 # In[ ]: import pandas as pd import numpy as np class preprocess(): def __init__(self,filepath): self.df=pd.read_csv(filepath) self.transform_date() self....
code_fim
hard
{ "lang": "python", "repo": "YuLiuCU/summer-research", "path": "/preprocessing_0729.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>data_prepared=preprocess('val.csv') data_prepared.raw_dataframe.to_csv('val_raw.csv') data_prepared.trainning_dataframe.to_csv('val_data.csv') data_prepared.std_dataframe.to_csv('val_std.csv') data_prepared.mean_dataframe.to_csv('val_mean.csv') data_prepared=preprocess('train.csv') data_prepared.raw_data...
code_fim
hard
{ "lang": "python", "repo": "YuLiuCU/summer-research", "path": "/preprocessing_0729.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: a-pinch/prog_hadoop path: /41_14/crossCorrelationMapper.py #! /usr/bin/python3 import sys H= {} oldLine = '' for line in sys.stdin: items = line.strip().split<|fim_suffix|> if(i != j): print(str(i)+","+str(j)+"\t1")<|fim_middle|>(" ") for i in items : for j in items:
code_fim
easy
{ "lang": "python", "repo": "a-pinch/prog_hadoop", "path": "/41_14/crossCorrelationMapper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if(i != j): print(str(i)+","+str(j)+"\t1")<|fim_prefix|># repo: a-pinch/prog_hadoop path: /41_14/crossCorrelationMapper.py #! /usr/bin/python3 import sys H= {} oldLine = '' for line in sys.stdin: items = line.strip().split<|fim_middle|>(" ") for i in items : for j in items:
code_fim
easy
{ "lang": "python", "repo": "a-pinch/prog_hadoop", "path": "/41_14/crossCorrelationMapper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print '\nThese files are not currently found in strflab_release_includes.txt, you may want to add some of them:' currentFiles = [] list_files(currentFiles, wdir, wdir, '\.svn|.m~') for cfile in currentFiles: if cfile not in releaseFiles: print cf...
code_fim
hard
{ "lang": "python", "repo": "theunissenlab/strflab", "path": "/release_helper.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: theunissenlab/strflab path: /release_helper.py import string import os import sys import re import shutil def list_files(fileList, rootDir, origRootDir, excludeExpr): for fname in os.listdir(rootDir): fullName = os.path.join(rootDir, fname) if re.search(excludeExpr, fname) is ...
code_fim
hard
{ "lang": "python", "repo": "theunissenlab/strflab", "path": "/release_helper.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rero/developer-resources path: /data/examples/03_TransactionRequest.py #!/usr/bin/env python3 from sqlalchemy import create_engine from sqlalchemy.orm import sessionmaker from tables import Animal # Lien avec la base de données engine = create_engine('sqlite:///database.db') # Création de plu...
code_fim
hard
{ "lang": "python", "repo": "rero/developer-resources", "path": "/data/examples/03_TransactionRequest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Transaction - version 2: avec erreur (et donc try/except) # SI une erreur survient => un rollback est effectué display_count(2) session2.begin_nested() try: session2.add(giraffe) raise session2.add(monkey) session2.commit() except: # no rollback pass # version 2 : vérification as...
code_fim
hard
{ "lang": "python", "repo": "rero/developer-resources", "path": "/data/examples/03_TransactionRequest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CPS-VIDA/elaborate-bhnr path: /src/drone_gym/envs/simple/quadrotor/quadcopter_env.py import argparse import logging from abc import ABC, abstractmethod import gym from .gui import GUI from .quadcopter import Quadcopter log = logging.getLogger(__name__) TIME_SCALING = 1.0 QUAD_DYNAMICS_UPDATE ...
code_fim
hard
{ "lang": "python", "repo": "CPS-VIDA/elaborate-bhnr", "path": "/src/drone_gym/envs/simple/quadrotor/quadcopter_env.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pass def reset(self): log.debug('Resetting QuadSim') self._do_reset() self.timestep = 0 return self._get_obs() @abstractmethod def _do_reset(self): pass def render(self, mode='human'): if self.gui is None: self.gui = GU...
code_fim
hard
{ "lang": "python", "repo": "CPS-VIDA/elaborate-bhnr", "path": "/src/drone_gym/envs/simple/quadrotor/quadcopter_env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DoublePan-Oh/DataProcess path: /dataProcess.py from PIL import Image from PIL import ImageEnhance import os import cv2 import numpy as np import time import random import shutil imageDir="G:\\posture_detection\\res_phone\\20210315\\phone_coco_1\\" #要改变的图片的路径文件夹 saveDir="G:\\posture_detection\\re...
code_fim
hard
{ "lang": "python", "repo": "DoublePan-Oh/DataProcess", "path": "/dataProcess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if way == 4: """ 划分训练集和验证集(测试集),并将图片复制到其他路径下 """ paths = "G:\\posture_detection\\res_phone\\20210311\\jiangcun\\" # 测试图片的路径 filenames = os.listdir(paths) # 获取txt文件对应的图像文件 files = [] for file in filenames: files.append(file) random.shuffle(files)# 乱序 train...
code_fim
hard
{ "lang": "python", "repo": "DoublePan-Oh/DataProcess", "path": "/dataProcess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ 对图像进行颜色抖动 :param image: PIL的图像image :return: 有颜色色差的图像image """ image = Image.open(os.path.join(root_path, img_name)) random_factor = np.random.randint(0, 31) / 10. # 随机因子 color_image = ImageEnhance.Color(image).enhance(random_factor) # 调整图像的饱和度 random_factor = np....
code_fim
hard
{ "lang": "python", "repo": "DoublePan-Oh/DataProcess", "path": "/dataProcess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/scripts-3 path: /main/pydef.py """Add a New Function / Alias to your bashrc / zshrc in Alphabetical Order""" from dataclasses import dataclass import os import re import subprocess as sp import sys from typing import List, Optional, Sequence from bugyi import cli from bugyi.core imp...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/scripts-3", "path": "/main/pydef.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if m_filename is None: raise RuntimeError( "No alias/function section could be found with the following" f" marker: {marker}" ) with open(m_filename, 'w') as f: f.writelines(m_new_lines) cursor_call = f"call cursor({line_number}, {column_numbe...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/scripts-3", "path": "/main/pydef.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> parser = cli.ArgumentParser() parser.add_argument( 'name', metavar='NAME', help='Name of the new function / alias.' ) parser.add_argument( '-a', '--alias', action='store_true', help='Define alias instead of function.', ) parser.add_argument(...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/scripts-3", "path": "/main/pydef.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: seniordev0425/Python-Rafflee path: /social_network/migrations/0040_auto_20200511_0815.py # Generated by Django 2.2.12 on 2020-05-11 08:15 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('social_network', '0039_auto_20200509_1506'), ] operations = ...
code_fim
medium
{ "lang": "python", "repo": "seniordev0425/Python-Rafflee", "path": "/social_network/migrations/0040_auto_20200511_0815.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='socialnetwork', name='twitch_channel_id', field=models.CharField(max_length=200, null=True), ), migrations.AddField( model_name='socialnetwork', name='twitch_channel_url'...
code_fim
medium
{ "lang": "python", "repo": "seniordev0425/Python-Rafflee", "path": "/social_network/migrations/0040_auto_20200511_0815.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmathews98/Computer-Simulation path: /cp3/Mandelbrot.py ''' Class for Mandelbrot Set ''' import cmath as cm #needed for complex numbers import numpy as np #needed for meshgrid 2D arrays and vectorization import matplotlib.pyplot as plt #needed to plot the graph <|fim_suffix|> CReal, CIma...
code_fim
hard
{ "lang": "python", "repo": "dmathews98/Computer-Simulation", "path": "/cp3/Mandelbrot.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> CReal, CImag = np.meshgrid(self.Creal, self.Cimag) vCalc_z = np.vectorize(self.findn) #Vectorises the function to allow supply of np array and to act on all values in the array N = vCalc_z(CReal, CImag) plt.imshow(N, extent = (CReal.min(), CReal.max(), CImag.min(), CImag.ma...
code_fim
hard
{ "lang": "python", "repo": "dmathews98/Computer-Simulation", "path": "/cp3/Mandelbrot.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: daniel-muthukrishna/SNClassifying_Pre-alpha path: /deep_learning_training.py import matplotlib.pyplot as plt import numpy as np import itertools import tensorflow as tf loaded = np.load('type_age_atRedshiftZero.npz') trainImages = loaded['trainImages'] trainLabels = loaded['trainLabels'] #trainF...
code_fim
hard
{ "lang": "python", "repo": "daniel-muthukrishna/SNClassifying_Pre-alpha", "path": "/deep_learning_training.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> yy = sess.run(y, feed_dict={x: testImages, y_: testLabels}) cp = sess.run(correct_prediction, feed_dict={x: testImages, y_: testLabels}) print(cp) for i in range(len(cp)): if (cp[i] == False): predictedIndex = np.argmax(yy[i]) print(i, testTypeNames[i], typeNamesList[predictedIndex]) ...
code_fim
hard
{ "lang": "python", "repo": "daniel-muthukrishna/SNClassifying_Pre-alpha", "path": "/deep_learning_training.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> im = Image.open("./tests/sample_screenshot.png") cells = mrc.get_nearby_towns_cell_images(im) bars = mrc.get_bar_images_from_cells(cells) self.assertEquals((190, 1), bars[3].size) def test_convert_bar_to_rates(self): rates = mrc.convert_bar_to_rates([]) ...
code_fim
medium
{ "lang": "python", "repo": "yerihyo/uwo_ps_utils", "path": "/tests/market_rates_cropper_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: yerihyo/uwo_ps_utils path: /tests/market_rates_cropper_test.py import unittest from PIL import Image from uwo_ps_utils import market_rates_cropper as mrc class MarketRatesCropperTest(unittest.TestCase): def test_get_selected_goods_cell(self): <|fim_suffix|> im = Image.open("./tests/...
code_fim
hard
{ "lang": "python", "repo": "yerihyo/uwo_ps_utils", "path": "/tests/market_rates_cropper_test.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_bar_images_from_cells(self): im = Image.open("./tests/sample_screenshot.png") cells = mrc.get_nearby_towns_cell_images(im) bars = mrc.get_bar_images_from_cells(cells) self.assertEquals((190, 1), bars[3].size) def test_convert_bar_to_rates(self): ...
code_fim
medium
{ "lang": "python", "repo": "yerihyo/uwo_ps_utils", "path": "/tests/market_rates_cropper_test.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Write your code here begin = 0 end = len(s)-1 aZ = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM" while(begin+1 <= end): while(1): #print "begin:%d ,%s" % (begin, s[begin]) if begin == end: ...
code_fim
hard
{ "lang": "python", "repo": "litaotju/lintcode", "path": "/415_valid-palindrome/valid-palindrome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: litaotju/lintcode path: /415_valid-palindrome/valid-palindrome.py # coding:utf-8 ''' @Copyright:LintCode @Author: taoleetju @Problem: http://www.lintcode.com/problem/valid-palindrome @Language: Python @Datetime: 15-10-06 14:23 ''' <|fim_suffix|> # @param {string} s A string # @return {...
code_fim
hard
{ "lang": "python", "repo": "litaotju/lintcode", "path": "/415_valid-palindrome/valid-palindrome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> meta = meta_tags(*args, **kwargs) template = [ '<meta property="og:%s" content="{%s}">' % (key, key) for key in sorted(meta.keys()) if key not in ('canonical',) ] template.append( '<meta name="description" content="{description}">' ) if meta.get('can...
code_fim
hard
{ "lang": "python", "repo": "barseghyanartur/feincms3-meta", "path": "/feincms3_meta/utils.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> top_100_positive = {word for word, count in positive_fd.most_common(100)} top_100_negative = {word for word, count in negative_fd.most_common(100)} features = [ (extract_features(nltk.corpus.movie_reviews.raw(review)), "pos") for review in nltk.corpus.movie_reviews.fileids(categories=[...
code_fim
hard
{ "lang": "python", "repo": "ConorMcKeever/CSC4006_FYP", "path": "/app/initModel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ConorMcKeever/CSC4006_FYP path: /app/initModel.py from nltk.stem.wordnet import WordNetLemmatizer from nltk.corpus import twitter_samples, stopwords, movie_reviews from nltk.tag import pos_tag from nltk.tokenize import word_tokenize from nltk import FreqDist, classify, NaiveBayesClassifier import...
code_fim
hard
{ "lang": "python", "repo": "ConorMcKeever/CSC4006_FYP", "path": "/app/initModel.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def initModel(): positive_tweets = twitter_samples.strings('positive_tweets.json') negative_tweets = twitter_samples.strings('negative_tweets.json') tweet_tokens = twitter_samples.tokenized('positive_tweets.json')[0] stop_words = stopwords.words('english') positive_tweet_tokens = tw...
code_fim
hard
{ "lang": "python", "repo": "ConorMcKeever/CSC4006_FYP", "path": "/app/initModel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return True def get_image(): img = drone.get_frame_read().frame img = cv2.resize(img, (WIDTH,HEIGHT)) cv2.imshow("Image", img) cv2.waitKey(1) def main(): if not init(): return False while True: img = get_image() ...
code_fim
hard
{ "lang": "python", "repo": "shubhxm02/tello-sg", "path": "/files/telloFaceControl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> img = drone.get_frame_read().frame img = cv2.resize(img, (WIDTH,HEIGHT)) cv2.imshow("Image", img) cv2.waitKey(1) def main(): if not init(): return False while True: img = get_image() img, face_info = utils....
code_fim
hard
{ "lang": "python", "repo": "shubhxm02/tello-sg", "path": "/files/telloFaceControl.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shubhxm02/tello-sg path: /files/telloFaceControl.py import FaceControlUtils as utils from djitellopy import tello from time import sleep import cv2 drone = tello.Tello() HEIGHT, WIDTH = 360, 240 def init(): # connect the drone drone.connect() drone.streamon() bat...
code_fim
hard
{ "lang": "python", "repo": "shubhxm02/tello-sg", "path": "/files/telloFaceControl.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlbiziaLebbeck/LidarBot path: /Python/testBreezySLAM.py import scipy.io as sio from breezyslam.algorithms import RMHC_SLAM from breezyslam.sensors import RPLidarA1 as LaserModel from PIL import Image import matplotlib.pyplot as plt import numpy as np MAP_SIZE_PIXELS = 500 MAP_SIZE_METERS...
code_fim
hard
{ "lang": "python", "repo": "AlbiziaLebbeck/LidarBot", "path": "/Python/testBreezySLAM.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mapbytes[y_pix * MAP_SIZE_PIXELS + x_pix] = 0 image = Image.frombuffer('L', (MAP_SIZE_PIXELS, MAP_SIZE_PIXELS), mapbytes, 'raw', 'L', 0, 1) # image.save('img_map.png') plt.figure() plt.imshow(image) plt.show()<|fim_prefix|># repo: AlbiziaLebbeck/LidarBot path: /Python/testBreezySLAM.py import scipy....
code_fim
hard
{ "lang": "python", "repo": "AlbiziaLebbeck/LidarBot", "path": "/Python/testBreezySLAM.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Update SLAM with current Lidar scan and scan angles if adequate slam.update(distances, scan_angles_degrees=angles) # Get current robot position x_mm, y_mm, theta_degrees = slam.getpos() trajectory.append((x_mm, y_mm)) def mm2pix(mm): return int(mm / (MAP_SIZE_METERS * 1000. /...
code_fim
hard
{ "lang": "python", "repo": "AlbiziaLebbeck/LidarBot", "path": "/Python/testBreezySLAM.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>hist = pygal.Bar() hist.title = "Results of rolling one D6 100 times." hist.x_labels = ['1', '2', '3', '4', '5', '6'] hist.x_title = "Result" hist.y_title = "Frequency of Result" hist.add('D6', frequencies) hist.render_to_file('die_visual.svg')<|fim_prefix|># repo: ma-henderson/python_projects path: /1...
code_fim
medium
{ "lang": "python", "repo": "ma-henderson/python_projects", "path": "/13_api_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>hist.title = "Results of rolling one D6 100 times." hist.x_labels = ['1', '2', '3', '4', '5', '6'] hist.x_title = "Result" hist.y_title = "Frequency of Result" hist.add('D6', frequencies) hist.render_to_file('die_visual.svg')<|fim_prefix|># repo: ma-henderson/python_projects path: /13_api_test.py import...
code_fim
medium
{ "lang": "python", "repo": "ma-henderson/python_projects", "path": "/13_api_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ma-henderson/python_projects path: /13_api_test.py import pygal dummy_data = [4, 6, 5, 6, 1, 5, 6, 3, 5, 3, 5, 3, 2, 2, 1, 3, 1, 5, 3, 6, 3, 6, 5, 4, 1, 1, 4, 2, 3, 6, 4, 2, 6, 4, 1, 3, 2, 5, 6, 3, 6, 2, 1, 1, 3, 4, 1, 4, 3, 5, 1, 4, 5, 5, 2, 3, 3, 1, 2, 3, 5, 6, 2, 5, 6, 1, 3, 2, 1, 1, 1, 6, ...
code_fim
medium
{ "lang": "python", "repo": "ma-henderson/python_projects", "path": "/13_api_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dayatz/ed path: /todolist/models.py from django.db import models from django.contrib.auth.models import User <|fim_suffix|> def __unicode__(self): return self.name class Board(Common): user = models.ForeignKey(User, related_name='boards') description = models.TextField(null=...
code_fim
medium
{ "lang": "python", "repo": "dayatz/ed", "path": "/todolist/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Todo(Common): list = models.ForeignKey(List, related_name='todos') approved = models.BooleanField(default=False)<|fim_prefix|># repo: dayatz/ed path: /todolist/models.py from django.db import models from django.contrib.auth.models import User class Common(models.Model): class Meta: ...
code_fim
hard
{ "lang": "python", "repo": "dayatz/ed", "path": "/todolist/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rint("| 0 |") print("| 0 0 |") print("---------") if number==6: print("---------") print("| 0 0 0 |") print("| |") print("| 0 0 0 |") print("---------") x=input("Press y to roll again")<|fim_prefix|># repo: Anushri-VK/python_games path: /dice.py import random print("This is a ...
code_fim
hard
{ "lang": "python", "repo": "Anushri-VK/python_games", "path": "/dice.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Anushri-VK/python_games path: /dice.py import random print("This is a dice stimulator") x="y" while x=="y": number=random.randint(1,6) if number==1: print("---------") print("| |") print("| 0 |") print("| |") print("-------<|fim_suffix|> 0 |") print("---------") ...
code_fim
hard
{ "lang": "python", "repo": "Anushri-VK/python_games", "path": "/dice.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fuglede/adventofcode path: /2018/day15/solutions.py from itertools import count from collections import deque import os import matplotlib.pyplot as plt with open('input') as f: lines = [x.strip() for x in f.readlines()] class Unit: hp = 200 is_alive = True class Goblin(Unit): ...
code_fim
hard
{ "lang": "python", "repo": "fuglede/adventofcode", "path": "/2018/day15/solutions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if isinstance(s, Goblin): return 'G' if isinstance(s, Elf): return 'E' return s return '\n'.join(''.join(render_square(self.field[(x, y)]) for x in range(self._width)) for y in range(self._height)) def render_image(self): ...
code_fim
hard
{ "lang": "python", "repo": "fuglede/adventofcode", "path": "/2018/day15/solutions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def stereoKeyBind(): keyboard.add_hotkey('Ctrl + Alt + Up', soundProfile, args=('/Enable', False)) keyboard.add_hotkey('Ctrl + Alt + Down', soundProfile, args=('/Disable', True)) def heroKeyBind(count, name): keyboard.unhook_all_hotkeys() for i in range(count): for extra_key in k...
code_fim
medium
{ "lang": "python", "repo": "heh-mde/CringeSounds", "path": "/code/keybinds.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: heh-mde/CringeSounds path: /code/keybinds.py import keyboard import threading from sound import * hero = None pressed_key = "" is_stereo_on = False key_list = ['', '+k', '+g', '+capslock', '+shift', '+w', '+a', '+s', '+d'] <|fim_suffix|> def heroKeyBind(count, name): keyboard.unhook_all_ho...
code_fim
hard
{ "lang": "python", "repo": "heh-mde/CringeSounds", "path": "/code/keybinds.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def stereoKeyBind(): keyboard.add_hotkey('Ctrl + Alt + Up', soundProfile, args=('/Enable', False)) keyboard.add_hotkey('Ctrl + Alt + Down', soundProfile, args=('/Disable', True)) def heroKeyBind(count, name): keyboard.unhook_all_hotkeys() for i in range(count): for extra_key in ...
code_fim
medium
{ "lang": "python", "repo": "heh-mde/CringeSounds", "path": "/code/keybinds.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dundunmao/LeetCode2019 path: /992. Subarrays with K Different Integers.py import collections class Solution: def subarraysWithKDistinct(self, A: List[int], K: int) -> int: for_k = self.lengthOfLongestSubstringKDistinct(A, K) for_k_minus = self.lengthOfLongestSubstringKDistin...
code_fim
hard
{ "lang": "python", "repo": "dundunmao/LeetCode2019", "path": "/992. Subarrays with K Different Integers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>A = [2,2,1,2,2,2,1,1] K = 2 # 23 print(s.subarraysWithKDistinct(A,K)) A = [1, 2] K = 1 # 2 print(s.subarraysWithKDistinct(A,K)) A = [1,2,1,2,3] K = 2 # 7 print(s.subarraysWithKDistinct(A,K)) A = [1, 2, 1, 3, 4] K = 3 # 3 print(s.subarraysWithKDistinct(A,K))<|fim_prefix|># repo: dundunmao/LeetCode2019 pa...
code_fim
medium
{ "lang": "python", "repo": "dundunmao/LeetCode2019", "path": "/992. Subarrays with K Different Integers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>A = [1, 2] K = 1 # 2 print(s.subarraysWithKDistinct(A,K)) A = [1,2,1,2,3] K = 2 # 7 print(s.subarraysWithKDistinct(A,K)) A = [1, 2, 1, 3, 4] K = 3 # 3 print(s.subarraysWithKDistinct(A,K))<|fim_prefix|># repo: dundunmao/LeetCode2019 path: /992. Subarrays with K Different Integers.py import collections c...
code_fim
hard
{ "lang": "python", "repo": "dundunmao/LeetCode2019", "path": "/992. Subarrays with K Different Integers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abhishekpattnaik/Batch_Project path: /batch_app/urls.py from django.urls import path <|fim_suffix|>urlpatterns = [ # path('dashboard/', views.view1, name='index'), # path('login/', views.loginPage, name="login"), # path('logout/', views.logoutUser, name="logout"), path('home/', views.Ho...
code_fim
easy
{ "lang": "python", "repo": "abhishekpattnaik/Batch_Project", "path": "/batch_app/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ # path('dashboard/', views.view1, name='index'), # path('login/', views.loginPage, name="login"), # path('logout/', views.logoutUser, name="logout"), path('home/', views.Home, name="home"), ]<|fim_prefix|># repo: abhishekpattnaik/Batch_Project path: /batch_app/urls.py from django...
code_fim
easy
{ "lang": "python", "repo": "abhishekpattnaik/Batch_Project", "path": "/batch_app/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: programmingkids/python-test-level2 path: /test03/test06.py # 実行結果 # 18 # 関数「multiply」を修正してはいけません def multiply( number1, number2 ) : answer = number1 * number2 return answer <|fim_suffix|># ここより下側に関数を呼び出す処理を作成します<|fim_middle|>a = 3 b = 6
code_fim
easy
{ "lang": "python", "repo": "programmingkids/python-test-level2", "path": "/test03/test06.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>a = 3 b = 6 # ここより下側に関数を呼び出す処理を作成します<|fim_prefix|># repo: programmingkids/python-test-level2 path: /test03/test06.py # 実行結果 # 18 # 関数「multiply」を修正してはいけません def multiply( number1, number2 ) : <|fim_middle|> answer = number1 * number2 return answer
code_fim
easy
{ "lang": "python", "repo": "programmingkids/python-test-level2", "path": "/test03/test06.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> a = 3 b = 6 # ここより下側に関数を呼び出す処理を作成します<|fim_prefix|># repo: programmingkids/python-test-level2 path: /test03/test06.py # 実行結果 # 18 # 関数「multiply」を修正してはいけません def multiply( number1, number2 ) : <|fim_middle|> answer = number1 * number2 return answer
code_fim
easy
{ "lang": "python", "repo": "programmingkids/python-test-level2", "path": "/test03/test06.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoshCrusader/Octomind path: /utils/federate.py import gspread from oauth2client.service_account import ServiceAccountCredentials from django.utils import timezone from octo_site.models import Game, GameDetails, Room, Players, Teams, LocDictionary, Offlinegames, PlayersCity, Voucher num_col = 55 ...
code_fim
hard
{ "lang": "python", "repo": "JoshCrusader/Octomind", "path": "/utils/federate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif (cell.col == 3): if(cell.value != ""): data_obj['has_voucher'] = 1 else: data_obj['has_voucher'] = 0 data_obj['vouchername'] = cell.value elif (cell.col == 4): ...
code_fim
hard
{ "lang": "python", "repo": "JoshCrusader/Octomind", "path": "/utils/federate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JT4life/PythonRevisePractice path: /list2.py list2 = [1,2,"3",3] list3 = [] list4 = [<|fim_suffix|>ist4.append(i) print(list3) print(list4)<|fim_middle|>] for i in list2: if i.isdigit(): list3.append(i) else: l
code_fim
medium
{ "lang": "python", "repo": "JT4life/PythonRevisePractice", "path": "/list2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> list3.append(i) else: list4.append(i) print(list3) print(list4)<|fim_prefix|># repo: JT4life/PythonRevisePractice path: /list2.py list2 = [1,2,"3",3] list3 = [] list4 = [<|fim_middle|>] for i in list2: if i.isdigit():
code_fim
easy
{ "lang": "python", "repo": "JT4life/PythonRevisePractice", "path": "/list2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ist4.append(i) print(list3) print(list4)<|fim_prefix|># repo: JT4life/PythonRevisePractice path: /list2.py list2 = [1,2,"3",3] list3 = [] list4 = [<|fim_middle|>] for i in list2: if i.isdigit(): list3.append(i) else: l
code_fim
medium
{ "lang": "python", "repo": "JT4life/PythonRevisePractice", "path": "/list2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: qsweber/geo-journal path: /src/geo_journal/app/http.py from datetime import datetime from decimal import Decimal from functools import wraps import logging import json import typing from jsonschema import validate # type: ignore from flask import Flask, jsonify, request, Response, g from raven...
code_fim
hard
{ "lang": "python", "repo": "qsweber/geo-journal", "path": "/src/geo_journal/app/http.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return wrapper def authenticate( func: typing.Callable[..., Response] ) -> typing.Callable[..., Response]: @wraps(func) def what_gets_called(*args: typing.Any, **kwargs: typing.Any) -> Response: try: jwt = decode(request.headers["Authorization"]) except Except...
code_fim
hard
{ "lang": "python", "repo": "qsweber/geo-journal", "path": "/src/geo_journal/app/http.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return what_gets_called return wrapper def authenticate( func: typing.Callable[..., Response] ) -> typing.Callable[..., Response]: @wraps(func) def what_gets_called(*args: typing.Any, **kwargs: typing.Any) -> Response: try: jwt = decode(request.headers["Autho...
code_fim
hard
{ "lang": "python", "repo": "qsweber/geo-journal", "path": "/src/geo_journal/app/http.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print interval(10) print interval(1,5) print interval(3,12,4) print power(*interval(3,7))#首先去调interval函数,return【3,4,5,6】,然后前两位幂运算,后面的当字符处理 #函数内部访问全局变量; parameter='berry' def combine(parameter): print parameter + globals()['parameter'] combine('kiki') #函数内部定义全局变量,如果不添加global函数内部的变量都是局部变量 x=1 def cha...
code_fim
hard
{ "lang": "python", "repo": "jimmybasketball/Python", "path": "/untitled/day8_def.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimmybasketball/Python path: /untitled/day8_def.py #!D:\Python\python27 # -*- coding:utf-8 -*- def story(**kwds): return 'once upon a time, there was a '\ '%(job)s called %(name)s.'%kwds def power(x,y,*others): if others: print 'received redundant paramenters:',other...
code_fim
hard
{ "lang": "python", "repo": "jimmybasketball/Python", "path": "/untitled/day8_def.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#函数内部访问全局变量; parameter='berry' def combine(parameter): print parameter + globals()['parameter'] combine('kiki') #函数内部定义全局变量,如果不添加global函数内部的变量都是局部变量 x=1 def change_global(): global x x=x+1 change_global() print x #二元查找 def search(sequence,number,lower,upper): if lower==upper: a...
code_fim
hard
{ "lang": "python", "repo": "jimmybasketball/Python", "path": "/untitled/day8_def.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>import optionparse opt, args = optionparse.parse(__doc__) if not opt and not args: optionparse.exit() if opt.positional: print args if opt.option1: print opt.option1 if opt.option2: print opt.option2<|fim_prefix|># repo: micheles/papers path: /pypers/optparse/example.py """An example scri...
code_fim
medium
{ "lang": "python", "repo": "micheles/papers", "path": "/pypers/optparse/example.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: micheles/papers path: /pypers/optparse/example.py """An example script invoking optionparse. <|fim_suffix|>import optionparse opt, args = optionparse.parse(__doc__) if not opt and not args: optionparse.exit() if opt.positional: print args if opt.option1: print opt.option1 if opt.opti...
code_fim
medium
{ "lang": "python", "repo": "micheles/papers", "path": "/pypers/optparse/example.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrew-shoe/Breakthrough path: /Detectors.py from __future__ import division import numpy as np from scipy.stats import gmean, kurtosis from scipy.signal import fftconvolve, tukey import random import math import time import scipy """Utility functions""" def st(): global START_TIME STAR...
code_fim
hard
{ "lang": "python", "repo": "andrew-shoe/Breakthrough", "path": "/Detectors.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Output ------ A num_signals by sig_len array of noisy signals """ SNR = 10 ** (SNR_dB / 10) if sig_type == "sin": return gen_complex_sinusoid(num_signals, sig_len, SNR, noise_type) elif sig_type == "chirp_narrow": return gen_chirps(num_signals, sig_len, SNR, .1...
code_fim
hard
{ "lang": "python", "repo": "andrew-shoe/Breakthrough", "path": "/Detectors.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stats = Stats({ "modules": ["average_entry_count"] }) log_txt = '127.0.0.1 - james [09/May/2018:16:00:39 +0000] "GET /report HTTP/1.0" 200 123' entry = LogEntry(log_txt) stats.register_entry(entry) stats._on_timer() stats._on_timer() call = mock_average_entry_count....
code_fim
hard
{ "lang": "python", "repo": "eckter/http_log_monitor", "path": "/tests/tasks/test_stats.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eckter/http_log_monitor path: /tests/tasks/test_stats.py from log_monitor.tasks import Stats from log_monitor.models import LogEntry from mock import patch @patch("log_monitor.tasks.stat_modules.average_entry_count") def test_stats__modules_call(mock_average_entry_count): stats = Stats({ ...
code_fim
hard
{ "lang": "python", "repo": "eckter/http_log_monitor", "path": "/tests/tasks/test_stats.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result = analysisresult.result result_transform = {} for key in result: ver, pub, part_x = key pv, uv = result[key][0], len(result[key][1]) if (ver, pub) not in result_transform: uv_all = len(reduce(lambda a, b: a|b, [result.get((...
code_fim
hard
{ "lang": "python", "repo": "chennqqi/OpenSaaSProj", "path": "/Tongji/CustomizeBiqu/Analysis/AnalysisFlightlineSearchBefore.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result.setdefault((ver, "all", part_x), [0, set(), 0])[0] += 1 result.setdefault((ver, "all", part_x), [0, set(), 0])[1].add(uid) result.setdefault(("all", "all", part_x), [0, set(), 0])[0] += 1 result.setdefault(("all", "all", part_x), [0, set(), 0])[1].ad...
code_fim
hard
{ "lang": "python", "repo": "chennqqi/OpenSaaSProj", "path": "/Tongji/CustomizeBiqu/Analysis/AnalysisFlightlineSearchBefore.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chennqqi/OpenSaaSProj path: /Tongji/CustomizeBiqu/Analysis/AnalysisFlightlineSearchBefore.py # -*- coding: utf-8 -*- # from Tongji.AnalysisMap.MapDataFactory import MapDataFactory import __init__ from Tongji.AnalysisMap.AnalysisMap import AnalysisMap import datetime import sys class AnalysisFlig...
code_fim
hard
{ "lang": "python", "repo": "chennqqi/OpenSaaSProj", "path": "/Tongji/CustomizeBiqu/Analysis/AnalysisFlightlineSearchBefore.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arash-mehrabi-z/data-mining path: /vectorizing/src/invertedIndex/postingList.py import bisect class PostingList(): docIds = [] #list of integers def __init__(self, lst): self.docIds = lst def add(self, id): # bisect.insort(self.docIds, id) self.docIds.append...
code_fim
hard
{ "lang": "python", "repo": "arash-mehrabi-z/data-mining", "path": "/vectorizing/src/invertedIndex/postingList.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def NOT(self, other): initialDocIds = self.docIds for otherDocId in other.getDocIds(): if otherDocId in initialDocIds: initialDocIds.remove(otherDocId) return PostingList(initialDocIds)<|fim_prefix|># repo: arash-mehrabi-z/data-mining path...
code_fim
hard
{ "lang": "python", "repo": "arash-mehrabi-z/data-mining", "path": "/vectorizing/src/invertedIndex/postingList.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return result def NOT(self, other): initialDocIds = self.docIds for otherDocId in other.getDocIds(): if otherDocId in initialDocIds: initialDocIds.remove(otherDocId) return PostingList(initialDocIds)<|fim_prefix|># repo: arash-mehr...
code_fim
hard
{ "lang": "python", "repo": "arash-mehrabi-z/data-mining", "path": "/vectorizing/src/invertedIndex/postingList.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: EruDev/spiders path: /AnJuKe2/AnJuKe2/spiders/anjuke.py # -*- coding: utf-8 -*- import scrapy from scrapy.http import Request import time import json from AnJuKe2.items import AnjukeZuFangItem, AnjukeErShouFangItem import re from random import random class AnjukeSpider(scrapy.Spider): name ...
code_fim
hard
{ "lang": "python", "repo": "EruDev/spiders", "path": "/AnJuKe2/AnJuKe2/spiders/anjuke.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> item = AnjukeErShouFangItem() response = response.text infos = re.findall(r'"results":(.*?),"request_time"', response)[0] infos = json.loads(infos) for info in infos: item['esf_proid'] = info['PROID'] item['esf_cityid'] = info['CITYID'] ...
code_fim
hard
{ "lang": "python", "repo": "EruDev/spiders", "path": "/AnJuKe2/AnJuKe2/spiders/anjuke.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> item = AnjukeZuFangItem() response = response.text infos = re.findall(r'"tw_home_recommend_prop":(.*?),"request_time"', response)[0] infos = json.loads(infos) # print(infos) for info in infos: item['zf_id'] = info['id'] item['zf_title...
code_fim
hard
{ "lang": "python", "repo": "EruDev/spiders", "path": "/AnJuKe2/AnJuKe2/spiders/anjuke.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MathieuLeocmach/trackpy path: /trackpy/tests/test_static.py o_edge = pair_correlation_2d(lattice, dr=.1, cutoff=8, handle_edge=False) g_r_no_edge /= np.linalg.norm(g_r_no_edge) # Assert the functions are essentially the same ...
code_fim
hard
{ "lang": "python", "repo": "MathieuLeocmach/trackpy", "path": "/trackpy/tests/test_static.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> R = self.R box = self.box # center point = np.array([[1, 1, 1]]) * R dist = np.repeat([1], point.shape[0], axis=0) * R result = area_3d_bounded(dist, point, box) assert_almost_equal(result, 4*np.pi*R**2) # planes point = np.array([[0,...
code_fim
hard
{ "lang": "python", "repo": "MathieuLeocmach/trackpy", "path": "/trackpy/tests/test_static.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MathieuLeocmach/trackpy path: /trackpy/tests/test_static.py _edges, dr, n): """Returns x, y, z array of points comprising shells extending from r to r_dr. n determines the number of points in the ring. Rings are generated by constructing a unit sphere and projecting every point onto a...
code_fim
hard
{ "lang": "python", "repo": "MathieuLeocmach/trackpy", "path": "/trackpy/tests/test_static.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GoDoVoReZ/Weather_app path: /weather_desktop.py # ДЕСКТОПНАЯ ВЕРСИЯ # Импорт библиотек и модуля api_script import PySimpleGUI as sg import numpy as np from api_script import get_weather # Тема главного окна sg.theme('DarkAmber') # Главная функция отображения, вызывает функцию get_weather из м...
code_fim
hard
{ "lang": "python", "repo": "GoDoVoReZ/Weather_app", "path": "/weather_desktop.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Основной цикл, в зависимости от нажатой кнопки вызывает функцию update() или закрывает окно while True: event, values = window.read() if event in (sg.WIN_CLOSED, 'Exit'): break if event == '-FUNCTION-': try: update(values[0]) except Exception as e: ...
code_fim
medium
{ "lang": "python", "repo": "GoDoVoReZ/Weather_app", "path": "/weather_desktop.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> path("student-membership/<int:id>/", get_student_mempership, name="studentmembership"), path('get-user-student/<int:user_id>', get_student_by_user_id, name='get_user_student'), path('get-teacher-user/<int:id>',get_teacher_by_user_id,name='get_teacher_by_user_id'), path('get-admin-user/<int...
code_fim
hard
{ "lang": "python", "repo": "AmroYasser/Courses-booking-backend", "path": "/backend/moasasa/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AmroYasser/Courses-booking-backend path: /backend/moasasa/urls.py from django.urls import path from django.conf import settings from django.conf.urls.static import static from .api import * from rest_framework.routers import DefaultRouter <|fim_suffix|> path("student-membership/<int:id>/", ge...
code_fim
hard
{ "lang": "python", "repo": "AmroYasser/Courses-booking-backend", "path": "/backend/moasasa/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> r = start while r < stop: yield r r += step<|fim_prefix|># repo: sfmc/mpi path: /helpers/utilities.py #!/usr/bin/python import math def clamp(v, min_value, max_value): return max(min_value, min(max_value, v)) <|fim_middle|> def drange(start, stop, step):
code_fim
easy
{ "lang": "python", "repo": "sfmc/mpi", "path": "/helpers/utilities.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }