text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: zyx124/lahman_baseball_my_sql path: /Flask_REST/aeneid/test_output/test_get_from_hell.txt import requests import json def display_response(rsp): try: print("Printing a response.") print("HTTP status code: ", rsp.status_code) h = dict(rsp.headers) print("Respo...
code_fim
medium
{ "lang": "python", "repo": "zyx124/lahman_baseball_my_sql", "path": "/Flask_REST/aeneid/test_output/test_get_from_hell.txt", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> url = "http://127.0.0.1:5000/api/lahman2017/people?children=appearances%2Cbatting&people.nameLast=Williams&batting.yearID=1960&appearances.yearID=1960&fields=people.playerID%2Cpeople.nameLast%2Cpeople.nameFirst%2Cbatting.AB%2Cbatting.H%2Cappearances.G_all" print("\n test 1, ", url) ...
code_fim
medium
{ "lang": "python", "repo": "zyx124/lahman_baseball_my_sql", "path": "/Flask_REST/aeneid/test_output/test_get_from_hell.txt", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> url = "http://127.0.0.1:5000/api/lahman2017/people?children=appearances%2Cbatting&people.nameLast=Williams&batting.yearID=1960&appearances.yearID=1960&fields=people.playerID%2Cpeople.nameLast%2Cpeople.nameFirst%2Cbatting.AB%2Cbatting.H%2Cappearances.G_all" print("\n test 1, ", url) ...
code_fim
medium
{ "lang": "python", "repo": "zyx124/lahman_baseball_my_sql", "path": "/Flask_REST/aeneid/test_output/test_get_from_hell.txt", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # In[4]: print("Take an integer and find whether the number is prime or not") #input from user number = int(input("Enter any number: ")) # prime number is always greater than 1 if number > 1: for i in range(2, number): if (number % i) == 0: print(number, "is not a prime numbe...
code_fim
hard
{ "lang": "python", "repo": "Neha316/Python_assignment_Batch_6-", "path": "/Python_batch6_Day3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print("Take an integer and find whether the number is prime or not") #input from user number = int(input("Enter any number: ")) # prime number is always greater than 1 if number > 1: for i in range(2, number): if (number % i) == 0: print(number, "is not a prime number") ...
code_fim
hard
{ "lang": "python", "repo": "Neha316/Python_assignment_Batch_6-", "path": "/Python_batch6_Day3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Neha316/Python_assignment_Batch_6- path: /Python_batch6_Day3.py #!/usr/bin/env python # coding: utf-8 # In[2]: print(" sum of n numbers with help of for loop. ") n = 10 sum = 0 for num in range(0, n+1, 1): sum = sum+num print("Output: SUM of first ", n, "numbers is: ", sum ) <|fim_suffix...
code_fim
hard
{ "lang": "python", "repo": "Neha316/Python_assignment_Batch_6-", "path": "/Python_batch6_Day3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jingshiyue/my_dict_forPython path: /sqlalchemy/create_db.py # File Name: create_data.py from sqlalchemy.orm import sessionmaker from faker import Faker from db_orm import Base, engine, User, Course from sqlalchemy import MedaData session = sessionmaker(engine)() fake = Faker('zh-cn') # 创建表 use...
code_fim
medium
{ "lang": "python", "repo": "jingshiyue/my_dict_forPython", "path": "/sqlalchemy/create_db.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 执行两个创建实例的函数,session 会话内就有了这些实例 create_users() create_courses() # 执行 session 的 commit 方法将全部数据提交到对应的数据表中 session.commit() if __name__ == '__main__': # main() MedaData.tables<|fim_prefix|># repo: jingshiyue/my_dict_forPython path: /sqlalchemy/create_db.py # File Name: create_d...
code_fim
hard
{ "lang": "python", "repo": "jingshiyue/my_dict_forPython", "path": "/sqlalchemy/create_db.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x_count += 1 if x_count == 51: x_count = 1 y_count += 1 print("\n\n-----------------")<|fim_prefix|># repo: BridgerJones/TerrariaWikiScraper path: /main.py import requests import re from bs4 import BeautifulSoup r = requests.get("https://terraria.fandom.com/wiki/Banners_(...
code_fim
medium
{ "lang": "python", "repo": "BridgerJones/TerrariaWikiScraper", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: BridgerJones/TerrariaWikiScraper path: /main.py import requests import re from bs4 import BeautifulSoup r = requests.get("https://terraria.fandom.com/wiki/Banners_(en<|fim_suffix|> x_count += 1 if x_count == 51: x_count = 1 y_count += 1 print("\n\n-----------------...
code_fim
hard
{ "lang": "python", "repo": "BridgerJones/TerrariaWikiScraper", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: markus-weiss/AVGAN path: /AVGAN_1.0/dcgantest.py from __future__ import absolute_import, division, print_function, unicode_literals import tensorflow as tf tf.__version__ import glob import imageio import matplotlib.pyplot as plt import numpy as np import os import PIL from tensorflow.keras impor...
code_fim
hard
{ "lang": "python", "repo": "markus-weiss/AVGAN", "path": "/AVGAN_1.0/dcgantest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> EPOCHS = 50 noise_dim = 100 num_examples_to_generate = 16 # We will reuse this seed overtime (so it's easier) # to visualize progress in the animated GIF) seed = tf.random.normal([num_examples_to_generate, noise_dim]) # Notice the use of `tf.function` # This annotation causes the function to be "compil...
code_fim
hard
{ "lang": "python", "repo": "markus-weiss/AVGAN", "path": "/AVGAN_1.0/dcgantest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for file in contents: contents_list.append(file.find(specificData1['"' + specificData2 + '"'])) names_list.append(file.get_text()) print(contents_list) return contents_list def main(): website = input("Enter the website you want to download file from: ") div = input("Enter the div/s...
code_fim
hard
{ "lang": "python", "repo": "onthir/ULM-Forms-Download-Script", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: onthir/ULM-Forms-Download-Script path: /test.py # website = urlopen("https://webservices.ulm.edu/forms/forms-list") # data = bs(website, "lxml") # forms = data.findAll("span", {"class": "file"}) # forms_list = [] # names = [] # for f in forms: # forms_list.append(f.find("a")["href"]) # na...
code_fim
medium
{ "lang": "python", "repo": "onthir/ULM-Forms-Download-Script", "path": "/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> source_id = enqueue (*(args + (resolve_internal,))) if args else enqueue (resolve_internal) self.sources.add (source) return future #--------------------------------------------------------------------------# # Disposable ...
code_fim
hard
{ "lang": "python", "repo": "aslpavel/pretzel-old", "path": "/glib/core.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def resolve_internal (*resolve_args): self.sources.discard (source) resolve (source, *resolve_args) return False # remove from event loop if cancel: def cancel_cont (result, error): GLib.source_remove (source_id) ...
code_fim
hard
{ "lang": "python", "repo": "aslpavel/pretzel-old", "path": "/glib/core.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aslpavel/pretzel-old path: /glib/core.py # -*- coding: utf-8 -*- import time import errno from gi.repository import GLib from ..async import (FutureSourcePair, FutureCanceled, SucceededFuture, BrokenPipeError, ConnectionError) __all__ = ('GCore',) #-------------------------...
code_fim
hard
{ "lang": "python", "repo": "aslpavel/pretzel-old", "path": "/glib/core.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if parsed_args.name is not None: data = utils.filter_list_with_property(data, "name", parsed_args.name) for vtype in data: for key, value in vtype.extra_specs.items(): setattr(vtype, key, value) return (column_headers, (util...
code_fim
hard
{ "lang": "python", "repo": "nttcom/eclcli", "path": "/eclcli/storage/v2/volume_type.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def get_parser(self, prog_name): parser = super(ShowVolumeType, self).get_parser(prog_name) parser.add_argument( "volume_type", metavar="VOLUME_TYPE_ID", help="volume type to display (ID)") return parser def take_action(self, parsed_arg...
code_fim
hard
{ "lang": "python", "repo": "nttcom/eclcli", "path": "/eclcli/storage/v2/volume_type.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nttcom/eclcli path: /eclcli/storage/v2/volume_type.py import copy import six from eclcli.common import command from eclcli.common import utils from eclcli.storage.storageclient import exceptions class ListVolumeType(command.Lister): def get_parser(self, prog_name): parser = super...
code_fim
hard
{ "lang": "python", "repo": "nttcom/eclcli", "path": "/eclcli/storage/v2/volume_type.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OnGridSystems/nucypher path: /examples/drm_book_sharing.py from eth_account.account import Account from nucypher.characters.lawful import Alice, Bob, Ursula from nucypher.network.middleware import RestMiddleware from nucypher.data_sources import DataSource from umbral.keys import UmbralPublicKey ...
code_fim
hard
{ "lang": "python", "repo": "OnGridSystems/nucypher", "path": "/examples/drm_book_sharing.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> policy_end_datetime = maya.now() + datetime.timedelta(days=5) policy = author.character.grant(first_buyer.character, self.book.label, m=m, n=n, expiration=policy_end_datetime) author_pubkey = bytes(self.author.character.stamp) data_source = Data...
code_fim
hard
{ "lang": "python", "repo": "OnGridSystems/nucypher", "path": "/examples/drm_book_sharing.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> nparr = np.frombuffer(raw_data, np.byte) image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR) cv2.imshow("test", image_raw) if cv2.waitKey(1) == ord('q'): break cv2.destroyAllWindows()<|fim_prefix|># repo: jungsuyun/socket_streamer path: /url_test.py import urllib.request import ...
code_fim
medium
{ "lang": "python", "repo": "jungsuyun/socket_streamer", "path": "/url_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jungsuyun/socket_streamer path: /url_test.py import urllib.request import io import cv2 import numpy as np <|fim_suffix|> nparr = np.frombuffer(raw_data, np.byte) image_raw = cv2.imdecode(nparr, cv2.IMREAD_ANYCOLOR) cv2.imshow("test", image_raw) if cv2.waitKey(1) == ord('q'): ...
code_fim
medium
{ "lang": "python", "repo": "jungsuyun/socket_streamer", "path": "/url_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GerardoLicon/ClassificationAlgorithms path: /Naive.py # -*- coding: utf-8 -*- #imports from math import sqrt, pi, exp from csv import reader from random import seed,randrange """ Helper functions """ #calculate probability def probability(x,avg,standev): exponent = exp(-((x-avg)**2 / (2 * ...
code_fim
hard
{ "lang": "python", "repo": "GerardoLicon/ClassificationAlgorithms", "path": "/Naive.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>""" Calculate Class Probabilities """ def class_get_prob(stats,instance): num_rows = sum([stats[label][0][2] for label in stats]) prob_vals = dict() for class_val, class_stats in stats.items(): prob_vals[class_val] = stats[class_val][0][2]/float(num_rows) for i in range(len(cla...
code_fim
hard
{ "lang": "python", "repo": "GerardoLicon/ClassificationAlgorithms", "path": "/Naive.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: icarus1513/pythonAlgorithm path: /Level2/오픈채팅방.py def solution(record): answer = [] arr = dict() history = [] for i in record: tmp = i.split(<|fim_suffix|>: arr[tmp[1]] = tmp[2] for i in history : answer.append(arr[i[0]] + i[1]) return answer<|...
code_fim
hard
{ "lang": "python", "repo": "icarus1513/pythonAlgorithm", "path": "/Level2/오픈채팅방.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>: arr[tmp[1]] = tmp[2] for i in history : answer.append(arr[i[0]] + i[1]) return answer<|fim_prefix|># repo: icarus1513/pythonAlgorithm path: /Level2/오픈채팅방.py def solution(record): answer = [] arr = dict() history = [] for i in record: tmp = i.split(<|...
code_fim
hard
{ "lang": "python", "repo": "icarus1513/pythonAlgorithm", "path": "/Level2/오픈채팅방.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mg = None c1.cd() c1.Clear() Nom = GetSumHist(File = ["4fbHTTriggers.root"], Directories = dirs, Hist = histList[0], Col = r.kBlack, Norm = weights, LegendText = "") Nom.HideOverFlow() Denom = GetSumHist(File = ["4fbHTTriggers.root"], Directories = dirs, Hist = histList[1], Col = r.kRed, No...
code_fim
hard
{ "lang": "python", "repo": "brynmathias/RA1TriggerEffs", "path": "/htSums.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: brynmathias/RA1TriggerEffs path: /htSums.py #!/usr/bin/env python # encoding: utf-8 """ PreScaledTriggers.py Created by Bryn Mathias on 2011-11-02. Copyright (c) 2011 Imperial College. All rights reserved. """ import sys import os from plottingUtils import * # HLT_HT600_v1Pre_1_HLT_HT300_v9Pre...
code_fim
hard
{ "lang": "python", "repo": "brynmathias/RA1TriggerEffs", "path": "/htSums.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> path_pretrained_model = cfg.PATH_DRDSN_PRETRAINED_MODEL path_feature = cfg.PATH_FEATURE_GOOGLENET from os import walk f = [] for (dirpath, dirnames, filenames) in walk(path_feature): f.extend(filenames) break for i in f: features = np.load(os.path.join(path...
code_fim
hard
{ "lang": "python", "repo": "tiendv/videosummarizationframework", "path": "/source/src/baseline/VASNet/VASNet_frame_scoring.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tiendv/videosummarizationframework path: /source/src/baseline/VASNet/VASNet_frame_scoring.py import os,sys,glob sys.path.append("../../../../libs/VASNet/") from VASNet_frame_scoring_lib import * sys.path.append("../../../config") from config import * <|fim_suffix|> path_pretrained_model = cf...
code_fim
hard
{ "lang": "python", "repo": "tiendv/videosummarizationframework", "path": "/source/src/baseline/VASNet/VASNet_frame_scoring.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: binary13/Python_Koans path: /python3/koans/triangle.py #!/usr/bin/env python # -*- coding: utf-8 -*- # Triangle Project Code. # Triangle analyzes the lengths of the sides of a triangle # (represented by a, b and c) and returns the type of triangle. # # It returns: # 'equilateral' if all side...
code_fim
medium
{ "lang": "python", "repo": "binary13/Python_Koans", "path": "/python3/koans/triangle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if unique_sides in range(1,4) and sides_positive() and sides_reach(): return type.get(unique_sides) else: raise TriangleError # Error class used in part 2. No need to change this code. class TriangleError(Exception): pass<|fim_prefix|># repo: binary13/Python_Koans path: /py...
code_fim
hard
{ "lang": "python", "repo": "binary13/Python_Koans", "path": "/python3/koans/triangle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zilahir/elteik-wf-grade path: /tests/resources/varlist.py import types from robot.libraries.BuiltIn import BuiltIn def GetAllVariableBySuffix (endswith): all_vars = BuiltIn().get_variables() result = {} for var_name, var in all_vars.items(): #print var_name if var_nam...
code_fim
medium
{ "lang": "python", "repo": "zilahir/elteik-wf-grade", "path": "/tests/resources/varlist.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def CountFinalPoints (): all_vars = BuiltIn().get_variables() result = 0 result = int(result) for var_name, var in all_vars.items(): #print var_name if var_name.endswith("Points}"): result += int(var) #print var return result<|fim_prefix|># repo:...
code_fim
hard
{ "lang": "python", "repo": "zilahir/elteik-wf-grade", "path": "/tests/resources/varlist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> all_vars = BuiltIn().get_variables() result = 0 result = int(result) for var_name, var in all_vars.items(): #print var_name if var_name.endswith("Points}"): result += int(var) #print var return result<|fim_prefix|># repo: zilahir/elteik-wf-grade ...
code_fim
hard
{ "lang": "python", "repo": "zilahir/elteik-wf-grade", "path": "/tests/resources/varlist.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yunse2633s/blogsSj path: /python_demo/201811/helloworld/helloworld/urls.py """helloworld URL Configuration The `urlpatterns` list routes URLs to views. For more information please see: https://docs.djangoproject.com/en/2.1/topics/http/urls/ https://docs.djangoproject.com/zh-hans/2.1/topi...
code_fim
medium
{ "lang": "python", "repo": "yunse2633s/blogsSj", "path": "/python_demo/201811/helloworld/helloworld/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from . import view # 如何链接其他文件模块下的路径呢 # urlpatterns = [ # path('hello/', view.hello), # path('hello/<int:year>/', view.hello), # hello()中要有对应的参数 # path('ifor/', view.ifor), path('admin/', admin.site.urls), # path('blog/', blog.views.goodbye), # path('', include('blog.urls.py', name...
code_fim
medium
{ "lang": "python", "repo": "yunse2633s/blogsSj", "path": "/python_demo/201811/helloworld/helloworld/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>" %vat) print("Total : %.2f Baht" %(moeny+vat+service)) main()<|fim_prefix|># repo: boomNDS/prepro_play path: /w1/Restaurant.py """Restaurant""" def main(): """Restaurant""" moeny = int(input()) service = moeny*0.1 vat = moeny*0.07 print(<|fim_middle|>"Service Charge : %.2f Baht" ...
code_fim
medium
{ "lang": "python", "repo": "boomNDS/prepro_play", "path": "/w1/Restaurant.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: boomNDS/prepro_play path: /w1/Restaurant.py """Restaurant""" def main(): """Restaurant""" moeny = int<|fim_suffix|>"Service Charge : %.2f Baht" %service) print("VAT : %.2f Baht" %vat) print("Total : %.2f Baht" %(moeny+vat+service)) main()<|fim_middle|>(input()) service = moeny...
code_fim
medium
{ "lang": "python", "repo": "boomNDS/prepro_play", "path": "/w1/Restaurant.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Omar-V2/Collision-Avoidance path: /game_loop.py import pygame from evolution import Darwin from Sensor import Robot, obstacleArray # Game Settings pygame.init() background_colour = (0, 0, 0) (width, height) = (1000, 600) target_location = (800, 300) screen = pygame.display.set_mode((width, heig...
code_fim
medium
{ "lang": "python", "repo": "Omar-V2/Collision-Avoidance", "path": "/game_loop.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False screen.fill(background_colour) pygame.draw.rect(screen, (255, 255, 255), (10, 10, width - 20, height - 20), 1) pygame.draw.circle(screen, (255, 10, 0),...
code_fim
hard
{ "lang": "python", "repo": "Omar-V2/Collision-Avoidance", "path": "/game_loop.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: RARYates/bolt-experiments path: /Boltdir/site-modules/sample/tasks/generate.py #!/usr/bin/env python import os, sys, json sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python_task_helper', 'files')) from task_helper import TaskHelper hosts_file = open("/etc/hosts", "r").r...
code_fim
easy
{ "lang": "python", "repo": "RARYates/bolt-experiments", "path": "/Boltdir/site-modules/sample/tasks/generate.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': Generate().run()<|fim_prefix|># repo: RARYates/bolt-experiments path: /Boltdir/site-modules/sample/tasks/generate.py #!/usr/bin/env python import os, sys, json sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', 'python_task_helper', 'files')) from task_help...
code_fim
hard
{ "lang": "python", "repo": "RARYates/bolt-experiments", "path": "/Boltdir/site-modules/sample/tasks/generate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def task(self, args): return {'result': output} if __name__ == '__main__': Generate().run()<|fim_prefix|># repo: RARYates/bolt-experiments path: /Boltdir/site-modules/sample/tasks/generate.py #!/usr/bin/env python import os, sys, json sys.path.append(os.path.join(os.path.dirname(__file__...
code_fim
easy
{ "lang": "python", "repo": "RARYates/bolt-experiments", "path": "/Boltdir/site-modules/sample/tasks/generate.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if disciplina_id and doc_discente_id: doc_discente = self.pool.get("ud.monitoria.documentos.discente").browse(cr, uid, doc_discente_id, context) doc_discente_id = doc_discente_id if doc_discente.disciplina_id.id == disciplina_id else False return { ...
code_fim
hard
{ "lang": "python", "repo": "ntiufalara/universidade-digital", "path": "/openerp/addons/ud_monitoria/wizards/alteracao_bolsas_wizard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ntiufalara/universidade-digital path: /openerp/addons/ud_monitoria/wizards/alteracao_bolsas_wizard.py doc.discente_id.id)]}} return {"value": {"dados_bancarios_id": False}, "domain": {"dados_bancarios_id": [("id", "=", False)]}} def onchange_banco(self, cr, uid, ids,...
code_fim
hard
{ "lang": "python", "repo": "ntiufalara/universidade-digital", "path": "/openerp/addons/ud_monitoria/wizards/alteracao_bolsas_wizard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for rows in _res_iter: def process_rows(_rows): for row in _rows: for column in columns: if column in row: del row[column] yield row yield process_rows(rows) spew(datapackage, process_resources(res...
code_fim
hard
{ "lang": "python", "repo": "Vanuan/datapackage-pipelines", "path": "/datapackage_pipelines/lib/delete-columns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def process_resources(_res_iter): for rows in _res_iter: def process_rows(_rows): for row in _rows: for column in columns: if column in row: del row[column] yield row yield process_rows(rows) spew...
code_fim
hard
{ "lang": "python", "repo": "Vanuan/datapackage-pipelines", "path": "/datapackage_pipelines/lib/delete-columns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vanuan/datapackage-pipelines path: /datapackage_pipelines/lib/delete-columns.py from datapackage_pipelines.wrapper import ingest, spew params, datapackage, res_iter = ingest() <|fim_suffix|> for row in _rows: for column in columns: if column in row...
code_fim
hard
{ "lang": "python", "repo": "Vanuan/datapackage-pipelines", "path": "/datapackage_pipelines/lib/delete-columns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bases=(models.Model,), ), migrations.AddField( model_name='fichatecnica', name='metrado1', field=models.ForeignKey(related_name='ficha_tecnica', to='metrados.Metrado1'), preserve_default=True, ), migrations.AddField( ...
code_fim
hard
{ "lang": "python", "repo": "sirlo21/sagipnp", "path": "/metrados/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sirlo21/sagipnp path: /metrados/migrations/0001_initial.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ('levantamiento', '0001_initial'), ] operations = [ ...
code_fim
hard
{ "lang": "python", "repo": "sirlo21/sagipnp", "path": "/metrados/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>transactions.to_csv('./results/transactions_500_newthreshold.csv') totalOrders.to_csv('./results/totalOrders_500_newthreshold.csv') np.save('./results/stockPool_500_newthreshold.npy',TstockPool) np.save('./results/hurstPool_500_newthreshold.npy',ThurstPool) conf = open('./results/config_500_newthresholded...
code_fim
hard
{ "lang": "python", "repo": "braedyn-au/StockMarketCascades", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: braedyn-au/StockMarketCascades path: /main.py print("RUNNING ON CPU") from library import config, utils, broker_funcs, portfolio import numpy as np import pandas as pd # import matplotlib.pyplot as plt from fbm.fbmlib import fbm import time import pickle assert config.changePrice == True print(...
code_fim
hard
{ "lang": "python", "repo": "braedyn-au/StockMarketCascades", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ orders a rectangle in the order top-left, top-right, bottom-right, bottom-left """ new = np.zeros((4, 2), dtype="int64") s = pts.sum(axis=1) new[0] = pts[np.argmin(s)] new[2] = pts[np.argmax(s)] diff = np.diff(pts, axis=1) new[1] = pts[np.argmin(diff)] new[...
code_fim
hard
{ "lang": "python", "repo": "lucianbc/ReceiptScan", "path": "/docs/code/tesseractOcr.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ancylq/core_py_programming_test path: /2.socket/tcpServerSS.py #!/usr/bin/env python # coding:utf-8 import time from SocketServer import (TCPServer as TCP, StreamRequestHandler as SRH) <|fim_suffix|>class MyRequestHandler(SRH): def handle(self): print '...co...
code_fim
medium
{ "lang": "python", "repo": "ancylq/core_py_programming_test", "path": "/2.socket/tcpServerSS.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class MyRequestHandler(SRH): def handle(self): print '...connected from :', self.client_address self.wfile.write('[%s] %s' % (time.ctime(), self.rfile.readline())) tcpServ = TCP(ADDR, MyRequestHandler) print 'waiting for connection...' tc...
code_fim
medium
{ "lang": "python", "repo": "ancylq/core_py_programming_test", "path": "/2.socket/tcpServerSS.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kynax/AdventOfCode path: /2019/day06/part1.py import sys class Obj: def __init__(self, name): self.name = name self.down = [] def add_child(self, obj): self.down.append(obj) def prnt(self, prev): if not self.down: print(prev +...
code_fim
hard
{ "lang": "python", "repo": "kynax/AdventOfCode", "path": "/2019/day06/part1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return d COM = Obj('COM') orbits = {} orbits['COM'] = COM effects = [x.strip().split(')') for x in list(sys.stdin)] for c,o in effects: obj = None if o in orbits: obj = orbits[o] else: obj = Obj(o) orbits[o] = obj if c in orbits: ...
code_fim
hard
{ "lang": "python", "repo": "kynax/AdventOfCode", "path": "/2019/day06/part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def distance(self, start): d = start if not self.down: print(self.name, start) for n in self.down: d += n.distance(start + 1) return d COM = Obj('COM') orbits = {} orbits['COM'] = COM eff...
code_fim
hard
{ "lang": "python", "repo": "kynax/AdventOfCode", "path": "/2019/day06/part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ If calculation fails due to time limits, we simply resubmit it. """ from aiida.common.exceptions import NotExistent # if previous calculation failed for the same reason, do not restart try: prev_calculation_remote = calculation.base.links.ge...
code_fim
hard
{ "lang": "python", "repo": "JuDFTteam/aiida-fleur", "path": "/aiida_fleur/workflows/base_fleur.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuDFTteam/aiida-fleur path: /aiida_fleur/workflows/base_fleur.py ######################################## # Copyright (c), Forschungszentrum Jülich GmbH, IAS-1/PGI-1, Germany. # # All rights reserved. # # This file is part of the AiiD...
code_fim
hard
{ "lang": "python", "repo": "JuDFTteam/aiida-fleur", "path": "/aiida_fleur/workflows/base_fleur.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JuDFTteam/aiida-fleur path: /aiida_fleur/workflows/base_fleur.py restarts""" _workflowversion = '0.2.1' _process_class = FleurCalculation @classmethod def define(cls, spec): super().define(spec) spec.expose_inputs(FleurCalculation, exclude=('metadata.options',)) ...
code_fim
hard
{ "lang": "python", "repo": "JuDFTteam/aiida-fleur", "path": "/aiida_fleur/workflows/base_fleur.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: UsamaAbdali/movie_star_network path: /network.py import csv import json import re import itertools import pandas as pd import networkx as nx import matplotlib.pyplot as plt from networkx.algorithms import community import snap import numpy # setting up data structures to map actor IDs to objects...
code_fim
hard
{ "lang": "python", "repo": "UsamaAbdali/movie_star_network", "path": "/network.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def link_pred(): splPG = dict(nx.all_pairs_shortest_path_length(PG, cutoff=2)) friends_PG = list() for x in splPG.keys(): for y in splPG[x].keys(): if splPG[x][y] == 2: l = list() l.append(x) l.append(y) frien...
code_fim
hard
{ "lang": "python", "repo": "UsamaAbdali/movie_star_network", "path": "/network.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yskang/AlgorithmPractice path: /baekjoon/python/kth_number_11004.py # Title: K번째 수 # Link: https://www.acmicpc.net/problem/11004 import sys sys.setrecursionlimit(10 ** 6) def read_list_int(): return list(map(int, sys.stdin.readline().strip().split(' '))) <|fim_suffix|>def get_...
code_fim
hard
{ "lang": "python", "repo": "yskang/AlgorithmPractice", "path": "/baekjoon/python/kth_number_11004.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def partition(nums, left, right, pivot_index): pivot_value = nums[pivot_index] nums[pivot_index], nums[right] = nums[right], nums[pivot_index] store_index = left for i in range(left, right): if nums[i] < pivot_value: nums[store_index], nums[i] = nums[i], nums[st...
code_fim
hard
{ "lang": "python", "repo": "yskang/AlgorithmPractice", "path": "/baekjoon/python/kth_number_11004.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if d_iter_times % 5 == 0: g_iter_times += 1 g_update_times += 1 # begin training generator with autograd.record(): fake_img = generator(nosise) with autograd.predict_mode(): out = discriminator(fake...
code_fim
hard
{ "lang": "python", "repo": "troyliu0105/Anime-GAN", "path": "/train_dcgan.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # use validation set or not if should_use_val: g_val_loss, d_val_loss = validation(generator, discriminator, val_loader) history.update([g_train_loss, g_val_loss, d_train_loss, d_val_loss]) logger.info("Generator[train: {}, val: {}]"....
code_fim
hard
{ "lang": "python", "repo": "troyliu0105/Anime-GAN", "path": "/train_dcgan.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: troyliu0105/Anime-GAN path: /train_dcgan.py # %% import libs import os import argparse import logging as logger import mxnet as mx import tqdm from mxnet import autograd from mxnet import gluon from gluoncv.utils import makedirs import datasets as gan_datasets from utils import vis, get_cpus, Tr...
code_fim
hard
{ "lang": "python", "repo": "troyliu0105/Anime-GAN", "path": "/train_dcgan.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: roeischuster/sublinear-project path: /wsim.py import pickle import time DECAY = 0.95 DEPTH = 2 def init_cache(g): ''' Initialize simrank cache for graph g ''' g.cache = {} def return_and_cache(g, element, val): ''' Code (and function name) is pretty self explainatory here ''' g.cache[el...
code_fim
hard
{ "lang": "python", "repo": "roeischuster/sublinear-project", "path": "/wsim.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def read_neighbours(g): ''' Read neighbours of all nodes from disk into memory. Neighbours are assumed to be stored under the "neighbours" directory. ''' i = 0 for auth_id, auth in g.authors.iteritems(): auth.neighbours = pickle.load(open("neighbourhood/%s"%auth_id, 'rb')) if (i % 500) == 0: ...
code_fim
hard
{ "lang": "python", "repo": "roeischuster/sublinear-project", "path": "/wsim.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Carlosterre/Aeropython path: /Clase_002b-Sintaxis_basica_II_librerias-Ejercicio.py # 1.- Crear una grafica que muestre la desviacion tipica de los datos cada dia para todos los pacientes # 2.- Crear una grafica que muestre a la vez la inflamacion maxima, media y minima para cada dia <|fim_suf...
code_fim
hard
{ "lang": "python", "repo": "Carlosterre/Aeropython", "path": "/Clase_002b-Sintaxis_basica_II_librerias-Ejercicio.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>import matplotlib.pyplot as plt plt.plot(data.std(axis=0)) # Desviacion tipica por dia plt.show() plt.plot(data.max(axis=0)) # Inflamacion maxima, media y minima para cada dia plt.plot(data.mean...
code_fim
medium
{ "lang": "python", "repo": "Carlosterre/Aeropython", "path": "/Clase_002b-Sintaxis_basica_II_librerias-Ejercicio.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>t (cosinus_imaginary) print (sinus_real) print (sinus_imag)<|fim_prefix|># repo: kacpermisiek/JSP2019 path: /lista1/zadanie10.py import math z = 1j cosinus_real = math.cos(z.real) cosinus_imaginary = math.cos(z.imag) sinus_real = math.sin(z.rea<|fim_middle|>l) sinus_imag = math.sin(z.imag) print (cos...
code_fim
easy
{ "lang": "python", "repo": "kacpermisiek/JSP2019", "path": "/lista1/zadanie10.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kacpermisiek/JSP2019 path: /lista1/zadanie10.py import math z = 1j cosinus_real = math.cos(z.real) cosinus_imaginary = math.cos(z.imag) sinus_real = math.sin(z.rea<|fim_suffix|>t (cosinus_imaginary) print (sinus_real) print (sinus_imag)<|fim_middle|>l) sinus_imag = math.sin(z.imag) print (cos...
code_fim
easy
{ "lang": "python", "repo": "kacpermisiek/JSP2019", "path": "/lista1/zadanie10.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Sanity check this sync result. We shouldn't be joined to the room. self.assertEqual(eve_sync_after_ban.joined, []) # Eve tries to join the room. We monkey patch the internal logic which selects # the prev_events used when creating the join event, such that the ban does n...
code_fim
hard
{ "lang": "python", "repo": "matrix-org/synapse", "path": "/tests/handlers/test_sync.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: matrix-org/synapse path: /tests/handlers/test_sync.py # Copyright 2018 New Vector Ltd # # 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://www.apache.org/lice...
code_fim
hard
{ "lang": "python", "repo": "matrix-org/synapse", "path": "/tests/handlers/test_sync.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> print(event_list) return event_list def tasklist(name): pjts = TDIAPI.state['projects'] items = TDIAPI.state['items'] labels = TDIAPI.state['labels'] sects = TDIAPI.state['sections'] inbox_list = [] doing_list = [] review_list = [] any_list = [] for projects...
code_fim
hard
{ "lang": "python", "repo": "inamuu/aws_lambda_tools", "path": "/todoist_notify/lambda.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: inamuu/aws_lambda_tools path: /todoist_notify/lambda.py # coding: utf-8 import datetime import json import requests import os import re import sys from todoist.api import TodoistAPI #SLACK_CHANNEL = os.environ['SLACK_CHANNEL'] #SLACK_POSTURL = os.environ['SLACK_POSTURL'] TDIAPI = TodoistAPI(os....
code_fim
hard
{ "lang": "python", "repo": "inamuu/aws_lambda_tools", "path": "/todoist_notify/lambda.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: ret, frame2 = cap.read() if flip: frame2 = cv2.flip(frame2, 1) if resize: frame2 = cv2.resize(frame2, (width, height), interpolation=cv2.INTER_CUBIC) cv2.imshow('frame1', frame2) except Exc...
code_fim
hard
{ "lang": "python", "repo": "alisure-ml/python-video-image-gif", "path": "/opencv/optical_flow/optical_flow_pyrlk.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while True: try: ret, frame2 = cap.read() frame2 = cv2.flip(frame2, 1) except Exception: break pass next = cv2.cvtColor(frame2, cv2.COLOR_BGR2GRAY) flow = cv2.calcOpticalFlowFarneback(prvs, next, None, 0.5, 3, 15, 3, 5, 1...
code_fim
hard
{ "lang": "python", "repo": "alisure-ml/python-video-image-gif", "path": "/opencv/optical_flow/optical_flow_pyrlk.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: alisure-ml/python-video-image-gif path: /opencv/optical_flow/optical_flow_pyrlk.py import numpy as np import cv2 def optical_flow_from_video(): cap = cv2.VideoCapture("/home/ubuntu/data1.5TB/异常dataset/Avenue_dataset/training_videos/01.avi") # 设置 ShiTomasi 角点检测的参数 feature_params = d...
code_fim
hard
{ "lang": "python", "repo": "alisure-ml/python-video-image-gif", "path": "/opencv/optical_flow/optical_flow_pyrlk.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def get_params(self, deep=True): """ return params """ args, _, _, _ = inspect.getargspec(super(SIL, self).__init__) args.pop(0) return {key: getattr(self, key, None) for key in args} def _inst_to_bag_preds(inst_preds, bags): return np.array([np.ma...
code_fim
hard
{ "lang": "python", "repo": "ngonthier/Icono_Art_Analysis", "path": "/Classif_Paintings/milsvm/sil.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ngonthier/Icono_Art_Analysis path: /Classif_Paintings/milsvm/sil.py """ Implements Single Instance Learning SVM From https://github.com/garydoranjr/misvm/blob/master/misvm/sil.py Modified by Nicolas """ from __future__ import print_function, division import numpy as np import inspect from sklearn...
code_fim
hard
{ "lang": "python", "repo": "ngonthier/Icono_Art_Analysis", "path": "/Classif_Paintings/milsvm/sil.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>t = threading.Thread(target=work) # Daemon 설정 #t.setDaemon(True) t.daemon = True # 혹인 이렇게도 가능 t.start() print 'main thread finished'<|fim_prefix|># repo: DaMacho/data-science-school-5th path: /day18 concurrency/thread1.py # -*- coding: utf-8 -*- import threading import time <|fim_middle|>def work(): ...
code_fim
medium
{ "lang": "python", "repo": "DaMacho/data-science-school-5th", "path": "/day18 concurrency/thread1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DaMacho/data-science-school-5th path: /day18 concurrency/thread1.py # -*- coding: utf-8 -*- import threading import time <|fim_suffix|> i = 0 while i < 10: print 'I am working..' time.sleep(0.5) i += 1 t = threading.Thread(target=work) # Daemon 설정 #t.setDaemon(Tr...
code_fim
easy
{ "lang": "python", "repo": "DaMacho/data-science-school-5th", "path": "/day18 concurrency/thread1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: langphil/iss-notifier path: /iss.py import time import datetime from pushover import init, Client from scraper import * from config import * # Get the current time timeNow = time.strftime("%a %b %d, %I:%M %p").lstrip("0").replace(" 0", " ") # Initialise Pushover for notifications client = Clien...
code_fim
medium
{ "lang": "python", "repo": "langphil/iss-notifier", "path": "/iss.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Loop for times of ISS passes and compare to current time def issCheck(): for i in column.keys(): for x in column[i]: if i == 'Date': issNow = x if issNow == timeNow: client.send_message("ISS is over London: " + x, title="ISS") ...
code_fim
medium
{ "lang": "python", "repo": "langphil/iss-notifier", "path": "/iss.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Initialise Pushover for notifications client = Client(user_key, api_token=api_token) # Loop for times of ISS passes and compare to current time def issCheck(): for i in column.keys(): for x in column[i]: if i == 'Date': issNow = x if issNow == ti...
code_fim
medium
{ "lang": "python", "repo": "langphil/iss-notifier", "path": "/iss.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # Send request and wait for completion self.response.result() # Write output image disp_mat_scaled = (self.disp_mat.view(np.ndarray)*(256.0 / 48.0) / (16.0)).astype(np.uint8) self.m_runEndTime = int(round(time.time() * 1000000)) return disp_mat_scaled; def run(self, left_img, right_img): ...
code_fim
hard
{ "lang": "python", "repo": "inaccel/Vitis_Libraries", "path": "/quantitative_finance/L3/python/inaccel/vitis/vision/_vision_stereobm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.response = inaccel.submit(req) def wait(self): # Send request and wait for completion self.response.result() # Write output image disp_mat_scaled = (self.disp_mat.view(np.ndarray)*(256.0 / 48.0) / (16.0)).astype(np.uint8) self.m_runEndTime = int(round(time.time() * 1000000)) return ...
code_fim
hard
{ "lang": "python", "repo": "inaccel/Vitis_Libraries", "path": "/quantitative_finance/L3/python/inaccel/vitis/vision/_vision_stereobm.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: inaccel/Vitis_Libraries path: /quantitative_finance/L3/python/inaccel/vitis/vision/_vision_stereobm.py import inaccel.coral as inaccel import numpy as np import time class StereoBM: def __init__(self, cameraMA_l=None, cameraMA_r=None, distC_l=None, distC_r=None, irA_l=None, irA_r=None, bm_state...
code_fim
hard
{ "lang": "python", "repo": "inaccel/Vitis_Libraries", "path": "/quantitative_finance/L3/python/inaccel/vitis/vision/_vision_stereobm.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>H = [1,5,10,11,12,20,40] for h in H: file = open("Out\\out-h"+str(h)+".txt", "r") line = file.readlines()[-1] file.close() line = line.split(",") loss = line[1] acc_tr = line[2] acc_va = line[3] table.write(str(h)+" & "+loss+" & "+acc_tr+" & "+acc_va+" \\\\\n") table.write("\\hline\n") table.writ...
code_fim
medium
{ "lang": "python", "repo": "dagrawa2/cosc528_machine_learning", "path": "/project4-mlp/table1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dagrawa2/cosc528_machine_learning path: /project4-mlp/table1.py from __future__ import division import numpy as np table = open("Tables\\table1.txt", "w") <|fim_suffix|>H = [1,5,10,11,12,20,40] for h in H: file = open("Out\\out-h"+str(h)+".txt", "r") line = file.readlines()[-1] file.close() ...
code_fim
medium
{ "lang": "python", "repo": "dagrawa2/cosc528_machine_learning", "path": "/project4-mlp/table1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>table.write("\\hline\n") table.write("\\end{tabular}") table.close()<|fim_prefix|># repo: dagrawa2/cosc528_machine_learning path: /project4-mlp/table1.py from __future__ import division import numpy as np table = open("Tables\\table1.txt", "w") <|fim_middle|>table.write("\\begin{tabular}{|c|c|c|c|} \\...
code_fim
hard
{ "lang": "python", "repo": "dagrawa2/cosc528_machine_learning", "path": "/project4-mlp/table1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikefraanje/Programming-Blok1 path: /les2/pe2_2.py cijferICOR = float(input('Wat is je cijfer voor ICOR?: ')) x = 30 beloningICOR = cijferICOR * x beloning = 'beloning €' print(beloning, beloningICOR) <|fim_suffix|>totalevergoeding = beloningICOR + beloningPROG + beloningCSN print('uw to...
code_fim
hard
{ "lang": "python", "repo": "mikefraanje/Programming-Blok1", "path": "/les2/pe2_2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>gemiddeld_cijfer = (cijferICOR + cijferPROG + cijferCSN) / 3 print('mijn cijfers gemiddeld is een', gemiddeld_cijfer, 'en dat levert een beloning op van: €', totalevergoeding)<|fim_prefix|># repo: mikefraanje/Programming-Blok1 path: /les2/pe2_2.py cijferICOR = float(input('Wat is je cijfer voor ICOR?: '...
code_fim
hard
{ "lang": "python", "repo": "mikefraanje/Programming-Blok1", "path": "/les2/pe2_2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>key = '' while key != ord('q'): key = stdscr.getch() stdscr.refresh() if key == curses.KEY_UP: forward = forward + 1; if forward >= 40: forward = 40 elif forward < -40: forward = -40 stdscr.addstr(2, 20, "Up ") stdscr.addstr(2, 25, '%.2f' % forward) stdscr.addstr(5, 20, " ") e...
code_fim
medium
{ "lang": "python", "repo": "JmfanBU/F1tenth_BU", "path": "/racecar_simulator/racecar_control/scripts/keyboard_teleop.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }