text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>T = int(sys.stdin.readline()) for i in range(T): N = int(sys.stdin.readline()) health = [] line = sys.stdin.readline().split() for health_val in line: health.append(int(health_val)) print (tackle_mandragora(health))<|fim_prefix|># repo: anshuli-patil/DynamicProgramming path: /...
code_fim
hard
{ "lang": "python", "repo": "anshuli-patil/DynamicProgramming", "path": "/mandragora.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: anshuli-patil/DynamicProgramming path: /mandragora.py import sys def tackle_mandragora(health): health.sort() # for all tipping points, where we change over from eating to defeating defeating = defeating_cost_precompute(health) opt = 0 for i in range(0, len(health) + 1): ...
code_fim
medium
{ "lang": "python", "repo": "anshuli-patil/DynamicProgramming", "path": "/mandragora.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ClearBlade/ClearBlade-Patterns path: /Stepper Motor Pattern/motor.py import paho.mqtt.client as paho import RPi.GPIO as GPIO import json, time, math import clearblade from clearblade import auth from clearblade import Client from urlparse import urlparse #Fill init values systemKey = ______ secr...
code_fim
hard
{ "lang": "python", "repo": "ClearBlade/ClearBlade-Patterns", "path": "/Stepper Motor Pattern/motor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload)) command = msg.payload commandJson = json.loads(command) controlState = str(commandJson['controlState']) angle = commandJson['state'] print ("Control State :"+controlState) print ("Angle:"+str(angle)) StepMotor(controlState, angle) pri...
code_fim
hard
{ "lang": "python", "repo": "ClearBlade/ClearBlade-Patterns", "path": "/Stepper Motor Pattern/motor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Define event callbacks def on_connect(mosq, obj, rc): print("rc: " + str(rc)) def on_message(mosq, obj, msg): print(msg.topic + " " + str(msg.qos) + " " + str(msg.payload)) command = msg.payload commandJson = json.loads(command) controlState = str(commandJson['controlState']) angle = commandJson...
code_fim
hard
{ "lang": "python", "repo": "ClearBlade/ClearBlade-Patterns", "path": "/Stepper Motor Pattern/motor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> images_to_show = [] labels_to_show = [] for label, image in image_dict.items(): labels_to_show.append(label_names[label]) for i in image: images_to_show.append(i) images_tensor = torch.stack([torch.Tensor(i) for i in images_to_show]) imshow(tor...
code_fim
hard
{ "lang": "python", "repo": "alekhyam94/Big_Data_Assignment_1", "path": "/code/utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alekhyam94/Big_Data_Assignment_1 path: /code/utils.py import pickle import numpy as np import torch import time import torchvision import matplotlib import matplotlib.pyplot as plt def load_cifar_data(data_files): data = [] labels = [] for file in data_files: with open(file, ...
code_fim
hard
{ "lang": "python", "repo": "alekhyam94/Big_Data_Assignment_1", "path": "/code/utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sample_mean = torch.mean(sample_values, dim=1) sample_m2 = torch.sum((sample_values - sample_mean[:, None]) ** 2, dim=1) delta = sample_mean - mean mean += delta * batch_size / new_count corr = batch_size * count / new_count M2 += sample_m2 + delta**2 * cor...
code_fim
hard
{ "lang": "python", "repo": "atomistic-machine-learning/schnetpack", "path": "/src/schnetpack/data/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: atomistic-machine-learning/schnetpack path: /src/schnetpack/data/stats.py from typing import Dict, Tuple import torch from tqdm import tqdm import schnetpack.properties as structure from schnetpack.data import AtomsLoader __all__ = ["calculate_stats"] def calculate_stats( dataloader: Ato...
code_fim
medium
{ "lang": "python", "repo": "atomistic-machine-learning/schnetpack", "path": "/src/schnetpack/data/stats.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> delta = sample_mean - mean mean += delta * batch_size / new_count corr = batch_size * count / new_count M2 += sample_m2 + delta**2 * corr count = new_count stddev = torch.sqrt(M2 / count) stats = {pn: (mu, std) for pn, mu, std in zip(property_names, mean, s...
code_fim
medium
{ "lang": "python", "repo": "atomistic-machine-learning/schnetpack", "path": "/src/schnetpack/data/stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sellnat77/FlaskExperiments path: /app/logger.py import os def log(text, level=2, outFile='log.txt'): text = str(text) if level == 0: return True if level == 3: with open(outFile, 'a') as logger: logger.write(text) logger.close() ...
code_fim
medium
{ "lang": "python", "repo": "sellnat77/FlaskExperiments", "path": "/app/logger.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': log('hello world',2,'temp.txt')<|fim_prefix|># repo: sellnat77/FlaskExperiments path: /app/logger.py import os def log(text, level=2, outFile='log.txt'): text = str(text) if level == 0: return True if level == 3: with open(outFile, '...
code_fim
medium
{ "lang": "python", "repo": "sellnat77/FlaskExperiments", "path": "/app/logger.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Initialize the trash trash = [] # Test silver and gold = 0 supply["Copper"]=[Dominion.Copper()]*(60-len(player_names)*7) supply["Silver"]=[Dominion.Silver()]*0 supply["Gold"]=[Dominion.Gold()]*0 # Construct the Player objects players = testUtility.set_players(player_names) # Play the game testUtility....
code_fim
hard
{ "lang": "python", "repo": "lieuraymond/CS362-W2020", "path": "/projects/lieur/dominion/testDominion2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lieuraymond/CS362-W2020 path: /projects/lieur/dominion/testDominion2.py # -*- coding: utf-8 -*- """" Created on Saturday, January 18, 2020 @author: lieur This test case sets silver and gold to 0, which in most cases prevent the computer from buying provinces. This tests to see if the game ends...
code_fim
medium
{ "lang": "python", "repo": "lieuraymond/CS362-W2020", "path": "/projects/lieur/dominion/testDominion2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>= re.search(pattern,string) lastBracket = re.split("\].*\[",match.group(1))[-1] print lastBracket<|fim_prefix|># repo: eleanoryc/python_scripts path: /regex1.py import re list = ["Protein XVZ [Human]","Protein ABC [Mouse]","go UDP[3] glucosamine N-acyltransferase [<|fim_middle|>virus1]","Protein ...
code_fim
hard
{ "lang": "python", "repo": "eleanoryc/python_scripts", "path": "/regex1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: eleanoryc/python_scripts path: /regex1.py import re list = ["Protein XVZ [Human]","Protein ABC [Mouse]","go UDP[3] glucosamine N-acyltransferase [<|fim_suffix|>= re.search(pattern,string) lastBracket = re.split("\].*\[",match.group(1))[-1] print lastBracket<|fim_middle|>virus1]","Protein ...
code_fim
hard
{ "lang": "python", "repo": "eleanoryc/python_scripts", "path": "/regex1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for face_to_compare in self.__known_face_encodings: print(face_recognition.face_distance(unknown_face_encodings, face_to_compare)) for i, unknown_face_encoding in enumerate(unknown_face_encodings): img_file = osp.basename(self.__unknown_images_paths[i]) ...
code_fim
hard
{ "lang": "python", "repo": "evil-nerver-die/FaceRecognitionContest", "path": "/src/Server/engine/face_recognition_lib/face_recognition_lib.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: evil-nerver-die/FaceRecognitionContest path: /src/Server/engine/face_recognition_lib/face_recognition_lib.py import face_recognition from glob import glob import os.path as osp class FaceRecognitionLib(object): """ face_recognition library を利用した顔認証検証 """ # クラス変数設定 ...
code_fim
hard
{ "lang": "python", "repo": "evil-nerver-die/FaceRecognitionContest", "path": "/src/Server/engine/face_recognition_lib/face_recognition_lib.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def recognition(self): """ Recognition """ unknown_face_encodings = self.__make_face_encodings(images_path=self.__unknown_images_paths) print('shape of unknown_face_encodings = ({}, {})'.format(len(unknown_face_encodings), ...
code_fim
hard
{ "lang": "python", "repo": "evil-nerver-die/FaceRecognitionContest", "path": "/src/Server/engine/face_recognition_lib/face_recognition_lib.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hadoop73/sklearn path: /predict_risk/feature/browser_history_2.py # coding:utf-8 import pandas as pd import numpy as np import matplotlib.pyplot as plt from multiprocessing import Pool """ 用户id,时间戳,浏览行为数据,浏览子行为编号 """ names = ['userid','time','browser_behavior','browser_behavior_number'] browse...
code_fim
hard
{ "lang": "python", "repo": "hadoop73/sklearn", "path": "/predict_risk/feature/browser_history_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> browser_behavior_tp = list(data.browser_behavior.unique()) pool = Pool(12) rst = pool.map(browser_behavior_u,users) pool.close() pool.join() Data = pd.DataFrame(rst) #Datas = pd.merge(Datas,Data,on='userid') del Data,rst,t,data def browser_behavior_number_u(u): d = ...
code_fim
hard
{ "lang": "python", "repo": "hadoop73/sklearn", "path": "/predict_risk/feature/browser_history_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: user = User(first_name=request.POST.get('first_name'), last_name=request.POST.get( 'last_name'), email=request.POST.get('email'), username=request.POST.get('email')) user.set_password(request.POST.get('password')) user.save() except ...
code_fim
medium
{ "lang": "python", "repo": "KRNK97/Dummy-Course-Model", "path": "/users/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KRNK97/Dummy-Course-Model path: /users/views.py from django.shortcuts import render, HttpResponseRedirect, HttpResponse from django.views.generic import View from django.contrib.auth import login from django.contrib.auth.models import User class RegisterView(View): def get(self, request): ...
code_fim
medium
{ "lang": "python", "repo": "KRNK97/Dummy-Course-Model", "path": "/users/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class HomeView(View): def get(self, request): return HttpResponse(f"Home Page | Logged in as - {request.user}")<|fim_prefix|># repo: KRNK97/Dummy-Course-Model path: /users/views.py from django.shortcuts import render, HttpResponseRedirect, HttpResponse from django.views.generic import View fr...
code_fim
hard
{ "lang": "python", "repo": "KRNK97/Dummy-Course-Model", "path": "/users/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>url = "https://www.python.org/" resp = requests.get(url) print(resp) # 200, 정상 동작 url2 = "https://www.python.org/1" resp2 = requests.get(url2) print(resp2) # 404 error, 해당 페이지를 찾을 수 없음<|fim_prefix|># repo: yoongyoonge/python_100Q path: /code/1. Web_Scraping/001.py # 001. 웹 서버에 요청하고 응답받기 # 학습 내용 : 웹 서버에 ...
code_fim
easy
{ "lang": "python", "repo": "yoongyoonge/python_100Q", "path": "/code/1. Web_Scraping/001.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>url2 = "https://www.python.org/1" resp2 = requests.get(url2) print(resp2) # 404 error, 해당 페이지를 찾을 수 없음<|fim_prefix|># repo: yoongyoonge/python_100Q path: /code/1. Web_Scraping/001.py # 001. 웹 서버에 요청하고 응답받기 # 학습 내용 : 웹 서버에 접속하여 웹 페이지 정보를 요청하고 서버로부터 응답 객체를 받는 과정을 이해한다. # 힌트 내용 : requests 모듈의 get() 함수에 접속하려...
code_fim
medium
{ "lang": "python", "repo": "yoongyoonge/python_100Q", "path": "/code/1. Web_Scraping/001.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yoongyoonge/python_100Q path: /code/1. Web_Scraping/001.py # 001. 웹 서버에 요청하고 응답받기 # 학습 내용 : 웹 서버에 접속하여 웹 페이지 정보를 요청하고 서버로부터 응답 객체를 받는 과정을 이해한다. # 힌트 내용 : requests 모듈의 get() 함수에 접속하려는 웹 페이지의 주소(URL)를 입력한다. <|fim_suffix|>url2 = "https://www.python.org/1" resp2 = requests.get(url2) print(resp2) # 4...
code_fim
medium
{ "lang": "python", "repo": "yoongyoonge/python_100Q", "path": "/code/1. Web_Scraping/001.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: beomjungil/notion-as-ticket-system path: /app/routers/go.py from fastapi import APIRouter, Depends from fastapi.responses import RedirectResponse <|fim_suffix|> router = APIRouter( prefix="/go", ) @router.get("/{prefix_id}") def redirect_to_board(project: Project = Depends(get_project_by_p...
code_fim
medium
{ "lang": "python", "repo": "beomjungil/notion-as-ticket-system", "path": "/app/routers/go.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ticket_id: str, project: Project = Depends(get_project_by_prefix) ): ticket = project.query_ticket(ticket_id=ticket_id) notion_url = setting.notion_base_url + ticket.id.replace("-", "") return RedirectResponse(url=notion_url)<|fim_prefix|># repo: beomjungil/notion-as-ticket-system path: /...
code_fim
medium
{ "lang": "python", "repo": "beomjungil/notion-as-ticket-system", "path": "/app/routers/go.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('post', '0014_profilepic_user'), ] operations = [ migrations.CreateModel( name='profile_pic', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ...
code_fim
medium
{ "lang": "python", "repo": "Shariar13/Django_find-doctor", "path": "/post/migrations/0015_profile_pic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Shariar13/Django_find-doctor path: /post/migrations/0015_profile_pic.py # Generated by Django 3.1.2 on 2021-02-13 14:40 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.CreateModel( name='profile_pic', fields=[ ...
code_fim
medium
{ "lang": "python", "repo": "Shariar13/Django_find-doctor", "path": "/post/migrations/0015_profile_pic.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('post', '0014_profilepic_user'), ] operations = [ migrations.CreateModel( name='profile_pic', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), (...
code_fim
medium
{ "lang": "python", "repo": "Shariar13/Django_find-doctor", "path": "/post/migrations/0015_profile_pic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: questonit/numerical-methods path: /1.py import numpy as np import math a = [ [0.54, -0.04, 0.10], [-0.04, 0.50, 0.12], [0.10, 0.12, 0.71] ] b = [0.33, -0.05, 0.28] # Метод Гаусса def gauss(left, right, prec=3): # Создаем расширенную матрицу arr = np.concatenate((np.array(le...
code_fim
hard
{ "lang": "python", "repo": "questonit/numerical-methods", "path": "/1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def norm_3(matrix): data = np.square(np.array(matrix).flatten()) return math.sqrt(np.sum(data)) def converges(matrix): return norm_1(matrix) < 1 or norm_2(matrix) < 1 or norm_3(matrix) < 1 # Метод простой итерации def iteration(left, right, eps=0.0001, prec=5): # Формируем матрицу Альфа...
code_fim
hard
{ "lang": "python", "repo": "questonit/numerical-methods", "path": "/1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dev-Cloud-Platform/Dev-Cloud path: /dev_cloud/web_service/templatetags/form_tags.py # -*- coding: utf-8 -*- # @COPYRIGHT_begin # # Copyright [2015] Michał Szczygieł, M4GiK Software # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance...
code_fim
medium
{ "lang": "python", "repo": "Dev-Cloud-Platform/Dev-Cloud", "path": "/dev_cloud/web_service/templatetags/form_tags.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @register.inclusion_tag('tags/sendForm.html') def show_sendform(form): """ Renders given form without marking required fields. @param form: @return: """ return {'form': form, 'required_fields': True} @register.inclusion_tag('tags/loginForm.html') def show_loginform(form): ""...
code_fim
hard
{ "lang": "python", "repo": "Dev-Cloud-Platform/Dev-Cloud", "path": "/dev_cloud/web_service/templatetags/form_tags.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> sheet = workbook.add_sheet(unit_info, cell_overwrite_ok=True) begin_row = 0 for i in range(len(result)): try: if is_alphabet(result[i][1][0]): sheet.write(begin_row, ENGLISH_WORD, label=result[i][1]) sheet.write(begin_row, CHINESE_TRANSLATE, ...
code_fim
hard
{ "lang": "python", "repo": "lipengallan/code", "path": "/mypython/word.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lipengallan/code path: /mypython/word.py #!/usr/bin/env python #coding:utf-8 import sys import time reload(sys) sys.setdefaultencoding('utf8') from bs4 import BeautifulSoup import requests import csv import codecs import xlwt #from word_power_dict import get_url_dict #from Vocabulary_Toefl_MP3s_...
code_fim
hard
{ "lang": "python", "repo": "lipengallan/code", "path": "/mypython/word.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result = [] for one_url in urls: content = check_link(one_url) soup = BeautifulSoup(content, 'lxml') trs = soup.find_all('tr') for tr in trs: ui = [] for td in tr: ui.append(td.string) result.append(ui) tim...
code_fim
hard
{ "lang": "python", "repo": "lipengallan/code", "path": "/mypython/word.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Given decomposition: List[Tuple[int, str]] = [(234, 'ns')] # When parsed_duration: str = parse_decomposed_duration(decomposition) # Then expected_parsed_duration: str = '234 ns' self.assertEqual(expected_parsed_duration, parsed_duration) def...
code_fim
hard
{ "lang": "python", "repo": "sofienealouini/advent-of-code-2020", "path": "/solutions/python/tests/test_common/test_timing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Then expected_parsed_duration: str = '45.001 s' self.assertEqual(expected_parsed_duration, parsed_duration) def test_parse_decomposed_duration_min(self): # Given decomposition: List[Tuple[int, str]] = [(1, 'min'), (5, 's'), (1, 'ms'), (23, 'μs'), (456, 'ns')]...
code_fim
hard
{ "lang": "python", "repo": "sofienealouini/advent-of-code-2020", "path": "/solutions/python/tests/test_common/test_timing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sofienealouini/advent-of-code-2020 path: /solutions/python/tests/test_common/test_timing.py from typing import List, Tuple from unittest import TestCase from solutions.python.common.timing import decompose, parse_decomposed_duration, format_duration class TestTiming(TestCase): def test_de...
code_fim
hard
{ "lang": "python", "repo": "sofienealouini/advent-of-code-2020", "path": "/solutions/python/tests/test_common/test_timing.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: danluu/dump path: /terra/wat.py import json parsed = {} with open('/Users/danluu/dev/dump/terra/filtered_events.json','r') as f: # with open('/Users/danluu/dev/dump/terra/game-data/2017-05.json','r') as f: # with open('/Users<|fim_suffix|>arsed, indent=2)) print(json.dumps(parsed["4pLeague_S1_...
code_fim
medium
{ "lang": "python", "repo": "danluu/dump", "path": "/terra/wat.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>arsed, indent=2)) print(json.dumps(parsed["4pLeague_S1_D1L1_G4"]["events"]["faction"], indent=2))<|fim_prefix|># repo: danluu/dump path: /terra/wat.py import json parsed = {} with open('/Users/danluu/dev/dump/terra/filtered_events.json','r') as f<|fim_middle|>: # with open('/Users/danluu/dev/dump/terr...
code_fim
medium
{ "lang": "python", "repo": "danluu/dump", "path": "/terra/wat.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Intey/banking path: /backend/groups/models.py # -*- coding: utf-8 -*- from django.db import models from backend.models.account import Account from string import Template out = Template("$account: $parts") class Group(models.Model): name = models.CharField(max_length=100) <|fim_suffix|...
code_fim
hard
{ "lang": "python", "repo": "Intey/banking", "path": "/backend/groups/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return out.substitute(account=self.account, parts=self.parts) class Meta: unique_together = ('account', 'parts', 'group')<|fim_prefix|># repo: Intey/banking path: /backend/groups/models.py # -*- coding: utf-8 -*- from django.db import models from backend.mode...
code_fim
hard
{ "lang": "python", "repo": "Intey/banking", "path": "/backend/groups/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#print 4 perfect numbers in range if total==value: print(value) num_perfect +=1 if num_perfect > 4: break<|fim_prefix|># repo: ivannarodriguez/CS-108 path: /lab05/find_perfects.py '''Finding Perfect Numbers 3/2/17 @author: Annalane Miller (asm9) and Ivanna Rodrigue...
code_fim
hard
{ "lang": "python", "repo": "ivannarodriguez/CS-108", "path": "/lab05/find_perfects.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ivannarodriguez/CS-108 path: /lab05/find_perfects.py '''Finding Perfect Numbers 3/2/17 @author: Annalane Miller (asm9) and Ivanna Rodriguez (imr6)''' <|fim_suffix|> total= sum(divisors) #print 4 perfect numbers in range if total==value: print(value) num_perfect +=1 ...
code_fim
hard
{ "lang": "python", "repo": "ivannarodriguez/CS-108", "path": "/lab05/find_perfects.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: guoliangxd/interview path: /huawei/Python/getGC.py def getGC(st): n = 0 for char in st: if char == 'C' or char == 'G': n += 1 retur<|fim_suffix|> maxLen = getGC(sub) subDNA = sub print(subDNA) except: break<|fim_m...
code_fim
hard
{ "lang": "python", "repo": "guoliangxd/interview", "path": "/huawei/Python/getGC.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> maxLen = getGC(sub) subDNA = sub print(subDNA) except: break<|fim_prefix|># repo: guoliangxd/interview path: /huawei/Python/getGC.py def getGC(st): n = 0 for char in st: if char == 'C' or char == 'G': n += 1 retur<|fim_m...
code_fim
hard
{ "lang": "python", "repo": "guoliangxd/interview", "path": "/huawei/Python/getGC.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Hossain-Shah/Project path: /wellnymedicalservices/doctors/forms.py from django import forms from .models import Diagnosis, TODOItem <|fim_suffix|> class Meta: model = Diagnosis fields = ['name', 'Rostered_physician', 'condition', 'details', 'date_of_diagnosis', 'content...
code_fim
easy
{ "lang": "python", "repo": "Hossain-Shah/Project", "path": "/wellnymedicalservices/doctors/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = TODOItem fields = ['job', 'due_date', 'medication_details', 'completed']<|fim_prefix|># repo: Hossain-Shah/Project path: /wellnymedicalservices/doctors/forms.py from django import forms from .models import Diagnosis, TODOItem <|fim_middle|>class Diagnosis...
code_fim
hard
{ "lang": "python", "repo": "Hossain-Shah/Project", "path": "/wellnymedicalservices/doctors/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># TODO (wardlt): Move to the MPNN library? class GraphLoader(tf.keras.utils.Sequence): """Keras-compatible data loader for training a graph problem""" def __init__(self, smiles: List[str], atom_types: List[int], bond_types: List[str], outputs: List[float], batch_size: int, shuffl...
code_fim
hard
{ "lang": "python", "repo": "tskluzac/colmena", "path": "/molecule-design/moldesign/score/mpnn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tskluzac/colmena path: /molecule-design/moldesign/score/mpnn.py """Functions for updating and performing bulk inference using an Keras MPNN model""" from typing import List, Dict, Tuple import numpy as np import tensorflow as tf from molgym.mpnn.data import convert_nx_to_dict from molgym.mpnn.la...
code_fim
hard
{ "lang": "python", "repo": "tskluzac/colmena", "path": "/molecule-design/moldesign/score/mpnn.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Get the molecules and outputs out mols, y = zip(*chunk) x = _merge_batch(mols) return x, np.array(y) def __len__(self): # Get the number of batches train_size = len(self.entries) n_batches = train_size // self.batch_size # Add a parti...
code_fim
hard
{ "lang": "python", "repo": "tskluzac/colmena", "path": "/molecule-design/moldesign/score/mpnn.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: szabo137/pySnippets path: /testPyScaffold/sfTrident/tests/tobiasLib/A_Funktion.py from Config_paar import * from Envelopefkt import * from Kinematik import * def A_m_n(M,N,x_plus,p_el,p_pos,k_photon,k_laser): def f1(p): return -(m*a0)/(pk(p)) * g(phi,sigma,Envelope) *( pe(1,p) * co...
code_fim
hard
{ "lang": "python", "repo": "szabo137/pySnippets", "path": "/testPyScaffold/sfTrident/tests/tobiasLib/A_Funktion.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> phi = w_laser * x_plus H_plus = s*phi - f(p_el) + f(-p_pos) A = g(phi,sigma,Envelope)**M *exp( 1j* ( H_plus + N*phi)) return A def A_0_0 (A11,A1_1,A20,A22,A2_2): p_pos,p_el,k_laser,k_photon,q_pos,eps_m,eps_p = kinematik() pk =...
code_fim
hard
{ "lang": "python", "repo": "szabo137/pySnippets", "path": "/testPyScaffold/sfTrident/tests/tobiasLib/A_Funktion.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HammadBukhari/F20-44-D-SmartSlides path: /SmartSlidesML/dataset_creation_functions/text_xml.py import glob import os import xml.etree.ElementTree as ET file_dirs = ["train/","test/"] for file_dir in file_dirs: fdir = "custom_dataset/" + file_dir for directory in os.listdir(fdir): ...
code_fim
hard
{ "lang": "python", "repo": "HammadBukhari/F20-44-D-SmartSlides", "path": "/SmartSlidesML/dataset_creation_functions/text_xml.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> root[1].text = name frame_name = root[2].text[root[2].text.rfind('/') +1:] root[2].text = (new_location + "/" + frame_name) tree.write(fdir + directory + "/" + frame_name[:-4] + '.xml')<|fim_prefix|># repo: HammadBukhari/F20-44-D-SmartSlides path: /SmartSlid...
code_fim
hard
{ "lang": "python", "repo": "HammadBukhari/F20-44-D-SmartSlides", "path": "/SmartSlidesML/dataset_creation_functions/text_xml.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print("Group n: {} count: {}".format(currentGroup.n, currentGroup.amount)) bar = Bar(el[0], nodes[int(el[1])-1], nodes[int(el[2])-1], groups[groupCounter]) print( """ Bar {} created Start node: {} End Node: {} Group: {} """.fo...
code_fim
hard
{ "lang": "python", "repo": "transcal-proj2/proj1", "path": "/reader.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif section == 'loads': if len(el) == 1: result[section]['count'] = el[0] else: load = Load(el[1], el[2]) nodeIndex = next((e for e, item in enumerate( result['coordinates']['nodes']) if item.n == int(el[0])), None ...
code_fim
hard
{ "lang": "python", "repo": "transcal-proj2/proj1", "path": "/reader.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: transcal-proj2/proj1 path: /reader.py from elements import Node, Bar, Material, Group, Load from pprint import pprint # query # next((e for e in result['coordinates']['nodes'] if e.n == int(el[0])), None) class Reader(): def read(self, filePath): """ Reads text file with nodes and re...
code_fim
hard
{ "lang": "python", "repo": "transcal-proj2/proj1", "path": "/reader.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self, request: HttpServletRequest, response: HttpServletResponse, handler: object, ) -> ModelAndView: handler: Controller = handler return handler.handle_request(request, response) def get_last_modified( self, request: HttpServletRequest, ha...
code_fim
medium
{ "lang": "python", "repo": "j40903272/spring-webmvc-python", "path": "/springframework/web/servlet/mvc/SimpleControllerHandlerAdapter.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: j40903272/spring-webmvc-python path: /springframework/web/servlet/mvc/SimpleControllerHandlerAdapter.py from springframework.web.servlet import ModelAndView from springframework.web.servlet.HandlerAdapter import HandlerAdapter from springframework.web.servlet.mvc.Controller import Controller from...
code_fim
hard
{ "lang": "python", "repo": "j40903272/spring-webmvc-python", "path": "/springframework/web/servlet/mvc/SimpleControllerHandlerAdapter.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ziberty/PythonLabyrinthe path: /objets/piece.py from objet import Objet class Piece(Objet): <|fim_suffix|> joueur.addPiece() def depenser(self,joueur): joueur.depenserPiece() def description(self): return "Vous avez trouvé une piece, peut etre trouverez v...
code_fim
medium
{ "lang": "python", "repo": "ziberty/PythonLabyrinthe", "path": "/objets/piece.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ziberty/PythonLabyrinthe path: /objets/piece.py from objet import Objet class Piece(Objet): """ Représente une piece qui permet d'acheter dans la boutique """ <|fim_suffix|> return "Vous avez trouvé une piece, peut etre trouverez vous un marchand"<|fim_middle|> def ramasser(se...
code_fim
medium
{ "lang": "python", "repo": "ziberty/PythonLabyrinthe", "path": "/objets/piece.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def description(self): return "Vous avez trouvé une piece, peut etre trouverez vous un marchand"<|fim_prefix|># repo: ziberty/PythonLabyrinthe path: /objets/piece.py from objet import Objet class Piece(Objet): """ Représente une piece qui permet d'acheter dans la boutique """ de...
code_fim
easy
{ "lang": "python", "repo": "ziberty/PythonLabyrinthe", "path": "/objets/piece.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> metavar='/path/to/testing/image/directory', help="Path to testing image directory") parser.add_argument('--video', required=False, metavar='/path/to/testing/image/directory', help="Path to testing image directory") return parser.parse_args()<|fim_prefix|># repo: qu...
code_fim
hard
{ "lang": "python", "repo": "quanghuy0497/Mask_R-CNN", "path": "/mrcnn/parse_args.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: quanghuy0497/Mask_R-CNN path: /mrcnn/parse_args.py import argparse def parse_args(): """ Parse command-line arguments to train and evaluate a multimodal network for activity recognition on MM-Fit. :return: Populated namespace. """ parser = argparse.ArgumentParser(description...
code_fim
hard
{ "lang": "python", "repo": "quanghuy0497/Mask_R-CNN", "path": "/mrcnn/parse_args.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: onthrak/python_courses path: /chapter9assignment.py name = raw_input("Enter file:") if len(name) < 1 : name = "mbox-short.txt" handle = open(name) x = list() for line in handle: line.split() ## unnesssecary if line.startswith("From "): x.append(line[line.find(" ")+1:line.find(" ",...
code_fim
hard
{ "lang": "python", "repo": "onthrak/python_courses", "path": "/chapter9assignment.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ### print max of numbers mails and name with max numbers of mails for names,vals in counts.items(): if vals == max(counts.values()): print names,vals<|fim_prefix|># repo: onthrak/python_courses path: /chapter9assignment.py name = raw_input("Enter file:") if len(name) < 1 : name = "mbox-short.t...
code_fim
medium
{ "lang": "python", "repo": "onthrak/python_courses", "path": "/chapter9assignment.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: john-science/HadoopWithPython path: /pig/udfs/string_funcs.py from pig_util import outputSchema <|fim_suffix|> """ Return the length of the provided word """ return len(word)<|fim_middle|>@outputSchema('word:chararray') def reverse(word): """ Return the reverse text of the provi...
code_fim
medium
{ "lang": "python", "repo": "john-science/HadoopWithPython", "path": "/pig/udfs/string_funcs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@outputSchema('length:int') def num_chars(word): """ Return the length of the provided word """ return len(word)<|fim_prefix|># repo: john-science/HadoopWithPython path: /pig/udfs/string_funcs.py from pig_util import outputSchema <|fim_middle|>@outputSchema('word:chararray') def reverse(word...
code_fim
medium
{ "lang": "python", "repo": "john-science/HadoopWithPython", "path": "/pig/udfs/string_funcs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pushyzheng/flask-rabbitmq path: /example/producer/app/__init__.py #encoding:utf-8 from flask import Flask import config from flask_rabbitmq import Queue, RabbitMQ <|fim_suffix|>queue = Queue() mq = RabbitMQ(app, queue) from app import demo<|fim_middle|>app = Flask(__name__) app.config.from_obje...
code_fim
easy
{ "lang": "python", "repo": "pushyzheng/flask-rabbitmq", "path": "/example/producer/app/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>queue = Queue() mq = RabbitMQ(app, queue) from app import demo<|fim_prefix|># repo: pushyzheng/flask-rabbitmq path: /example/producer/app/__init__.py #encoding:utf-8 from flask import Flask import config from flask_rabbitmq import Queue, RabbitMQ <|fim_middle|>app = Flask(__name__) app.config.from_obje...
code_fim
easy
{ "lang": "python", "repo": "pushyzheng/flask-rabbitmq", "path": "/example/producer/app/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PMiskew/Year9DesignCS4-PythonPM path: /DWITE Code/DwiteHarshadNumbersPM.py #This program is a nice example of a core algorithm #Remove Individual Digits # To remove individual digits you use two operations # 1 MOD: # mod return the remainder after division. 5%2 = 1. # If we mod by 10 we get th...
code_fim
hard
{ "lang": "python", "repo": "PMiskew/Year9DesignCS4-PythonPM", "path": "/DWITE Code/DwiteHarshadNumbersPM.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>f = open("DwiteHarshadNumbersData.txt", "r") #Python short cut which loops as long as there is a new line in the file for line in f: l = f.readline() h = f.readline() findHarshad(l,h) f.close()<|fim_prefix|># repo: PMiskew/Year9DesignCS4-PythonPM path: /DWITE Code/DwiteHarshadNumbersPM.py #This progr...
code_fim
hard
{ "lang": "python", "repo": "PMiskew/Year9DesignCS4-PythonPM", "path": "/DWITE Code/DwiteHarshadNumbersPM.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ttings.MAX_CHARS, required=False, widget=forms.Textarea(attrs={'rows': 10, 'cols': 80, 'onKeyDown':'return setTimeout(remainingChars('+str(settings.MAX_CHARS)+'), 100);'}))<|fim_prefix|># repo: andrewmil/FeedbackDjango path: /feedback/forms.py from django import forms from django.conf import settings cl...
code_fim
medium
{ "lang": "python", "repo": "andrewmil/FeedbackDjango", "path": "/feedback/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewmil/FeedbackDjango path: /feedback/forms.py from django import forms from django.conf import settings class SurveyFeedback(forms.Form): CHOICES = [('Very Satisfied', 'Very Satisfied'), ('Satisfied', 'Satisfied'), ('Neither', 'Neither'), ('Dissatisfied', 'Dissatisfied'), ('Very Dissatis...
code_fim
medium
{ "lang": "python", "repo": "andrewmil/FeedbackDjango", "path": "/feedback/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('registered_user', '0005_auto_20201029_1710'), ] operations = [ migrations.AlterField( model_name='user_details', name='dateofbirth', field=models.DateField(null=True), ), ]<|fim_prefix|># repo: Mpanshuman/matri...
code_fim
easy
{ "lang": "python", "repo": "Mpanshuman/matrimony", "path": "/registered_user/migrations/0006_auto_20201029_1926.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Mpanshuman/matrimony path: /registered_user/migrations/0006_auto_20201029_1926.py # Generated by Django 3.1.1 on 2020-10-29 13:56 <|fim_suffix|> operations = [ migrations.AlterField( model_name='user_details', name='dateofbirth', field=models.DateFi...
code_fim
medium
{ "lang": "python", "repo": "Mpanshuman/matrimony", "path": "/registered_user/migrations/0006_auto_20201029_1926.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: apurv1205/fastFood path: /scripts/t.py import csv import json,os mylist=[] clist=["Nort<|fim_suffix|>can","South Indian"] for filename in os.listdir("/home/asket/Desktop/DBMS/menu"): print(filename)<|fim_middle|>h Indian","Italian","Continental","Chinese","Mexi
code_fim
easy
{ "lang": "python", "repo": "apurv1205/fastFood", "path": "/scripts/t.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: apurv1205/fastFood path: /scripts/t.py import csv import json,os mylist=[] clist=["North Indian","Italian","Continental","Chinese","Mexi<|fim_suffix|>/home/asket/Desktop/DBMS/menu"): print(filename)<|fim_middle|>can","South Indian"] for filename in os.listdir("
code_fim
easy
{ "lang": "python", "repo": "apurv1205/fastFood", "path": "/scripts/t.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>can","South Indian"] for filename in os.listdir("/home/asket/Desktop/DBMS/menu"): print(filename)<|fim_prefix|># repo: apurv1205/fastFood path: /scripts/t.py import csv import json,os mylist=[] clist=["Nort<|fim_middle|>h Indian","Italian","Continental","Chinese","Mexi
code_fim
easy
{ "lang": "python", "repo": "apurv1205/fastFood", "path": "/scripts/t.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: circuits/circuits path: /tests/web/test_unicode.py #!/usr/bin/env python from http.client import HTTPConnection import pytest from circuits.web import Controller from circuits.web.client import Client, request from .helpers import urlopen class Root(Controller): def index(self): ...
code_fim
hard
{ "lang": "python", "repo": "circuits/circuits", "path": "/tests/web/test_unicode.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_response_headers(webapp): client = Client() client.start() client.fire( request( "GET", "http://%s:%s/response_headers" % ( webapp.server.host, webapp.server.port, ), ), ) while client.response is None: ...
code_fim
hard
{ "lang": "python", "repo": "circuits/circuits", "path": "/tests/web/test_unicode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = 'arg=%E2%86%92' connection.request("POST", "/argument", data, {"Content-type": "application/x-www-form-urlencoded"}) response = connection.getresponse() assert response.status == 200 assert response.reason == "OK" s = response.read() assert s.decode('utf-8') == '\u2192' ...
code_fim
hard
{ "lang": "python", "repo": "circuits/circuits", "path": "/tests/web/test_unicode.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.test_asset.get_absolute_url()<|fim_prefix|># repo: ikang9712/Mayan-EDMS path: /mayan/apps/converter/tests/test_asset_models.py from mayan.apps.testing.tests.base import BaseTestCase from .mixins import AssetTestMixin class AssetModelTestCase( AssetTestMixin, BaseTestCase ): def te...
code_fim
easy
{ "lang": "python", "repo": "ikang9712/Mayan-EDMS", "path": "/mayan/apps/converter/tests/test_asset_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class AssetModelTestCase( AssetTestMixin, BaseTestCase ): def test_asset_get_absolute_url_method(self): self._create_test_asset() self.test_asset.get_absolute_url()<|fim_prefix|># repo: ikang9712/Mayan-EDMS path: /mayan/apps/converter/tests/test_asset_models.py from mayan.apps.t...
code_fim
easy
{ "lang": "python", "repo": "ikang9712/Mayan-EDMS", "path": "/mayan/apps/converter/tests/test_asset_models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ikang9712/Mayan-EDMS path: /mayan/apps/converter/tests/test_asset_models.py from mayan.apps.testing.tests.base import BaseTestCase from .mixins import AssetTestMixin <|fim_suffix|> self.test_asset.get_absolute_url()<|fim_middle|> class AssetModelTestCase( AssetTestMixin, BaseTestCase...
code_fim
medium
{ "lang": "python", "repo": "ikang9712/Mayan-EDMS", "path": "/mayan/apps/converter/tests/test_asset_models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': try: instance_id = sys.argv[1] except IndexError: sys.exit('Specify an instance_id') # Print some info print('Initial Auth Info:') for authtype, params in utils.initial_auth_info(ks.auth.client.session): print(' %s' % authtype) ...
code_fim
medium
{ "lang": "python", "repo": "kamidzi/openstack-policy", "path": "/policy/tasks/user_tasks/delete_vm.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kamidzi/openstack-policy path: /policy/tasks/user_tasks/delete_vm.py #!/usr/bin/env python from ks_auth import sess from ks_auth import trust_auth from ks_auth import ks from ks_auth import utils from novaclient import client import novaclient.exceptions from time import sleep from uuid import uu...
code_fim
hard
{ "lang": "python", "repo": "kamidzi/openstack-policy", "path": "/policy/tasks/user_tasks/delete_vm.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LichUnHappy/Real-time-Anomaly-Detection path: /D4/main.py from fastapi import FastAPI from pydantic import BaseModel from typing import List, Optional from joblib import load app = FastAPI() clf = load("model.joblib") <|fim_suffix|> feature_vector: List[float] score: Optional[bool] = Fal...
code_fim
medium
{ "lang": "python", "repo": "LichUnHappy/Real-time-Anomaly-Detection", "path": "/D4/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> prediction = clf.predict([req.feature_vector]) response = {"is_inlier": int(prediction[0])} score = clf.score_samples([req.feature_vector]) response["anomaly_score"] = score[0] return response @app.get("/model_infomation") def model_infomation(): return clf.get_params() if __nam...
code_fim
medium
{ "lang": "python", "repo": "LichUnHappy/Real-time-Anomaly-Detection", "path": "/D4/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: taohu88/algorithms path: /test_counter/test_counter2.py from collections import Counter # Complete the isValid function below. def isValid(s): if not s: return True <|fim_suffix|> if __name__ == '__main__': s = "ibfdgaeadiaefgbhbdghhhbgdfgeiccbi" r = isValid(s) print(r)...
code_fim
hard
{ "lang": "python", "repo": "taohu88/algorithms", "path": "/test_counter/test_counter2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x = Counter(s) print(x) first_c = x.pop(s[0]) cnt = 0 for k, c in x.items(): if c != first_c: if first_c == 1: cnt += 1 first_c = c else: cnt += abs(c - first_c) if c != 1 else 1 if cnt >= 2: ...
code_fim
medium
{ "lang": "python", "repo": "taohu88/algorithms", "path": "/test_counter/test_counter2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_scripts': [ 'nh-install-node = nodepool_harness.scripts:install_node', ] } )<|fim_prefix|># repo: citrix-openstack/nodepool-harness path: /setup.py from setuptools import setup setup( name='nodepool_harness', version='0.1dev', descrip<|fim_middle|>tion='Nodepool har...
code_fim
hard
{ "lang": "python", "repo": "citrix-openstack/nodepool-harness", "path": "/setup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: citrix-openstack/nodepool-harness path: /setup.py from setuptools import setup setup( name='nodepool_harness', version='0.1dev', descrip<|fim_suffix|>ires=["PyYAML", "python-novaclient", "paramiko", "sqlalchemy"], entry_points = { 'console_scripts': [ 'nh-ins...
code_fim
medium
{ "lang": "python", "repo": "citrix-openstack/nodepool-harness", "path": "/setup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: atsnova/Python-Crash-Course path: /Chap_7.4.py #def pizzaTopping(): message1 = "What Pizza do you want?" message = "What type of Pizza topping do you want?" message += "\n Enter 'quit' to stop entering toppings" pizzas = {} while True: pizza = input(message1) topping = input(message...
code_fim
medium
{ "lang": "python", "repo": "atsnova/Python-Crash-Course", "path": "/Chap_7.4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#return toppings #print(pizzaTopping()) #print('We will add the following toppings: ' + str(toppings)) print(pizzas)<|fim_prefix|># repo: atsnova/Python-Crash-Course path: /Chap_7.4.py #def pizzaTopping(): message1 = "What Pizza do you want?" message = "What type of Pizza topping do you want?" message +=...
code_fim
hard
{ "lang": "python", "repo": "atsnova/Python-Crash-Course", "path": "/Chap_7.4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }