text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>@main.route("/<address>") def user_dashboard(address=None): if len(address) != 34: abort(404) stats = collect_user_stats(address) # reorganize/create the recently viewed recent = session.get('recent_users', []) if address in recent: recent.remove(address) recent.i...
code_fim
hard
{ "lang": "python", "repo": "palon7/simplemona", "path": "/simplecoin/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sreetamparida/Hiraishin path: /Elements/MapRed/MRResult.py import os class MRResult: def __init__(self, config, columns, timeTaken): self.mrResult = {} self.queryResult = [] self.config = config self.columns = columns self.timeTaken = timeTaken <|fi...
code_fim
hard
{ "lang": "python", "repo": "sreetamparida/Hiraishin", "path": "/Elements/MapRed/MRResult.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cleanDirectory = self.config['clean_directory'] cleanHDFS = self.config['clean_hdfs'] os.system(cleanDirectory) os.system(cleanHDFS) return self.mrResult<|fim_prefix|># repo: sreetamparida/Hiraishin path: /Elements/MapRed/MRResult.py import os class MRResult: ...
code_fim
hard
{ "lang": "python", "repo": "sreetamparida/Hiraishin", "path": "/Elements/MapRed/MRResult.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saiihamza/open_data_parsing path: /product/product_compositions.py class ProductCompositions(object): def __init__(self): self.IngredientsTextAllergens = '' self.AllergensFr = '' self.Traces = '' self.TracesTags = '' self.TracesFr = '' <|fim_suff...
code_fim
hard
{ "lang": "python", "repo": "saiihamza/open_data_parsing", "path": "/product/product_compositions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ThatMayBeFromPalmOilTags = '' self.NutritionGradeFr = '' self.NovaGroup = '' self.PnnsGroups1 = '' self.PnnsGroups2 = '' def __str__(self): return self.IngredientsTextAllergens<|fim_prefix|># repo: saiihamza/open_data_parsing path: /product/product_composition...
code_fim
hard
{ "lang": "python", "repo": "saiihamza/open_data_parsing", "path": "/product/product_compositions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from models.runbagofwords import BagofWords<|fim_prefix|># repo: andrew-lockwood/lab-project path: /context.py import os import sys sys.path.insert(0, os.path.abspath('..')) from util.settings import settings from util.progressbar import ProgressBar <|fim_middle|>from corpus.data_loader import DataLoa...
code_fim
medium
{ "lang": "python", "repo": "andrew-lockwood/lab-project", "path": "/context.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from corpus.data_loader import DataLoader from corpus.document_iterator import Documents from corpus.sentence_iterator import LabeledSentences from models.runbagofwords import BagofWords<|fim_prefix|># repo: andrew-lockwood/lab-project path: /context.py import os import sys sys.path.insert(0, os.path.a...
code_fim
medium
{ "lang": "python", "repo": "andrew-lockwood/lab-project", "path": "/context.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrew-lockwood/lab-project path: /context.py import os import sys sys.path.insert(0, os.path.abspath('..')) from util.settings import settings from util.progressbar import ProgressBar <|fim_suffix|>from models.runbagofwords import BagofWords<|fim_middle|>from corpus.data_loader import DataLoa...
code_fim
medium
{ "lang": "python", "repo": "andrew-lockwood/lab-project", "path": "/context.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # switch to train mode model.train() epoch_stats = [] for batch_idx, (data, target) in enumerate(train_loader): data, target = data.to(device), target.to(device) # compute output output = model(data) losses_ = F.nll_loss(output, target, reduction='none') ...
code_fim
hard
{ "lang": "python", "repo": "lanadeji/blog-code", "path": "/pr-lr/cifar.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanadeji/blog-code path: /pr-lr/cifar.py import argparse import os import shutil import time import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torch.utils.data import torch...
code_fim
hard
{ "lang": "python", "repo": "lanadeji/blog-code", "path": "/pr-lr/cifar.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('facilities', '0005_dhisauth'), ('facilities', '0008_merge_20170911_0851'), ] operations = [ ]<|fim_prefix|># repo: SteveWaweru/mfl_api path: /facilities/migrations/0009_merge_20190828_1929.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-08...
code_fim
easy
{ "lang": "python", "repo": "SteveWaweru/mfl_api", "path": "/facilities/migrations/0009_merge_20190828_1929.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('facilities', '0005_dhisauth'), ('facilities', '0008_merge_20170911_0851'), ] operations = [ ]<|fim_prefix|># repo: SteveWaweru/mfl_api path: /facilities/migrations/0009_merge_20190828_1929.py # -*- coding: utf-8 ...
code_fim
easy
{ "lang": "python", "repo": "SteveWaweru/mfl_api", "path": "/facilities/migrations/0009_merge_20190828_1929.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SteveWaweru/mfl_api path: /facilities/migrations/0009_merge_20190828_1929.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-08-28 19:29 from __future__ import unicode_literals <|fim_suffix|> dependencies = [ ('facilities', '0005_dhisauth'), ('facilities', '0008_me...
code_fim
medium
{ "lang": "python", "repo": "SteveWaweru/mfl_api", "path": "/facilities/migrations/0009_merge_20190828_1929.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: 0xbadcoffe/home-automation path: /ti_IOT/testing/pagelayout.py import kivy # base Class of your App inherits from the App class. # app:always refers to the instance of your application from kivy.app import App # The PageLayout class is used to create # a simple multi-page lay...
code_fim
hard
{ "lang": "python", "repo": "0xbadcoffe/home-automation", "path": "/ti_IOT/testing/pagelayout.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ build function here """ layout = GridLayout(cols=2) button_lightON = Button(text="Light ON",background_color=red) button_lightOFF = Button(text="Light OFF",background_color=green) button_fanON = Button(text="Fan ON",background_color=blue) ...
code_fim
hard
{ "lang": "python", "repo": "0xbadcoffe/home-automation", "path": "/ti_IOT/testing/pagelayout.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class PageLayout(PageLayout): """ Define class PageLayout here """ def __init__(self): # The super function in Python can be # used to gain access to inherited methods # which is either from a parent or sibling class. super(PageLayout, ...
code_fim
hard
{ "lang": "python", "repo": "0xbadcoffe/home-automation", "path": "/ti_IOT/testing/pagelayout.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.hi_here = tk.Button(frame,text='hi',fg='blue',command=self.say_hi) self.hi_here.pack()# set the position of frame self.exit = tk.Button(frame,text='exit',fg='blue',command=exit) self.exit.pack()# set the position of frame def say_hi(self): print('Hello wo...
code_fim
medium
{ "lang": "python", "repo": "4ever-blessed/Github_python3_code", "path": "/python_tkinter_study/tk之添加按钮执行命令.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 4ever-blessed/Github_python3_code path: /python_tkinter_study/tk之添加按钮执行命令.py # conda_python3_code import tkinter as tk class APP: def __init__(self,master): frame = tk.Frame(master) frame.pack(side=tk.LEFT,padx=100,pady=100) # set the position of frame self.hi_here ...
code_fim
medium
{ "lang": "python", "repo": "4ever-blessed/Github_python3_code", "path": "/python_tkinter_study/tk之添加按钮执行命令.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> the input print(palindrome.is_palindrome(question))<|fim_prefix|># repo: PingryPython-2017/black_team_palindrome path: /main.py import palindrome # Ask the user for a input. questi<|fim_middle|>on = raw_input("Yo my guy, dish me a string and I will tell you if it is a palindrome or not! ") # Test
code_fim
medium
{ "lang": "python", "repo": "PingryPython-2017/black_team_palindrome", "path": "/main.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: PingryPython-2017/black_team_palindrome path: /main.py import palindrome # Ask the user for a input. questi<|fim_suffix|>ll tell you if it is a palindrome or not! ") # Test the input print(palindrome.is_palindrome(question))<|fim_middle|>on = raw_input("Yo my guy, dish me a string and I wi
code_fim
easy
{ "lang": "python", "repo": "PingryPython-2017/black_team_palindrome", "path": "/main.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: anishkarki/timeseries path: /test.py def count(n): count=0 for i in<|fim_suffix|>.count('7') count=count+value print ("count:",count) count(100)<|fim_middle|> range(n+1): value=str(i)
code_fim
easy
{ "lang": "python", "repo": "anishkarki/timeseries", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print ("count:",count) count(100)<|fim_prefix|># repo: anishkarki/timeseries path: /test.py def count(n): count=0 for i in range(n+1): value=str(i)<|fim_middle|>.count('7') count=count+value
code_fim
easy
{ "lang": "python", "repo": "anishkarki/timeseries", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anishkarki/timeseries path: /test.py def count(n): count=0 for i in range(n+1): value=str(i)<|fim_suffix|> print ("count:",count) count(100)<|fim_middle|>.count('7') count=count+value
code_fim
easy
{ "lang": "python", "repo": "anishkarki/timeseries", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sceptre/sceptre-core path: /sceptre/file_manager/__init__.py import copy import fnmatch import logging import re import os from sceptre.file_manager.file_handler import FileHandler from sceptre.file_manager import strategies class FileManager: def __init__(self, context): self.log...
code_fim
hard
{ "lang": "python", "repo": "Sceptre/sceptre-core", "path": "/sceptre/file_manager/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __walk(self, root, pattern): items = [] for directory_name, sub_directories, files in os.walk( root, topdown=False, followlinks=True): for filename in fnmatch.filter(files, '*.yaml'): if re.match(pattern, filename): it...
code_fim
hard
{ "lang": "python", "repo": "Sceptre/sceptre-core", "path": "/sceptre/file_manager/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: iblislin/pyvalid path: /pyvalid/__exceptions.py class InvalidArgumentNumberError(ValueError): """Raised when the number or position of arguments supplied to a function is incorrect. """ def __init__(self, func_name): self.error = 'Invalid number or position of arguments fo...
code_fim
medium
{ "lang": "python", "repo": "iblislin/pyvalid", "path": "/pyvalid/__exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.error = 'Invalid return type {} for {}()'.format( return_type, func_name ) def __str__(self): return self.error<|fim_prefix|># repo: iblislin/pyvalid path: /pyvalid/__exceptions.py class InvalidArgumentNumberError(ValueError): """Raised when the number or...
code_fim
hard
{ "lang": "python", "repo": "iblislin/pyvalid", "path": "/pyvalid/__exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #test------------------------------------softmax for i in range(0,len(score_res)): score_res[i]=1 / (1 + math.exp(-score_res[i])) test_label1 = np.array(score_res) barSoftMax=0.5 ind_pos1 = test_label1 >= barSoftMax ind_neg1 = test_label1...
code_fim
hard
{ "lang": "python", "repo": "ayushgoyaal/GAN_With_Content_And_Structure", "path": "/src/evaluation/eval_link_prediction.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ayushgoyaal/GAN_With_Content_And_Structure path: /src/evaluation/eval_link_prediction.py """ The class is used for evaluating the application of link prediction """ import numpy as np from sklearn.metrics import precision_score,recall_score,f1_score from sklearn.metrics import accuracy_score imp...
code_fim
hard
{ "lang": "python", "repo": "ayushgoyaal/GAN_With_Content_And_Structure", "path": "/src/evaluation/eval_link_prediction.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#Install all flows in table def prepareRIDTable(dp,ranges,servers,numOfClients): for i in range(0, len(ranges)): dp.send_msg(createFourthTableFlow(ranges[i], i, dp,servers,numOfClients))<|fim_prefix|># repo: lironsc/ORange path: /ORange1_LoadBalancers/Project1/Controller/Split/RidsTable.p...
code_fim
hard
{ "lang": "python", "repo": "lironsc/ORange", "path": "/ORange1_LoadBalancers/Project1/Controller/Split/RidsTable.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lironsc/ORange path: /ORange1_LoadBalancers/Project1/Controller/Split/RidsTable.py import Flow,Range from ryu.ofproto import ofproto_v1_3 #This file contains all the logic for populating the last table, used for the balancing of traffic <|fim_suffix|> ofproto=ofproto_v1_3 parser = datapa...
code_fim
medium
{ "lang": "python", "repo": "lironsc/ORange", "path": "/ORange1_LoadBalancers/Project1/Controller/Split/RidsTable.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: warehouse-picking-automation-challenges/team_pfn path: /json-examples/item_distribution_generator.py # Copyright 2016 Preferred Networks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a ...
code_fim
hard
{ "lang": "python", "repo": "warehouse-picking-automation-challenges/team_pfn", "path": "/json-examples/item_distribution_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>bins = ["bin_A","bin_B","bin_C","bin_D","bin_E","bin_F","bin_G","bin_H","bin_I","bin_J","bin_K","bin_L"] nums = [2,7,4,1,4,3,2,9,5,2,3,4] for piyo in range(100): items = np.random.permutation(items) nums = np.random.permutation(nums) hoge = {} hoge['bin_contents'] = {} cnt = 0 ...
code_fim
hard
{ "lang": "python", "repo": "warehouse-picking-automation-challenges/team_pfn", "path": "/json-examples/item_distribution_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def execute_running(self): win_eval = robocup.WindowEvaluator(main.context()) win_eval.debug = True windows, best = win_eval.eval_pt_to_our_goal(main.ball().pos)<|fim_prefix|># repo: tcontis/robocup-software path: /soccer/gameplay/plays/testing/debug_window_evaluator.py import...
code_fim
medium
{ "lang": "python", "repo": "tcontis/robocup-software", "path": "/soccer/gameplay/plays/testing/debug_window_evaluator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(continuous=True) self.add_transition(behavior.Behavior.State.start, behavior.Behavior.State.running, lambda: True, 'immediately') def execute_running(self): win_eval = robocup.WindowEvaluator(main.contex...
code_fim
medium
{ "lang": "python", "repo": "tcontis/robocup-software", "path": "/soccer/gameplay/plays/testing/debug_window_evaluator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tcontis/robocup-software path: /soccer/gameplay/plays/testing/debug_window_evaluator.py import play import behavior import main import robocup import constants import time import math <|fim_suffix|> self.add_transition(behavior.Behavior.State.start, behavior.Be...
code_fim
hard
{ "lang": "python", "repo": "tcontis/robocup-software", "path": "/soccer/gameplay/plays/testing/debug_window_evaluator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thanhchatvn/addons path: /hw_escpos_network_printer/controllers/main.py # -*- coding: utf-8 -*- import logging import time from odoo import http from . import hw_escpos as hwEscpos try: from ..escpos import escpos as Escpos, exceptions as E, printer as Printer except ImportError: Escp...
code_fim
hard
{ "lang": "python", "repo": "thanhchatvn/addons", "path": "/hw_escpos_network_printer/controllers/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ define the printer to connect to """ connected = {'ip': self.ip, 'port': self.port} return connected def get_escpos_printer(self): printers = None if self.ip and self.port: printers = self.connected_network_devices() if printers: ...
code_fim
hard
{ "lang": "python", "repo": "thanhchatvn/addons", "path": "/hw_escpos_network_printer/controllers/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaityo256/lammps_position path: /generate_config.py import numpy as np class Atom: def __init__(self, x, y, z): self.x = x self.y = y self.z = z self.type = 1 self.vx = 0.0 self.vy = 0.0 self.vz = 0.0 <|fim_suffix|>if __n...
code_fim
hard
{ "lang": "python", "repo": "kaityo256/lammps_position", "path": "/generate_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with open(filename, "w") as f: f.write("Position Data\n\n") f.write("{} atoms\n".format(len(atoms))) f.write("1 atom types\n\n") f.write(f"{lo} {hi} xlo xhi\n") f.write(f"{lo} {hi} ylo yhi\n") f.write(f"{lo} {hi} zlo zhi\n") f.write("\n") ...
code_fim
medium
{ "lang": "python", "repo": "kaityo256/lammps_position", "path": "/generate_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chemprop/chemprop path: /scripts/examine_split_balance.py import os import pickle from pprint import pprint import sys from typing_extensions import Literal import numpy as np from tap import Tap # pip install typed-argument-parser (https://github.com/swansonk14/typed-argument-parser) sys.path...
code_fim
hard
{ "lang": "python", "repo": "chemprop/chemprop", "path": "/scripts/examine_split_balance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def examine_split_balance(split_type: str): results = [] for dataset in DATASETS: # Load task names for the dataset data_path = os.path.join(BASE, dataset, f'{dataset}.csv') data = get_data(data_path) # Get class balance ratios for full dataset ratios = c...
code_fim
hard
{ "lang": "python", "repo": "chemprop/chemprop", "path": "/scripts/examine_split_balance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> nonlocal calls start = datetime.now() result = func(*args, **kwargs) print('Call ' + str(calls) + ' of ' + func.__name__, datetime.now() - start) calls = calls + 1 return result return wrapper<|fim_prefix|># repo: adrianoff/python_learning path: /fluent...
code_fim
easy
{ "lang": "python", "repo": "adrianoff/python_learning", "path": "/fluent_python_book/07-decorators/time_decorator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adrianoff/python_learning path: /fluent_python_book/07-decorators/time_decorator.py from datetime import datetime def my_timeit(func): calls = 1 <|fim_suffix|> nonlocal calls start = datetime.now() result = func(*args, **kwargs) print('Call ' + str(calls) + '...
code_fim
easy
{ "lang": "python", "repo": "adrianoff/python_learning", "path": "/fluent_python_book/07-decorators/time_decorator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Remediator that calls another Lambda function to remediate an alert. """ def __init__(self, lambda_client, alert_to_function_mapping): self.lambda_client = lambda_client self.alert_to_function_mapping = alert_to_function_mapping def can_remediate(self, alert_notif...
code_fim
medium
{ "lang": "python", "repo": "pimlock/macie-remediation-sam", "path": "/code/src/macie_remediation/remediators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: pimlock/macie-remediation-sam path: /code/src/macie_remediation/remediators.py import logging from abc import abstractmethod logger = logging.getLogger(__name__) class Remediator: """ Interface for remediator. It decides which alerts it can handle and then provides option to handl...
code_fim
hard
{ "lang": "python", "repo": "pimlock/macie-remediation-sam", "path": "/code/src/macie_remediation/remediators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shubham3121/PySyft-TensorFlow path: /syft_tensorflow/syft_types/tensor.py import weakref import tensorflow as tf import syft from syft.generic.tensor import AbstractTensor from syft.workers.base import BaseWorker from syft.generic.pointers.pointer_tensor import PointerTensor from syft.exceptio...
code_fim
hard
{ "lang": "python", "repo": "shubham3121/PySyft-TensorFlow", "path": "/syft_tensorflow/syft_types/tensor.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> big_repr = False if self.tags is not None and len(self.tags): big_repr = True out += "\n\tTags: " for tag in self.tags: out += str(tag) + " " if self.description is not None: big_repr ...
code_fim
hard
{ "lang": "python", "repo": "shubham3121/PySyft-TensorFlow", "path": "/syft_tensorflow/syft_types/tensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return out @classmethod def handle_func_command(cls, command): """ Operates as a router for functions. A function call always starts by being handled here and 3 scenarii must be considered: Real TensorFlow tensor: The arguments of the funct...
code_fim
hard
{ "lang": "python", "repo": "shubham3121/PySyft-TensorFlow", "path": "/syft_tensorflow/syft_types/tensor.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": reader = BarCodeReader(0x03eb, 0x6201, 84, 6, should_reset=True) reader.initialize() print(reader.read().strip()) reader.disconnect()<|fim_prefix|># repo: hacker-h/pyusb-keyboard-alike path: /lindy_bar_code_scanner.py from keyboard_alike import reader class Ba...
code_fim
hard
{ "lang": "python", "repo": "hacker-h/pyusb-keyboard-alike", "path": "/lindy_bar_code_scanner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hacker-h/pyusb-keyboard-alike path: /lindy_bar_code_scanner.py from keyboard_alike import reader class BarCodeReader(reader.Reader): <|fim_suffix|> if __name__ == "__main__": reader = BarCodeReader(0x03eb, 0x6201, 84, 6, should_reset=True) reader.initialize() print(reader.read().str...
code_fim
hard
{ "lang": "python", "repo": "hacker-h/pyusb-keyboard-alike", "path": "/lindy_bar_code_scanner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: grvsmth/anno2-storage path: /anno2/urls.py """anno2 URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/1.10/topics/http/urls/ Examples: Function views 1. Add an import: from my_app import views 2. Add a U...
code_fim
hard
{ "lang": "python", "repo": "grvsmth/anno2-storage", "path": "/anno2/urls.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ url(r'^accounts/', include('registration.backends.default.urls')), url(r'^admin/', admin.site.urls), url(r'^auth/token$', views.token, name='token'), url(r'^store/', include(router.urls)), url( r'^api-auth/', include('rest_framework.urls', namespace='res...
code_fim
hard
{ "lang": "python", "repo": "grvsmth/anno2-storage", "path": "/anno2/urls.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if opçãoInicial == "4": print('Certo, você escolheu a opção: "Atualizar cadastro"\n') id4 = input("Qual o ID do cadastro que você quer atualizar? ") resposta4 = input("Qual informação você quer atualizar? \n1 - Nome\n2 - Idade\n3 - Endereço\n4 - Whatsapp\n\nResponda:") cursor4 = "UPD...
code_fim
hard
{ "lang": "python", "repo": "tiagodevss/CRUD-python", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tiagodevss/CRUD-python path: /main.py #imports import pymysql import InterfaceCRUD #PySimpleGUI InterfaceCRUD #MySQL conexão = pymysql.connect( host = "localhost", user = "root", password = "", database = "clientes" ) cursor = conexão.cursor() #script print("\n...
code_fim
hard
{ "lang": "python", "repo": "tiagodevss/CRUD-python", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Parameters ---------- url : str URL to the dataset in CSV format. Returns ------- pandas.DataFrame The dataset. """ print(f'fetching dataset at {url}') return pandas_impl.read_csv(url)<|fim_prefix|># repo: dfarrow0/delphi-epidata path: /src/acquisition/co...
code_fim
hard
{ "lang": "python", "repo": "dfarrow0/delphi-epidata", "path": "/src/acquisition/covid_hosp/network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dfarrow0/delphi-epidata path: /src/acquisition/covid_hosp/network.py # third party import pandas import requests class Network: METADATA_URL = ( 'https://healthdata.gov/api/3/action/package_show' '?id=83b4a668-9321-4d8c-bc4f-2bef66c49050&page=0' ) def fetch_metadata(requests_imp...
code_fim
medium
{ "lang": "python", "repo": "dfarrow0/delphi-epidata", "path": "/src/acquisition/covid_hosp/network.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print(f'fetching metadata at {Network.METADATA_URL}') return requests_impl.get(Network.METADATA_URL).json() def fetch_dataset(url, pandas_impl=pandas): """Download and return a dataset. Parameters ---------- url : str URL to the dataset in CSV format. Returns ---...
code_fim
medium
{ "lang": "python", "repo": "dfarrow0/delphi-epidata", "path": "/src/acquisition/covid_hosp/network.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KaloyankerR/python-fundamentals-repository path: /Assignments/Lists Basics/Exercise/06. Survival of the Biggest.py int_list = input().split(' ') n = int(input()) <|fim_suffix|>for i in range(n): int_list.remove(min(int_list)) print(int_list)<|fim_middle|>for i in range(0, len(int_list)): ...
code_fim
medium
{ "lang": "python", "repo": "KaloyankerR/python-fundamentals-repository", "path": "/Assignments/Lists Basics/Exercise/06. Survival of the Biggest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for i in range(n): int_list.remove(min(int_list)) print(int_list)<|fim_prefix|># repo: KaloyankerR/python-fundamentals-repository path: /Assignments/Lists Basics/Exercise/06. Survival of the Biggest.py int_list = input().split(' ') n = int(input()) <|fim_middle|>for i in range(0, len(int_list)): ...
code_fim
medium
{ "lang": "python", "repo": "KaloyankerR/python-fundamentals-repository", "path": "/Assignments/Lists Basics/Exercise/06. Survival of the Biggest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: data61/MP-SPDZ path: /compile.py #!/usr/bin/env python3 # ===== Compiler usage instructions ===== # # ./compile.py input_file # # will compile Programs/Source/input_file.mpc onto # Programs/Bytecode/input_file.bc and Programs/Schedules/input_file.sch # # (run with --help for more options) #...
code_fim
medium
{ "lang": "python", "repo": "data61/MP-SPDZ", "path": "/compile.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> compiler.prep_compile() if compiler.options.profile: import cProfile p = cProfile.Profile().runctx("compilation(compiler)", globals(), locals()) p.dump_stats(compiler.args[0] + ".prof") p.print_stats(2) else: compilation(compiler) if __name__ == "__ma...
code_fim
hard
{ "lang": "python", "repo": "data61/MP-SPDZ", "path": "/compile.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: steinitzu/spoffy path: /spoffy/io/requests.py from typing import Optional import requests from spoffy.models import Token from spoffy.client.base import SyncClient, ClientCommon from spoffy.sansio import Request, Response from spoffy.spotify import SyncSpotify class RequestsClient(SyncClient)...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/spoffy", "path": "/spoffy/io/requests.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> resp = self.session.request( method=request.method, url=request.url, data=request.body, headers=request.headers, ) response = Response( request, resp.status_code, resp.headers, resp.content ) response.raise...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/spoffy", "path": "/spoffy/io/requests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> *, session: Optional[requests.Session] = None, access_token: Optional[str] = None, token: Optional[Token] = None, client_id: Optional[str] = None, client_secret: Optional[str] = None, redirect_uri: Optional[str] = None, scope: Optional[str] = None, state: Optional[str] ...
code_fim
hard
{ "lang": "python", "repo": "steinitzu/spoffy", "path": "/spoffy/io/requests.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #let external paint program go syncf=open(AppFiles.sync_filepath, 'w') syncf.write("extpaint") syncf.close() return {'PASS_THROUGH'} ### Switch Modes class IMAGE_OT_blenderextpaint_autorefresh_switch_mode(bpy.types.O...
code_fim
hard
{ "lang": "python", "repo": "zNightlord/Blender-ExternalPaintReloaded", "path": "/Blender/Paint_Operators.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> #make sure autorefresh is not already active if context.scene.blenderextpaint_autorefresh_active==True: return {'CANCELLED'} context.scene.blenderextpaint_autorefresh_active=True IMAGE_OT_blenderextpaint_autorefresh_status.status = "Active: external paint" #setup fi...
code_fim
hard
{ "lang": "python", "repo": "zNightlord/Blender-ExternalPaintReloaded", "path": "/Blender/Paint_Operators.py", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|># repo: zNightlord/Blender-ExternalPaintReloaded path: /Blender/Paint_Operators.py import os import bpy from mathutils import * #from .UI_Panel import IMAGEUI_PT_Paint ### Helper things ########################## #class that sets up files ########################## class AppFiles: sync...
code_fim
hard
{ "lang": "python", "repo": "zNightlord/Blender-ExternalPaintReloaded", "path": "/Blender/Paint_Operators.py", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|># repo: otus-devops-2019-02/devopscourses_infra path: /venv/lib/python2.7/site-packages/yamllint/rules/document_start.py # -*- coding: utf-8 -*- # Copyright (C) 2016 Adrien Vergé # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public Licens...
code_fim
hard
{ "lang": "python", "repo": "otus-devops-2019-02/devopscourses_infra", "path": "/venv/lib/python2.7/site-packages/yamllint/rules/document_start.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> this: is: [a, document] ... the following code snippet would **FAIL**: :: --- this: is: [a, document] ... """ import yaml from yamllint.linter import LintProblem ID = 'document-start' TYPE = 'token' CONF = {'present': bool} DEFAULT = {'present': True} def che...
code_fim
hard
{ "lang": "python", "repo": "otus-devops-2019-02/devopscourses_infra", "path": "/venv/lib/python2.7/site-packages/yamllint/rules/document_start.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @abstractmethod def update(self, model: Model): pass<|fim_prefix|># repo: df424/ml path: /modules/optimizers/optimizer.py from abc import ABC, abstractmethod from ml.models import Model <|fim_middle|>class Optimizer(ABC):
code_fim
easy
{ "lang": "python", "repo": "df424/ml", "path": "/modules/optimizers/optimizer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: df424/ml path: /modules/optimizers/optimizer.py from abc import ABC, abstractmethod from ml.models import Model <|fim_suffix|> @abstractmethod def update(self, model: Model): pass<|fim_middle|>class Optimizer(ABC):
code_fim
easy
{ "lang": "python", "repo": "df424/ml", "path": "/modules/optimizers/optimizer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pass # TODO: parameter types: # sess is of type Session # global_step is of type Tensor or integer def save(self, sess: Any, save_path: str, global_step: Any = None, latest_filename: Optional[str]=None, meta_gr...
code_fim
medium
{ "lang": "python", "repo": "acvander/tensorflow-stubs", "path": "/tensorflow-stubs/train/__init__.pyi", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: acvander/tensorflow-stubs path: /tensorflow-stubs/train/__init__.pyi from typing import Any, Optional def import_meta_graph(path: str) -> Any: pass # Saver class defined here # https://github.com/tensorflow/tensorflow/blob/28340a4b12e286fe14bb7ac08aebe325c3e150b4/tensorflow/python/training...
code_fim
medium
{ "lang": "python", "repo": "acvander/tensorflow-stubs", "path": "/tensorflow-stubs/train/__init__.pyi", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.chain = [Block(None, Transaction(100, "genesis", "satoshi"))] def lastBlock(self): return self.chain[-1] def addBlock(self, transaction: Transaction, senderPublicKey: str, signature: str): self.verifier = hashlib.sha256(senderPublicKey, signature) newB...
code_fim
hard
{ "lang": "python", "repo": "karan-ksrk/Block-Chain", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: karan-ksrk/Block-Chain path: /main.py import datetime import hashlib from cryptography.hazmat.backends import default_backend from cryptography.hazmat.primitives.asymmetric import rsa class Transaction: def __init__(self, amount, sender, receiver): self.amount = amount ...
code_fim
medium
{ "lang": "python", "repo": "karan-ksrk/Block-Chain", "path": "/main.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return self.chain[-1] def addBlock(self, transaction: Transaction, senderPublicKey: str, signature: str): self.verifier = hashlib.sha256(senderPublicKey, signature) newBlock = Block(self.lastBlock().hash, transaction) self.chain.append(newBlock) class Wallet:...
code_fim
hard
{ "lang": "python", "repo": "karan-ksrk/Block-Chain", "path": "/main.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: leokarlin/LaSO path: /oneshot/cnnvisualizer/tightcrop.py # coding: utf-8 # In[ ]: # Awesome image patch finder, # Due to http://stackoverflow.com/questions/9525313 import os import sys import numpy import random import numpy as np import scipy.ndimage as ndimage import scipy.spatial as spati...
code_fim
hard
{ "lang": "python", "repo": "leokarlin/LaSO", "path": "/oneshot/cnnvisualizer/tightcrop.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def input_image_filename(basename, iter, zunit): # return ('/data/vision/torralba/gigaSUN/www/unit_annotation/result_segments_iterations' + return ('/data/vision/torralba/scratch2/davidbau/iccv' + '/%s_iter_%d/html/image/conv5-%04d.jpg' % (basename, iter, zunit)) def output_image_filename...
code_fim
hard
{ "lang": "python", "repo": "leokarlin/LaSO", "path": "/oneshot/cnnvisualizer/tightcrop.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def slice_to_bbox(slices): for s in slices: dy, dx = s[:2] yield BBox(dx.start, dy.start, dx.stop+1, dy.stop+1) def remove_overlaps(bboxes): ''' Return a set of BBoxes which contain the given BBoxes. When two BBoxes overlap, replace both with the minimal BBox that contains...
code_fim
hard
{ "lang": "python", "repo": "leokarlin/LaSO", "path": "/oneshot/cnnvisualizer/tightcrop.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): pass<|fim_prefix|># repo: danrg/RGT-tool path: /src/RGT/gridMng/template/session/resultRatingWeightTableData.py class ResultRatingWeightTableData(object): <|fim_middle|> headers = None table = None weights = None weightColorMap = None tableHead = N...
code_fim
medium
{ "lang": "python", "repo": "danrg/RGT-tool", "path": "/src/RGT/gridMng/template/session/resultRatingWeightTableData.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: danrg/RGT-tool path: /src/RGT/gridMng/template/session/resultRatingWeightTableData.py class ResultRatingWeightTableData(object): <|fim_suffix|> def __init__(self): pass<|fim_middle|> headers = None table = None weights = None weightColorMap = None tableHead = N...
code_fim
medium
{ "lang": "python", "repo": "danrg/RGT-tool", "path": "/src/RGT/gridMng/template/session/resultRatingWeightTableData.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Since this .pth-file does not reside on a site-dir, we need to add # it manually import sys if not getattr(sys, 'frozen', None): import site import os site.addsitedir(os.path.join(os.path.dirname(__file__), 'nspkg2-pkg')) import nspkg2.aaa import nspkg2.bbb.zzz import nspkg2.ccc<|fim_prefix...
code_fim
medium
{ "lang": "python", "repo": "dvt32/mypymodoro", "path": "/resources/PyInstaller-3.0/tests/old_suite/import/test_nspkg2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dvt32/mypymodoro path: /resources/PyInstaller-3.0/tests/old_suite/import/test_nspkg2.py #----------------------------------------------------------------------------- # Copyright (c) 2013, PyInstaller Development Team. # # Distributed under the terms of the GNU General Public License with excepti...
code_fim
medium
{ "lang": "python", "repo": "dvt32/mypymodoro", "path": "/resources/PyInstaller-3.0/tests/old_suite/import/test_nspkg2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> num_covered = 0 # embedding for special symbols init_embedding[0][:] = np.zeros(emblen) for word in vocab: if word in word2vec_map: vec = word2vec_map[word] if len(vec) != emblen: raise ValueError("word2vec dimension doesn't match.") ...
code_fim
hard
{ "lang": "python", "repo": "czyssrs/GloREPlus", "path": "/code/data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: czyssrs/GloREPlus path: /code/data_utils.py import itertools import numpy as np import random import os import yaml import gzip import unicodedata import gensim import tensorflow as tf import codecs import operator import zipfile from gensim.models import KeyedVectors from hyperparams import Hype...
code_fim
hard
{ "lang": "python", "repo": "czyssrs/GloREPlus", "path": "/code/data_utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # embedding for special symbols init_embedding[0][:] = np.zeros(emblen) for word in vocab: if word in word2vec_map: vec = word2vec_map[word] if len(vec) != emblen: raise ValueError("word2vec dimension doesn't match.") init_embedding[...
code_fim
hard
{ "lang": "python", "repo": "czyssrs/GloREPlus", "path": "/code/data_utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return rtl_estimator def visualize(estimator, input_img_path, output_dir): """Visualizes trained estimator.""" # This example pulls one channel, also would make sense to convert to gray im = plt.imread(input_img_path)[:, :, 2] im_pixels = _pixels(im) input_fn = tf.compat.v1.estimator.inputs...
code_fim
hard
{ "lang": "python", "repo": "neilteng/lattice", "path": "/examples/image_compression.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: neilteng/lattice path: /examples/image_compression.py # Copyright 2018 The TensorFlow Lattice Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://w...
code_fim
hard
{ "lang": "python", "repo": "neilteng/lattice", "path": "/examples/image_compression.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> data_quality_job_input = { "endpointInput": { "endpointName": Endpoint.outputs["sagemaker_resource_name"], "localPath": "/opt/ml/processing/input/endpoint", "s3DataDistributionType": "FullyReplicated", "s3InputMode": "File", } } ...
code_fim
hard
{ "lang": "python", "repo": "kubeflow/pipelines", "path": "/samples/contrib/aws-samples/hosting_model_monitor_pipeline/hosting_model_monitor_pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> monitoring_schedule_config = { "monitoringType": "DataQuality", "scheduleConfig": {"scheduleExpression": "cron(0 * ? * * *)"}, "monitoringJobDefinitionName": DataQualityJobDefinition.outputs[ "sagemaker_resource_name" ], } MonitoringSchedule = sagem...
code_fim
hard
{ "lang": "python", "repo": "kubeflow/pipelines", "path": "/samples/contrib/aws-samples/hosting_model_monitor_pipeline/hosting_model_monitor_pipeline.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kubeflow/pipelines path: /samples/contrib/aws-samples/hosting_model_monitor_pipeline/hosting_model_monitor_pipeline.py #!/usr/bin/env python3 import kfp import sagemaker import os from kfp import components from kfp import dsl from datetime import datetime sagemaker_Model_op = components.load_c...
code_fim
hard
{ "lang": "python", "repo": "kubeflow/pipelines", "path": "/samples/contrib/aws-samples/hosting_model_monitor_pipeline/hosting_model_monitor_pipeline.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.name = "LIGHTNINGS" self.definitions = lightning self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['lightning']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_lightnings.py #calss header class _LIGHTNINGS(): <|fim_mi...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_lightnings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_lightnings.py #calss header class _LIGHTNINGS(): <|fim_suffix|> self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['lightning']<|fim_middle|> def __init__(self,): self.name = "LIGHTNINGS" s...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_lightnings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vaxin/facenet path: /facenet/align/align.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from scipy import misc import sys import os import argparse import tensorflow as tf import numpy as np from facenet import facenet from facenet...
code_fim
medium
{ "lang": "python", "repo": "vaxin/facenet", "path": "/facenet/align/align.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: img = misc.imread(image_path) except (IOError, ValueError, IndexError) as e: errorMessage = '{}: {}'.format(image_path, e) print(errorMessage) else: if img.ndim < 2: print('Unable to align "%s"' % image_path) return if img.ndim == 2: img = facenet.to_rgb(i...
code_fim
hard
{ "lang": "python", "repo": "vaxin/facenet", "path": "/facenet/align/align.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># count number of total missclassified miss_classified = 0 miss_classified_list = [] test_data.iat[0, 5] for i in range(0, test_data_input.shape[0]): test_prediction1 = perceptron.predict(test_data_input[i]) miss_classified_list.append(test_prediction1) if test_prediction1 != test_data.iat[i, ...
code_fim
medium
{ "lang": "python", "repo": "AlparslanErol/Perceptron", "path": "/Perceptron.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AlparslanErol/Perceptron path: /Perceptron.py import numpy as np import pandas as pd class Perceptron(object): def __init__(self, no_of_inputs, threshold=100, learning_rate=0.01): self.threshold = threshold self.learning_rate = learning_rate self.weights = np.zeros...
code_fim
hard
{ "lang": "python", "repo": "AlparslanErol/Perceptron", "path": "/Perceptron.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># take a input from user (UI input of Data) listFromUser = [0, 0, 0, 0] for i in range(0, 4): userData = float(input('enter i th value : ')) listFromUser[i] = userData print('the data you have Provided is\n=> ', listFromUser) output_prediction = perceptron.predict(listFromUser) if output_predict...
code_fim
hard
{ "lang": "python", "repo": "AlparslanErol/Perceptron", "path": "/Perceptron.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ :ivar inputs: list[Artifact] :ivar outputs: list[Artifact] """ def __init__(self, inputs, outputs): self.inputs = inputs self.outputs = outputs @property def output(self): """ :type: Artifact :raise Exception: If there are multiple o...
code_fim
hard
{ "lang": "python", "repo": "SemaphoreSolutions/s4-clarity-lib", "path": "/s4/clarity/iomaps.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }