text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: ericav99/CAT_REU_2019 path: /catvehicle_openai_ros_code/catvehicle_env.py import rospy import time import numpy as np from geometry_msgs.msg import Twist from std_msgs.msg import Float64, Float32 from openai_ros import robot_gazebo_env from nav_msgs.msg import Odometry class CATVehicleEnv(robot...
code_fim
hard
{ "lang": "python", "repo": "ericav99/CAT_REU_2019", "path": "/catvehicle_openai_ros_code/catvehicle_env.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _check_all_systems_ready(self): """ Checks that all the sensors, publishers and other simulation systems are operational. """ self._check_all_sensors_ready() #self._check_joint_states_ready() self._check_cmd_vel_pub() ...
code_fim
hard
{ "lang": "python", "repo": "ericav99/CAT_REU_2019", "path": "/catvehicle_openai_ros_code/catvehicle_env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _check_distsb_ready(self): self.distsb = None rospy.logdebug("Waiting for /catvehicle/distanceEstimatorSteeringBased/dist to be READY...") while self.distsb is None and not rospy.is_shutdown(): try: self.distsb = rospy.wait_for_message("/catvehic...
code_fim
hard
{ "lang": "python", "repo": "ericav99/CAT_REU_2019", "path": "/catvehicle_openai_ros_code/catvehicle_env.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: brockellefson/school path: /Senior Year/Fall Semester/CS432/Project 6/sortingexamples.py import math import random from random import randint import time def partition(arr, low, high): i = (low - 1) pivot = arr[high] for j in range(low, high): if arr[j] <= pivot: ...
code_fim
hard
{ "lang": "python", "repo": "brockellefson/school", "path": "/Senior Year/Fall Semester/CS432/Project 6/sortingexamples.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> quickSort(arr, 0, listLength-1) timeoutend = time.time() end = timeoutend - timeoutstart print('quicksort: ' + str(end)) timeoutstart = time.time() #heapSort(arr) timeoutend = time.time() end = timeoutend - timeoutstart #print('heapsort: ' + str(end)) maxdepth = i...
code_fim
hard
{ "lang": "python", "repo": "brockellefson/school", "path": "/Senior Year/Fall Semester/CS432/Project 6/sortingexamples.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JBed/edx-spark path: /Lab_3/lab3.py long(0) else: size = long(match.group(9)) return (Row( host = match.group(1), client_identd = match.group(2), user_id = match.group(3), date_time = parse_apache_time(match.group(4)), me...
code_fim
hard
{ "lang": "python", "repo": "JBed/edx-spark", "path": "/Lab_3/lab3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>responseCodeToCountList = responseCodeToCount.take(100) print 'Found {} response codes'.format(len(responseCodeToCountList)) print 'Response Code Counts: {}'.format(responseCodeToCountList) assert len(responseCodeToCountList) == 7 assert sorted(responseCodeToCountList) == [(200, 940847), (302, 16244), (3...
code_fim
hard
{ "lang": "python", "repo": "JBed/edx-spark", "path": "/Lab_3/lab3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JBed/edx-spark path: /Lab_3/lab3.py int(s[0:2]), int(s[12:14]), int(s[15:17]), int(s[18:20])) def parseApacheLogLine(logline): """ Parse a line in the Apache Common Log format Args: logli...
code_fim
hard
{ "lang": "python", "repo": "JBed/edx-spark", "path": "/Lab_3/lab3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tusharsadhwani/daily_byte path: /p110_birthday_cake.py """ You are at a birthday party and are asked to distribute cake to your guests. Each guess is only satisfied if the size of the piece of cake they’re given, matches their appetite (i.e. is greater than or equal to their appetite). Given two ...
code_fim
hard
{ "lang": "python", "repo": "tusharsadhwani/daily_byte", "path": "/p110_birthday_cake.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Ex: Given the following arrays appetite and cake... appetite = [3, 4, 5], cake = [2], return 0. """ def max_guests(appetite: list[int], cake: list[int]) -> int: """Returns maximum number of guests you can satisfy""" guest_count = 0 appetite_index = len(appetite) - 1 cake_index = len(ca...
code_fim
medium
{ "lang": "python", "repo": "tusharsadhwani/daily_byte", "path": "/p110_birthday_cake.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>1 return counter print(persistence(int(input("Num:"))))<|fim_prefix|># repo: Conor12345/challenges-july-2020 path: /CW - 6 - Persisten Bugger.py def persistence(n): n = str(n) counter = 0 while len(n) > 1: sum = 1 for num in n: <|fim_middle|> sum *= int(num) ...
code_fim
medium
{ "lang": "python", "repo": "Conor12345/challenges-july-2020", "path": "/CW - 6 - Persisten Bugger.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Conor12345/challenges-july-2020 path: /CW - 6 - Persisten Bugger.py def persistence(n): n = str(n) counter = 0 whil<|fim_suffix|>1 return counter print(persistence(int(input("Num:"))))<|fim_middle|>e len(n) > 1: sum = 1 for num in n: sum *= int(num) ...
code_fim
medium
{ "lang": "python", "repo": "Conor12345/challenges-july-2020", "path": "/CW - 6 - Persisten Bugger.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wmengyu/spiderDay1 path: /Day2/5-ajax-douban.py import urllib.request import urllib.parse url = 'https://movie.douban.com/typerank?type_name=%E5%8A%A8%E4%BD%9C&type=5&interval_id=100:90&action=&' headers={ 'User-Agent':'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) ...
code_fim
medium
{ "lang": "python", "repo": "wmengyu/spiderDay1", "path": "/Day2/5-ajax-douban.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>data = urllib.parse.urlencode(data).encode('utf-8') #构建路径(get请求) # url += data #构建请求(post请求) req = urllib.request.Request(url=url, data=data, headers=headers) #发送请求 res = urllib.request.urlopen(req) # print(res.read().decode('utf-8')) with open('douban.html', 'wb') as fw: fw.write(res.read())<|fim_p...
code_fim
medium
{ "lang": "python", "repo": "wmengyu/spiderDay1", "path": "/Day2/5-ajax-douban.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: keita8723/mypkg path: /scripts/twice.py #!/usr/bin/env python3 import rospy from std_msgs.msg import Float32 n = 0 def cb(message): global n n = message.data*2 <|fim_suffix|> rospy.init_node('twice') sub = rospy.Subscriber('count_up', Float32, cb) pub = rospy.Publisher('twice', Float3...
code_fim
medium
{ "lang": "python", "repo": "keita8723/mypkg", "path": "/scripts/twice.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> global n n = message.data*2 if n > 100: n = message.data*3 if n > 300: n = message.data/5 rospy.init_node('twice') sub = rospy.Subscriber('count_up', Float32, cb) pub = rospy.Publisher('twice', Float32, queue_size=1) rate = rospy.Rate(10) while not rospy.is_shutdown():...
code_fim
easy
{ "lang": "python", "repo": "keita8723/mypkg", "path": "/scripts/twice.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>rospy.init_node('twice') sub = rospy.Subscriber('count_up', Float32, cb) pub = rospy.Publisher('twice', Float32, queue_size=1) rate = rospy.Rate(10) while not rospy.is_shutdown(): pub.publish(n) rate.sleep()<|fim_prefix|># repo: keita8723/mypkg path: /scripts/twice.py #!/usr/bin/env python3 impor...
code_fim
easy
{ "lang": "python", "repo": "keita8723/mypkg", "path": "/scripts/twice.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Thorjezar/pythonDemo path: /homework/3.17-4.py #coding=utf-8 ''' 4. 编写程序,完成“名片管理器”项目 需要完成的基本功能: 添加名片 删除名片 修改名片 查询名片 退出系统 程序运行后,除非选择退出系统,否则重复执行功能 ''' #初始化一个名片存储 cards = {} i = 0 while i == 0: print("=" * 10 + "欢迎使用名片管理器" + "=" * 10) print("1.添加名片") print("2.删除名片") print("3.修改名片"...
code_fim
hard
{ "lang": "python", "repo": "Thorjezar/pythonDemo", "path": "/homework/3.17-4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> updateId = input("请输入要修改的编号:") updateId = int(updateId) info["name"] = input("修改编号%d名片的姓名" % updateId) info["phonenumber"] = input("修改编号%d名片的电话号" % updateId) info["wechat"] = input("修改编号%d名片的微信号" % updateId) c...
code_fim
hard
{ "lang": "python", "repo": "Thorjezar/pythonDemo", "path": "/homework/3.17-4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ankit-w/machine-translation path: /fileprocessor.py with open("small_vocab_en") as xh: with open('small_vocab_fr') as yh: with open("en_fr","w") as zh: #Read first file xlines = xh.readlines() #Read second file ylines = yh.readlines() <|fim_suffix|> for i in rang...
code_fim
medium
{ "lang": "python", "repo": "ankit-w/machine-translation", "path": "/fileprocessor.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(len(xlines)): line = ylines[i].strip() + '\t' + xlines[i] zh.write(line)<|fim_prefix|># repo: ankit-w/machine-translation path: /fileprocessor.py with open("small_vocab_en") as xh: with open('small_vocab_fr') as yh: with open("en_fr","w") as zh: <|fim_middle|> ...
code_fim
hard
{ "lang": "python", "repo": "ankit-w/machine-translation", "path": "/fileprocessor.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Katerina964/study path: /второе вхождение.py string = input() substring = 'f' kst = len(string) pos = string.fi<|fim_suffix|>2 == -1: print(pos2) else: print(pos2 + pos + 1)<|fim_middle|>nd(substring) newString = string[pos + 1:] if pos == -1: print(-2) elif pos != -1: ...
code_fim
medium
{ "lang": "python", "repo": "Katerina964/study", "path": "/второе вхождение.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>-2) elif pos != -1: pos2 = newString.find(substring) if pos2 == -1: print(pos2) else: print(pos2 + pos + 1)<|fim_prefix|># repo: Katerina964/study path: /второе вхождение.py string = input() substring = 'f' kst = len(string) pos = string.fi<|fim_middle|>nd(substring) newStrin...
code_fim
medium
{ "lang": "python", "repo": "Katerina964/study", "path": "/второе вхождение.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>SCOPES = ['https://www.googleapis.com/auth/analytics.readonly'] KEY_FILE_LOCATION = os.getenv('GOOGLE_APPLICATION_CREDENTIALS') if KEY_FILE_LOCATION: credentials = ServiceAccountCredentials.from_json_keyfile_name(KEY_FILE_LOCATION, SCOPES) else: credentials = None # Cell def ga_to_df(start_dat...
code_fim
medium
{ "lang": "python", "repo": "andrewm4894/am4894ga", "path": "/am4894ga/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not view_id: view_id = os.getenv('GOOGLE_ANALYTICS_VIEW_ID') qry = { 'dateRanges': [{'startDate': start_date, 'endDate': end_date}], 'metrics': [{'expression': m} for m in metrics], 'dimensions': [{'name': m} for m in dimensions], } if filters: qr...
code_fim
medium
{ "lang": "python", "repo": "andrewm4894/am4894ga", "path": "/am4894ga/core.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewm4894/am4894ga path: /am4894ga/core.py # AUTOGENERATED! DO NOT EDIT! File to edit: 00_core.ipynb (unless otherwise specified). __all__ = ['SCOPES', 'KEY_FILE_LOCATION', 'ga_to_df'] # Cell from apiclient.discovery import build from oauth2client.service_account import ServiceAccountCredent...
code_fim
medium
{ "lang": "python", "repo": "andrewm4894/am4894ga", "path": "/am4894ga/core.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nizarhmain/master_thesis path: /private_data/enclave.py from ecies.utils import generate_key from ecies import encrypt, decrypt import binascii import coincurve pub = '0227ffac7d33231086df84e12f0856c0e985c18d3daa2c94c7abcbff9a6aa8b258' priv = 'ee113297d1fb3c214722aadf59a3d94dff24264ffc5c34b78...
code_fim
hard
{ "lang": "python", "repo": "nizarhmain/master_thesis", "path": "/private_data/enclave.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # pub = '0227ffac7d33231086df84e12f0856c0e985c18d3daa2c94c7abcbff9a6aa8b258' # priv = 'ee113297d1fb3c214722aadf59a3d94dff24264ffc5c34b78c903b36eb1aeca8' # print(pub) # pubk = coincurve.PublicKey.from_hex(pub) # print(coincurve_pubk) # print(coincurve_privk.secret) # k = generate_key() # print(...
code_fim
medium
{ "lang": "python", "repo": "nizarhmain/master_thesis", "path": "/private_data/enclave.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zdgriffith/ShowerLLH_scripts path: /run_data/save_hist.py #!/usr/bin/env python ########################################################################### # Replacement for save_data.py takes a collection of hdf5 files, and # # builds desired histograms for rapid plotting ...
code_fim
hard
{ "lang": "python", "repo": "zdgriffith/ShowerLLH_scripts", "path": "/run_data/save_hist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return q def histWriter(config, file, outfile): # Bin values eList = ['p','h','o','f'] decbins = ['0-12','12-24','24-40'] rabins = ['0-60','60-120','120-180','180-240','240-300','300-360'] # Build general list of key names to write keyList = [] keyList += ['energy','ene...
code_fim
hard
{ "lang": "python", "repo": "zdgriffith/ShowerLLH_scripts", "path": "/run_data/save_hist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># * The states whose winning rates are highly positively correlated with S&P 500 are: OH, WI, OR... # * The states whose winning rates are highly negatively correlated with S&P 500 are: NM, OK, KS... # * States such as MD are not likely to be affected by stock market # In[27]: pst_merge = pst_cat.reset...
code_fim
hard
{ "lang": "python", "repo": "AliciaFZhang/Data-Visualization-Trump-s-winning-rate", "path": "/Data visualization_Trump Winning Rate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AliciaFZhang/Data-Visualization-Trump-s-winning-rate path: /Data visualization_Trump Winning Rate.py #!/usr/bin/env python # coding: utf-8 # # Data Visualization: Trump's Winning Rate # This report provides detailed facts about Trump's Winning Rate and its correlation between economics indicator...
code_fim
hard
{ "lang": "python", "repo": "AliciaFZhang/Data-Visualization-Trump-s-winning-rate", "path": "/Data visualization_Trump Winning Rate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for src,dst in zip(lcpaths,dstpaths): dstdir = os.path.dirname(dst) if not os.path.exists(dstdir): os.mkdir(dstdir) try: shutil.move(src,dst) print('moved {} -> {}'.format(src,dst)) except FileNotFoundError as e: if os.pat...
code_fim
hard
{ "lang": "python", "repo": "lgbouma/cdips", "path": "/drivers/get_cdips_lc_stats.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: SerCharles/SPQRNet path: /src/main.py ''' Description: Main program used in train and testing my network Author:Charles Shen Date:8/22/2020 ''' import numpy as np import time import os import argparse import torch import torch.nn as nn import torch.optim as optim from torch.autograd import Varia...
code_fim
hard
{ "lang": "python", "repo": "SerCharles/SPQRNet", "path": "/src/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> total_dist = 0 total_batch = 0 for i, (partial_shapenet, ground_truth_fine, ground_truth_coarse) in enumerate(data_loader_shapenet_val): if device: partial_shapenet = partial_shapenet.to(device) ground_truth_fine = ground_truth_fine.to(device) groun...
code_fim
hard
{ "lang": "python", "repo": "SerCharles/SPQRNet", "path": "/src/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DanielMevs/Tuple-Input-with-Python path: /tuple_input.py def input_tuple_lc(prompt, types, sep): answer_str = input(prompt) new_list = answer_str.split(sep) new_tuple = () if len(new_list) != len(types): print("Number of values inputted do not match number of values intend...
code_fim
hard
{ "lang": "python", "repo": "DanielMevs/Tuple-Input-with-Python", "path": "/tuple_input.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> new_tuple = new_tuple + (new_object,) i+=1 return new_tuple sep = ',' prompt = "Please input a first name, last name, age, ID, and full-time(True or False) separated by '" + sep + "':" types = (str,str,float,int,bool) some_tuple = input_tuple(prompt,ty...
code_fim
hard
{ "lang": "python", "repo": "DanielMevs/Tuple-Input-with-Python", "path": "/tuple_input.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> except ValueError: print("Error, incorrect data type inputted") return () new_tuple = new_tuple + (new_object,) i+=1 return new_tuple sep = ',' prompt = "Please input a first name, last name, age...
code_fim
hard
{ "lang": "python", "repo": "DanielMevs/Tuple-Input-with-Python", "path": "/tuple_input.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leo-bart/mbsim path: /misc/BuildService/scripts/builddocsb.py #!/usr/bin/python import subprocess import glob subprocess.check_call(["pdflatex", "-halt-on-error", "-file-line-e<|fim_suffix|>-file-line-error", "main.tex"]) subprocess.check_call(["pdflatex", "-halt-on-error", "-file-line-error", ...
code_fim
hard
{ "lang": "python", "repo": "leo-bart/mbsim", "path": "/misc/BuildService/scripts/builddocsb.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>-file-line-error", "main.tex"]) subprocess.check_call(["pdflatex", "-halt-on-error", "-file-line-error", "main.tex"])<|fim_prefix|># repo: leo-bart/mbsim path: /misc/BuildService/scripts/builddocsb.py #!/usr/bin/python import subprocess import glob subprocess.check_call(["pdflatex", "-halt-on-error", "...
code_fim
medium
{ "lang": "python", "repo": "leo-bart/mbsim", "path": "/misc/BuildService/scripts/builddocsb.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Om1627/corrcoef path: /students.py import pandas as pd import plotly.express as px import numpy as np import csv def getDataSource(data_path): Days=[] Marks=[] with open(data_path) as csv_file: csv_reader=csv.DictReader(csv_file) for row in csv_reader: ...
code_fim
medium
{ "lang": "python", "repo": "Om1627/corrcoef", "path": "/students.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data_path="./students.csv" datasource=getDataSource(data_path) findCorrelation(datasource) setup() plot()<|fim_prefix|># repo: Om1627/corrcoef path: /students.py import pandas as pd import plotly.express as px import numpy as np import csv def getDataSource(data_path): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "Om1627/corrcoef", "path": "/students.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: roholt93/macro-keyboard path: /macro-watcher.py ### Author: Roholt ### 10-2020 from ConfigLoader import ConfigLoader from KeyboardWatcher import KeyboardWatcher def main(): settings = ConfigLoader("./config.yml").config <|fim_suffix|> keyboardWatcher.run() if __name__ == "__main__": main...
code_fim
medium
{ "lang": "python", "repo": "roholt93/macro-keyboard", "path": "/macro-watcher.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> keyboardWatcher.run() if __name__ == "__main__": main()<|fim_prefix|># repo: roholt93/macro-keyboard path: /macro-watcher.py ### Author: Roholt ### 10-2020 from ConfigLoader import ConfigLoader from KeyboardWatcher import KeyboardWatcher def main(): settings = ConfigLoader("./config.yml").config...
code_fim
medium
{ "lang": "python", "repo": "roholt93/macro-keyboard", "path": "/macro-watcher.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@pytest.mark.parametrize("asteroids,station,expected", [ (parse_asteroid_map( """### ### ###"""), (1, 1), [((1, 0), 0.0), ((2, 0), 45.0), ((2, 1), 90.0), ((2, 2), 135.0), ((1, 2), 180.0), ((0, 2), 225.0), ((0, 1), 270.0), ((0, 0), 315.0)]), (parse_asteroid_map( """### ...
code_fim
hard
{ "lang": "python", "repo": "Markus-Ende/adventofcode2019", "path": "/src/day10/test_monitoring_station.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Markus-Ende/adventofcode2019 path: /src/day10/test_monitoring_station.py import pytest from day10.monitoring_station import parse_asteroid_map, can_detect, count_detectable_asteroids, find_best_station, sort_for_laser_round, shoot from common.io import read @pytest.mark.parametrize("input,expec...
code_fim
hard
{ "lang": "python", "repo": "Markus-Ende/adventofcode2019", "path": "/src/day10/test_monitoring_station.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cohadar/aski path: /тестови/test_aski.py from aski import двоцифрени def test0(): assert двоцифрени([64, 65, 66]) == '@AB' def test1(): assert двоцифрени(list(range(27, 33))) == '' def test2(): <|fim_suffix|>def test3(): assert двоцифрени([100, 101, 200, 3000]) == '' def test4...
code_fim
easy
{ "lang": "python", "repo": "cohadar/aski", "path": "/тестови/test_aski.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test5(): assert двоцифрени(list(range(0, 27))) == 'defghijklmnopqrstuvwxyz{|}~'<|fim_prefix|># repo: cohadar/aski path: /тестови/test_aski.py from aski import двоцифрени def test0(): assert двоцифрени([64, 65, 66]) == '@AB' def test1(): assert двоцифрени(list(range(27, 33))) == '' ...
code_fim
hard
{ "lang": "python", "repo": "cohadar/aski", "path": "/тестови/test_aski.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cgyulay/nfl-play-prediction path: /code/guess.py import numpy as np from load_data import load_data from veltman_format import teams class PlayCallGame(): def __init__(self): self.start() def start(self): data = load_data('formatted_veltman_pbp_small.pkl', False) self.train_set...
code_fim
hard
{ "lang": "python", "repo": "cgyulay/nfl-play-prediction", "path": "/code/guess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> quarter = int(row[0]) return '{0}{1} quarter'.format(quarter, self.suffix(quarter)) def format_position(self, row, def_team): down = int(row[2]) togo = int(row[3]) yardline = int(row[4]) if yardline > 50: yardline -= 50 yardline_str = 'your own {0} yard line'.format...
code_fim
hard
{ "lang": "python", "repo": "cgyulay/nfl-play-prediction", "path": "/code/guess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> actions = ['ran the ball', 'threw the ball', 'punted the ball', 'kicked a ' 'field goal'] return actions[answer] def select_random(self): row = np.random.randint(1, len(self.test_set_x)) return self.test_set_x[row], self.test_set_y[row] def extract_teams(self, row): off_on...
code_fim
hard
{ "lang": "python", "repo": "cgyulay/nfl-play-prediction", "path": "/code/guess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> r""" Returns reduced-row echelon form (RREF) and list of pivots. If the domain is not a field then it will be converted to a field. See :meth:`rref_den` for the fraction-free version of this routine that returns RREF with denominator instead. The domain mu...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/polys/matrices/domainmatrix.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: sympy/sympy path: /sympy/polys/matrices/domainmatrix.py but if the domain is not a field then it will be converted to a field at the end and divided by the denominator. This is most efficient for dense matrices or for matrices with simple denominators. ...
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/polys/matrices/domainmatrix.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> rref RREF without denominator for field domains. sympy.polys.matrices.sdm.sdm_irref Sparse implementation of ``method='GJ'``. sympy.polys.matrices.sdm.sdm_rref_den Sparse implementation of ``method='FF'`` and ``method='CD'``. sympy.polys....
code_fim
hard
{ "lang": "python", "repo": "sympy/sympy", "path": "/sympy/polys/matrices/domainmatrix.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: epsdg/mltools path: /models/base_model.py import numpy as np import pandas as pd from .. import utils from sklearn.preprocessing import scale from sklearn.impute import SimpleImputer class BaseModel(): def __init__(self, X_train, y_train, X_test, params_file, folds_lookup, ...
code_fim
hard
{ "lang": "python", "repo": "epsdg/mltools", "path": "/models/base_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def evals_df(self): '''Transform round-by-round metrics from dict to pd.DataFrame''' parts = [] for pref in ['train', 'val']: metrics = list(self.evals_out[pref].keys()) columns = {metric: pref + '_' + tag for metric in metrics} df = pd.DataF...
code_fim
hard
{ "lang": "python", "repo": "epsdg/mltools", "path": "/models/base_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> X = np.concatenate([self.X_train.values, self.X_test.values], axis=0) if fillna: imputer = SimpleImputer(strategy=fill_with, verbose=1) self.logger.info(' filling NaN...') X[X == np.inf] = np.nan X[X == -np.inf] = np.nan X = imp...
code_fim
hard
{ "lang": "python", "repo": "epsdg/mltools", "path": "/models/base_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: skoczen/will path: /will/plugins/friendly/cookies.py from will.plugin import WillPlugin from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings class SnickerdoodlesPlugin(WillPlugin): <|fim_suffix|> self.say(rendered_template("cookies....
code_fim
medium
{ "lang": "python", "repo": "skoczen/will", "path": "/will/plugins/friendly/cookies.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.say(rendered_template("cookies.html", {}), message=message, html=True, )<|fim_prefix|># repo: skoczen/will path: /will/plugins/friendly/cookies.py from will.plugin import WillPlugin from will.decorators import respond_to, periodic, hear, randomly, route, rendered_template, require_settings ...
code_fim
medium
{ "lang": "python", "repo": "skoczen/will", "path": "/will/plugins/friendly/cookies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @hear("cookies", include_me=False) def will_likes_cookies(self, message): self.say(rendered_template("cookies.html", {}), message=message, html=True, )<|fim_prefix|># repo: skoczen/will path: /will/plugins/friendly/cookies.py from will.plugin import WillPlugin from will.decorators import...
code_fim
easy
{ "lang": "python", "repo": "skoczen/will", "path": "/will/plugins/friendly/cookies.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: randy3k/SendCode path: /code_sender/iterm/__init__.py import os from ..applescript import osascript ITERM = os.path.join(os.path.dirname(__file__), "iterm.applescript") ITERM_BRACKETED = os.path.join(os.path.dirname(__file__), "iterm_bracketed.applescript") <|fim_suffix|> if bracketed: ...
code_fim
easy
{ "lang": "python", "repo": "randy3k/SendCode", "path": "/code_sender/iterm/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if bracketed: osascript(ITERM_BRACKETED, cmd, str(commit)) else: osascript(ITERM, cmd, str(commit))<|fim_prefix|># repo: randy3k/SendCode path: /code_sender/iterm/__init__.py import os from ..applescript import osascript <|fim_middle|>ITERM = os.path.join(os.path.dirname(__file__...
code_fim
hard
{ "lang": "python", "repo": "randy3k/SendCode", "path": "/code_sender/iterm/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ellmetha/django-machina path: /machina/apps/forum_conversation/migrations/0013_auto_20201220_1745.py # Generated by Django 3.1.2 on 2020-12-20 22:45 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( ...
code_fim
hard
{ "lang": "python", "repo": "ellmetha/django-machina", "path": "/machina/apps/forum_conversation/migrations/0013_auto_20201220_1745.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='topic', name='created', field=models.DateTimeField(auto_now_add=True, db_index=True, verbose_name='Creation date'), ), migrations.AlterField( model_name='topic', name='...
code_fim
hard
{ "lang": "python", "repo": "ellmetha/django-machina", "path": "/machina/apps/forum_conversation/migrations/0013_auto_20201220_1745.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: pcoder/dynamicweb path: /datacenterlight/migrations/0014_dclsectionpromopluginmodel.py # -*- coding: utf-8 -*- # Generated by Django 1.9.4 on 2018-03-21 19:09 from __future__ import unicode_literals from django.db import migrations, models import django.db.models.deletion import djangocms_text_c...
code_fim
hard
{ "lang": "python", "repo": "pcoder/dynamicweb", "path": "/datacenterlight/migrations/0014_dclsectionpromopluginmodel.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='DCLSectionPromoPluginModel', fields=[ ('cmsplugin_ptr', models.OneToOneField(auto_created=True, on_delete=django.db.models.deletion.CASCADE, parent_link=T...
code_fim
hard
{ "lang": "python", "repo": "pcoder/dynamicweb", "path": "/datacenterlight/migrations/0014_dclsectionpromopluginmodel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: pulumi/pulumi-google-native path: /sdk/python/pulumi_google_native/certificatemanager/v1/get_certificate_issuance_config.py # coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** impo...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/certificatemanager/v1/get_certificate_issuance_config.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ Set of labels associated with a CertificateIssuanceConfig. """ return pulumi.get(self, "labels") @property @pulumi.getter def lifetime(self) -> str: """ Workload certificate lifetime requested. """ return pulumi.get(self, "li...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/certificatemanager/v1/get_certificate_issuance_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def get_certificate_issuance_config(certificate_issuance_config_id: Optional[str] = None, location: Optional[str] = None, project: Optional[str] = None, opts: Optional[pulumi.InvokeOptions] = None) ...
code_fim
hard
{ "lang": "python", "repo": "pulumi/pulumi-google-native", "path": "/sdk/python/pulumi_google_native/certificatemanager/v1/get_certificate_issuance_config.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def render_to_response(self, context, **response_kwargs): response_kwargs['content_type'] = self.content_type # standard TemplateView does not offer this! context['ROOT_URL'] = self.request.build_absolute_uri('/') context['ROBOTS_TXT_DISALLOW_ALL'] = appsettings.ROBOTS_TXT_DIS...
code_fim
hard
{ "lang": "python", "repo": "sigmacms/django-fluent-pages", "path": "/fluent_pages/views/seo.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: sigmacms/django-fluent-pages path: /fluent_pages/views/seo.py from django.views.generic import TemplateView from fluent_pages import appsettings class RobotsTxtView(TemplateView): """ Exposing a ``robots.txt`` template in the Django project. Add this view to the ``urls.py``: ....
code_fim
hard
{ "lang": "python", "repo": "sigmacms/django-fluent-pages", "path": "/fluent_pages/views/seo.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> from fluent_pages.views import RobotsTxtView urlpatterns = [ # ... url(r'^robots.txt$', RobotsTxtView.as_view()), ] Naturally, this pattern should not be included inside :func:`~django.conf.urls.i18n.i18n_patterns` as it should appear at the top l...
code_fim
medium
{ "lang": "python", "repo": "sigmacms/django-fluent-pages", "path": "/fluent_pages/views/seo.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>in"][0](message,commu): await message.delete() channs = commu[str(message.channel.category_id)][0].remove(message.channel.id) await message.channel.delete()<|fim_prefix|># repo: Astremy/CommunityBot path: /commandes/remove_channel.py infos = {"name":"remove_channel","require":["message","command...
code_fim
medium
{ "lang": "python", "repo": "Astremy/CommunityBot", "path": "/commandes/remove_channel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>annel.category_id)][0].remove(message.channel.id) await message.channel.delete()<|fim_prefix|># repo: Astremy/CommunityBot path: /commandes/remove_channel.py infos = {"name":"remove_channel","require":["message","commandes","commu"],"show":<|fim_middle|>2,"use":1} async def command(message,commande...
code_fim
medium
{ "lang": "python", "repo": "Astremy/CommunityBot", "path": "/commandes/remove_channel.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Astremy/CommunityBot path: /commandes/remove_channel.py infos = {"name":"remove_channel","require":["message","commandes","commu"],"show":<|fim_suffix|>annel.category_id)][0].remove(message.channel.id) await message.channel.delete()<|fim_middle|>2,"use":1} async def command(message,commande...
code_fim
medium
{ "lang": "python", "repo": "Astremy/CommunityBot", "path": "/commandes/remove_channel.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Healt_calc(*venkat_data) # UNPACKING ARGUMENT<|fim_prefix|># repo: venkatshukla/Python_Tuts path: /Unpacking Args.py def Healt_calc(age, apples, cig): <|fim_middle|> health = (100-age) + apples*2 - (cig*2.8) print(health) Healt_calc(22,5,7) venkat_data = [22,5,7] Healt_calc(venkat_data[0],venka...
code_fim
medium
{ "lang": "python", "repo": "venkatshukla/Python_Tuts", "path": "/Unpacking Args.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: venkatshukla/Python_Tuts path: /Unpacking Args.py def Healt_calc(age, apples, cig): <|fim_suffix|>Healt_calc(*venkat_data) # UNPACKING ARGUMENT<|fim_middle|> health = (100-age) + apples*2 - (cig*2.8) print(health) Healt_calc(22,5,7) venkat_data = [22,5,7] Healt_calc(venkat_data[0],venka...
code_fim
medium
{ "lang": "python", "repo": "venkatshukla/Python_Tuts", "path": "/Unpacking Args.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Healt_calc(22,5,7) venkat_data = [22,5,7] Healt_calc(venkat_data[0],venkat_data[1],venkat_data[2]) Healt_calc(*venkat_data) # UNPACKING ARGUMENT<|fim_prefix|># repo: venkatshukla/Python_Tuts path: /Unpacking Args.py def Healt_calc(age, apples, cig): <|fim_middle|> health = (100-age) + apples*2 - (...
code_fim
medium
{ "lang": "python", "repo": "venkatshukla/Python_Tuts", "path": "/Unpacking Args.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tall_requires=['gym', 'numpy', 'opencv-python'] # And any other dependencies foo needs )<|fim_prefix|># repo: x2ever/Smart-Elevator-With-RL path: /gym-building/setup.py from setuptools import setup setup(name='gy<|fim_middle|>m_building', version='0.0.1', ins
code_fim
easy
{ "lang": "python", "repo": "x2ever/Smart-Elevator-With-RL", "path": "/gym-building/setup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: x2ever/Smart-Elevator-With-RL path: /gym-building/setup.py from setuptools import setup setup(name='gym_building', version='0.0.1', ins<|fim_suffix|>n'] # And any other dependencies foo needs )<|fim_middle|>tall_requires=['gym', 'numpy', 'opencv-pytho
code_fim
easy
{ "lang": "python", "repo": "x2ever/Smart-Elevator-With-RL", "path": "/gym-building/setup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alheart/python path: /learn/headfirstpython/chapter4/write.py #import nester import pickle man = [] other = [] try: data = open('sketch.txt') for each_line in data: try: (role, line_spoken) = each_line.split(':', 1) line_spoken = line_spoken.strip() ...
code_fim
medium
{ "lang": "python", "repo": "alheart/python", "path": "/learn/headfirstpython/chapter4/write.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>try: with open('man_data.txt', 'wb') as manfile: pickle.dump(man, manfile) #nester.print_lol(man, outfile=manfile) with open('other_data.txt', 'wb') as otherfile: #nester.print_lol(other, outfile=otherfile) pickle.dump(other, otherfile) except IOError: print('wr...
code_fim
medium
{ "lang": "python", "repo": "alheart/python", "path": "/learn/headfirstpython/chapter4/write.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: with open('man_data.txt', 'wb') as manfile: pickle.dump(man, manfile) #nester.print_lol(man, outfile=manfile) with open('other_data.txt', 'wb') as otherfile: #nester.print_lol(other, outfile=otherfile) pickle.dump(other, otherfile) except IOError: print('w...
code_fim
medium
{ "lang": "python", "repo": "alheart/python", "path": "/learn/headfirstpython/chapter4/write.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>for clf,label in zip([clf1,clr2,clf3,sclf], ['KNN', 'Random Forest', 'Naive Bayes', 'StackingClassifier']): scores_acc=model_selection.cross_val_score(clf,X,y,cv=3,scoring='accuracy') scores_auc=model_selection....
code_fim
hard
{ "lang": "python", "repo": "JoKerDii/Bank-financial-products-ordering-model", "path": "/bank.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JoKerDii/Bank-financial-products-ordering-model path: /bank.py # -*- coding: utf-8 -*- """ Created on Wed Aug 15 09:23:25 2018 @author: dizhen """ import pandas as pd import numpy as np from sklearn.datasets import load_iris from sklearn.pipeline import Pipeline from sklearn.preprocessing impo...
code_fim
hard
{ "lang": "python", "repo": "JoKerDii/Bank-financial-products-ordering-model", "path": "/bank.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cluster_idxs = cluster_learner.predict(embedding) centers = cluster_learner.cluster_centers_[cluster_idxs] dis = (embedding - centers)**2 dis = dis.sum(axis=1) q_idxs = np.array( [ np.arange(embedding.shape[0])[cluster_idxs == i][dis[cluster_idxs == i].argmin()] for i in range(n) ]...
code_fim
hard
{ "lang": "python", "repo": "wenhao-gao/active_mpnn", "path": "/query_strategies/kmeans_sampling.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cluster_learner = KMeans(n_clusters=n) cluster_learner.fit(embedding) cluster_idxs = cluster_learner.predict(embedding) centers = cluster_learner.cluster_centers_[cluster_idxs] dis = (embedding - centers)**2 dis = dis.sum(axis=1) q_idxs = np.array( [ np.arange(embedding.shape[0])[c...
code_fim
hard
{ "lang": "python", "repo": "wenhao-gao/active_mpnn", "path": "/query_strategies/kmeans_sampling.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenhao-gao/active_mpnn path: /query_strategies/kmeans_sampling.py import numpy as np from .strategy import Strategy from sklearn.cluster import KMeans from dataset.data import MoleculeDataset class KMeansSampling(Strategy): <|fim_suffix|> embedding = self.get_embedding(MoleculeDataset(self.da...
code_fim
hard
{ "lang": "python", "repo": "wenhao-gao/active_mpnn", "path": "/query_strategies/kmeans_sampling.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def empty_results(): output = open(ALL_RESULTS_FILE, 'wb') pickle.dump([], output) output.close()<|fim_prefix|># repo: kkkgabriel/Monocular-Depth-Estimation path: /utils/config.py ''' # not used, no time yo. This file stores constants and global configuration variables ''' import pickle <|fim_middle...
code_fim
hard
{ "lang": "python", "repo": "kkkgabriel/Monocular-Depth-Estimation", "path": "/utils/config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> output = open(ALL_RESULTS_FILE, 'wb') pickle.dump([], output) output.close()<|fim_prefix|># repo: kkkgabriel/Monocular-Depth-Estimation path: /utils/config.py ''' # not used, no time yo. This file stores constants and global configuration variables ''' import pickle <|fim_middle|># constants MODELS_...
code_fim
hard
{ "lang": "python", "repo": "kkkgabriel/Monocular-Depth-Estimation", "path": "/utils/config.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kkkgabriel/Monocular-Depth-Estimation path: /utils/config.py ''' # not used, no time yo. This file stores constants and global configuration variables ''' import pickle # constants MODELS_DIR = 'models/' MAIN_RESULTS_DIR = 'results/' ALL_RESULTS_FILE = MAIN_RESULTS_DIR + 'all_results.pkl' <|fi...
code_fim
hard
{ "lang": "python", "repo": "kkkgabriel/Monocular-Depth-Estimation", "path": "/utils/config.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoloTodo/storescraper path: /storescraper/stores/pontofrio.py import json import re import urllib from bs4 import BeautifulSoup from decimal import Decimal from storescraper.product import Product from storescraper.store import Store from storescraper.utils import session_with_proxy, check_ean1...
code_fim
hard
{ "lang": "python", "repo": "SoloTodo/storescraper", "path": "/storescraper/stores/pontofrio.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pricing_data = pricing_data['product'] name = urllib.parse.unquote(pricing_data['fullName']) sku = pricing_data['idSku'] price = Decimal(pricing_data['salePrice']) if pricing_data['StockAvailability']: stock = -1 else: stock = 0 ...
code_fim
hard
{ "lang": "python", "repo": "SoloTodo/storescraper", "path": "/storescraper/stores/pontofrio.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> y=self.rating.train.y if self.regression: # fit model m = LinearRegression() m.fit(self.train_veczr.sign(), y.items); # get predictions preds = m.predict(self.valid_veczr.sign()) error = mean_squared_error(self.rating.valid.y.items, preds, squared=False) print("R...
code_fim
hard
{ "lang": "python", "repo": "akrahdan/SemEval2021", "path": "/baseline_model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: akrahdan/SemEval2021 path: /baseline_model.py from fastai.text import * import sklearn.feature_extraction.text as sklearn_text import pickle from sklearn.linear_model import LogisticRegression, LinearRegression from sklearn.feature_extraction.text import CountVectorizer from dataclasses import as...
code_fim
hard
{ "lang": "python", "repo": "akrahdan/SemEval2021", "path": "/baseline_model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # get predictions preds = m.predict(self.valid_veczr.sign()) valid_labels = [label == yes for label in self.rating.valid.y.items] # check accuracy accuracy = (preds==valid_labels).mean() print(f'Accuracy = {accuracy} for Logistic Regression, with binarized trigram counts from...
code_fim
hard
{ "lang": "python", "repo": "akrahdan/SemEval2021", "path": "/baseline_model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikkokotila/learning-deep-learning path: /predict-with-saved-model.py from keras.models import model_from_json import numpy import os # SECTION 1 - Load the model # By now all of this should be pretty clear for you. # Still, check out the relevant Keras manual entry # https://keras.io/models/a...
code_fim
hard
{ "lang": "python", "repo": "mikkokotila/learning-deep-learning", "path": "/predict-with-saved-model.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>loaded_model.compile(loss='binary_crossentropy', optimizer='rmsprop', metrics=['accuracy']) score = loaded_model.evaluate(X, Y, verbose=0) print("%s: %.2f%%" % (loaded_model.metrics_names[1], score[1]*100)) # That's it, it is a simple as that!<|fim_prefix|># repo: mikkokotila/learning-deep-learning path...
code_fim
medium
{ "lang": "python", "repo": "mikkokotila/learning-deep-learning", "path": "/predict-with-saved-model.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> vf.nvr = self vf.channel = cha vf.nvrId = self.nvrId vf.mgr = self.mgr vf.previewSession = self.nvrDll.CLIENT_RealPlay( self.userSession, cha - 1, vf.GetHandle() ) # 添加到窗口列表 vf.AddToWindowList() # 实时播放...
code_fim
hard
{ "lang": "python", "repo": "danny2jenny/rec-client-python", "path": "/video/NvrDH.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: danny2jenny/rec-client-python path: /video/NvrDH.py ''' 大华 NVR 接口 ''' from _ctypes import Structure, byref from ctypes import c_ubyte, c_int, c_char_p, c_bool from video.NvrBase import NvrBase from video.RealPlayer import RealPlayerForm, PtzDir # 登录用的返回结构体 class NET_DEVICEINFO_Ex(Structure): ...
code_fim
hard
{ "lang": "python", "repo": "danny2jenny/rec-client-python", "path": "/video/NvrDH.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }