text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> template_name = 'orders/index.html' queryset = Order.objects.all() context_object_name = 'order_list' class OrderCreateView(CreateView): template_name = 'orders/form.html' form_class = OrderForm success_url = '/'<|fim_prefix|># repo: lynx-r/pizza-test path: /apps/orders/views.py...
code_fim
easy
{ "lang": "python", "repo": "lynx-r/pizza-test", "path": "/apps/orders/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Sh1vam/javes-3.0 path: /ub/javes_main/commands.py from telethon import events from var import Var from pathlib import Path from ub.config import Config import re, logging, inspect, sys, json, os from asyncio import create_subprocess_shell as asyncsubshell, subprocess as asyncsub from os import re...
code_fim
hard
{ "lang": "python", "repo": "Sh1vam/javes-3.0", "path": "/ub/javes_main/commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>async def progress(current, total, event, start, type_of_ps, file_name=None): now = time.time() diff = now - start if round(diff % 10.00) == 0 or current == total: percentage = current * 100 / total speed = current / diff elapsed_time = round(diff) * 1000 time_t...
code_fim
hard
{ "lang": "python", "repo": "Sh1vam/javes-3.0", "path": "/ub/javes_main/commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wtbarnes/micro-scrabble path: /micro_scrabble/__init__.py import os,sys import logging from flask import Flask from flask_bootstrap import Bootstrap from flask_sqlalchemy import SQLAlchemy <|fim_suffix|> app = Flask(__name__) Bootstrap(app) return app logging.basicConfig(level=loggin...
code_fim
medium
{ "lang": "python", "repo": "wtbarnes/micro-scrabble", "path": "/micro_scrabble/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app = Flask(__name__) Bootstrap(app) return app logging.basicConfig(level=logging.DEBUG) app = create_app() app.config['WTF_CSRF_ENABLED'] = True app.config['SECRET_KEY'] = 'you-will-never-guess' app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:///' + os.path.join(os.path.dirname(os.path.dirn...
code_fim
medium
{ "lang": "python", "repo": "wtbarnes/micro-scrabble", "path": "/micro_scrabble/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blodvan1/myems path: /myems/migrations/0005_auto_20201119_1419.py # Generated by Django 3.1.3 on 2020-11-19 06:19 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.RenameField( model_name='dg', old_name='sn', new_na...
code_fim
hard
{ "lang": "python", "repo": "blodvan1/myems", "path": "/myems/migrations/0005_auto_20201119_1419.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('myems', '0004_auto_20201118_1446'), ] operations = [ migrations.RenameField( model_name='dg', old_name='sn', new_name='id', ), migrations.AddField( model_name='dg', name='code_ean13...
code_fim
hard
{ "lang": "python", "repo": "blodvan1/myems", "path": "/myems/migrations/0005_auto_20201119_1419.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.error_log = logzero.setup_logger("gunicorn", **logger_args)<|fim_prefix|># repo: janw/alertmanager-telegram path: /alertmanager_telegram/logging.py import logging import os import logzero from gunicorn.glogging import Logger _log_level = os.environ.get("LOG_LEVEL", "info").upper() log_leve...
code_fim
medium
{ "lang": "python", "repo": "janw/alertmanager-telegram", "path": "/alertmanager_telegram/logging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: janw/alertmanager-telegram path: /alertmanager_telegram/logging.py import logging import os import logzero from gunicorn.glogging import Logger <|fim_suffix|> self.error_log = logzero.setup_logger("gunicorn", **logger_args)<|fim_middle|>_log_level = os.environ.get("LOG_LEVEL", "info").up...
code_fim
hard
{ "lang": "python", "repo": "janw/alertmanager-telegram", "path": "/alertmanager_telegram/logging.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> super().__init__(cfg) self.error_log = logzero.setup_logger("gunicorn", **logger_args)<|fim_prefix|># repo: janw/alertmanager-telegram path: /alertmanager_telegram/logging.py import logging import os import logzero from gunicorn.glogging import Logger _log_level = os.environ.get("LOG_L...
code_fim
medium
{ "lang": "python", "repo": "janw/alertmanager-telegram", "path": "/alertmanager_telegram/logging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># # Call sendAlert function # emailgen.sendAlert(recipient, subject, text, sender, password)<|fim_prefix|># repo: jsirianni/system-alerts path: /hddtempalert.py #!/usr/bin/env python3 import os import subprocess import emailgen # # Header information # recipient = input("recipient: ") sender = input("s...
code_fim
hard
{ "lang": "python", "repo": "jsirianni/system-alerts", "path": "/hddtempalert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jsirianni/system-alerts path: /hddtempalert.py #!/usr/bin/env python3 import os import subprocess import emailgen # # Header information # recipient = input("recipient: ") sender = input("sender: ") password = input("sender password: ") subject = "hdd temp alert" # # Get hdd temp, format for e...
code_fim
medium
{ "lang": "python", "repo": "jsirianni/system-alerts", "path": "/hddtempalert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: CaptainChuenthavorn/DATA-STRUCTURE-AND-AlGORITHM path: /lab6_recursive/again.py def pantip(k, n, arr, path,len): if len == 0: if sum(path)==k: path.reverse() print(path) <|fim_suffix|>n-1) inp = input('Enter Input (Money, Product) : ').split('/') arr =...
code_fim
medium
{ "lang": "python", "repo": "CaptainChuenthavorn/DATA-STRUCTURE-AND-AlGORITHM", "path": "/lab6_recursive/again.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tip(int(inp[0]), 0, arr, [],len) print("Krisada can purchase Product: {0} with: {1} Baht | {2} Pattern".format(arr, inp[0], pattern))<|fim_prefix|># repo: CaptainChuenthavorn/DATA-STRUCTURE-AND-AlGORITHM path: /lab6_recursive/again.py def pantip(k, n, arr, path,len): if len == 0: if sum(pa...
code_fim
hard
{ "lang": "python", "repo": "CaptainChuenthavorn/DATA-STRUCTURE-AND-AlGORITHM", "path": "/lab6_recursive/again.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.rut class DetalleVenta(models.Model): tipo_comprovante = models.CharField(max_length=100) serie_comprovante = models.CharField(max_length=7) fecha_comprovante = models.DateField(max_length=100) iva = models.IntegerField() total = models.Integ...
code_fim
hard
{ "lang": "python", "repo": "NicolasFuentemavida/Fundacion_Planta_Corp", "path": "/app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mail = models.CharField(max_length=100) contraseña = models.CharField(max_length=100) rut = models.ForeignKey(Cliente, on_delete=models.CASCADE) def __str__(self): return self.rut class DetalleVenta(models.Model): tipo_comprovante = models.CharField(max_length=100) serie_...
code_fim
hard
{ "lang": "python", "repo": "NicolasFuentemavida/Fundacion_Planta_Corp", "path": "/app/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: NicolasFuentemavida/Fundacion_Planta_Corp path: /app/models.py from django.db import models from django.db.models.base import Model # Create your models here. class Categoria(models.Model): categoria = models.CharField(max_length=40) def __str__(self): return self.categoria clas...
code_fim
hard
{ "lang": "python", "repo": "NicolasFuentemavida/Fundacion_Planta_Corp", "path": "/app/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @commands.command(name="uuidtoname", aliases=["getgamertag"]) @commands.cooldown(1, 2, commands.BucketType.user) async def get_gamertag(self, ctx, uuid: str): response = await self.session.get(f"https://api.mojang.com/user/profiles/{uuid}/names") if response.status == 204: ...
code_fim
hard
{ "lang": "python", "repo": "Iapetus-11/Hypixel-Stats", "path": "/cogs/cmds/basic_mc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kqf/ds-bowl-2018 path: /model/main.py import time import click from contextlib import contextmanager from pathlib import Path from model.data import CellsDataset from model.model import build_model, train_transform, test_transform from model.vis import plot_cells @contextmanager def timer(name)...
code_fim
hard
{ "lang": "python", "repo": "kqf/ds-bowl-2018", "path": "/model/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dirs = [p for p in Path(path).iterdir() if p.is_dir()] dataset = CellsDataset(dirs[:5], transform=train_transform()) plot_cells(*zip(*dataset)) model = build_model(max_epochs=2) with timer("Train the model"): model.fit(dataset) infer(model, dataset, "train") # Infer ...
code_fim
hard
{ "lang": "python", "repo": "kqf/ds-bowl-2018", "path": "/model/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # [batch_size, 3, 256, 32, 32] x = x.view(batch_size, c_in, self.discrete_channel, height, width) # [batch_size, 3, 32, 32, 256] x = x.permute(0, 1, 3, 4, 2) return x<|fim_prefix|># repo: zh-tan/Game-Music-Generation path: /models.py import torch.nn as nn from la...
code_fim
medium
{ "lang": "python", "repo": "zh-tan/Game-Music-Generation", "path": "/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zh-tan/Game-Music-Generation path: /models.py import torch.nn as nn from layers import maskAConv, MaskBConvBlock class PixelCNN(nn.Module): def __init__(self, n_channel=3, h=128, discrete_channel=256): """PixelCNN Model""" super(PixelCNN, self).__init__() self.discr...
code_fim
hard
{ "lang": "python", "repo": "zh-tan/Game-Music-Generation", "path": "/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ Args: x: [batch_size, channel, height, width] Return: out [batch_size, channel, height, width, 256] """ batch_size, c_in, height, width = x.size() # [batch_size, 2h, 32, 32] x = self.MaskAConv(x) # [batch_size, 2...
code_fim
hard
{ "lang": "python", "repo": "zh-tan/Game-Music-Generation", "path": "/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cgao/tax_reform path: /tax_reform.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Nov 5 11:56:41 2017 @author: cgao """ from beautifultable import BeautifulTable #1. 新旧税率Bracket def tax_calculator(taxable_income, bracket, rate): bracket2 = bracket[1:] bracket2.a...
code_fim
hard
{ "lang": "python", "repo": "cgao/tax_reform", "path": "/tax_reform.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def ChildCare_Credit_new(taxable_income, child, joint = True): if joint: phaseout = round(max(taxable_income - 230000, 0)/20 + 1e-7) return int(max(0,1600*child - phaseout)) else: phaseout = round(max(taxable_income - 115000, 0)/20 + 1e-7) return int(max(0,1600*chi...
code_fim
hard
{ "lang": "python", "repo": "cgao/tax_reform", "path": "/tax_reform.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: andrewsu31098/ICS-SEARCH-ENGINE-PROJECT path: /searchEngineMain.py from search import SearchEngine import tkinter as tk if __name__ == "__main__": ghettoGoogle = SearchEngine() def searchButtonEvent(): <|fim_suffix|> tk.Button(canvas,text="Quit",command=canvas.quit).grid(row=1,colu...
code_fim
hard
{ "lang": "python", "repo": "andrewsu31098/ICS-SEARCH-ENGINE-PROJECT", "path": "/searchEngineMain.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> searchTextBox.tag_config('Link',foreground='blue') for i in range(len(search_results)): searchTextBox.insert(tk.END,search_results[i][0]+"\n",'Link') searchTextBox.insert(tk.END,search_results[i][1]+"\n\n") canvas = tk.Tk() tk.Label(canvas, ...
code_fim
hard
{ "lang": "python", "repo": "andrewsu31098/ICS-SEARCH-ENGINE-PROJECT", "path": "/searchEngineMain.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> scrollBar.config(command=searchTextBox.yview) searchTextBox.config(yscrollcommand=scrollBar.set) searchTextBox.tag_config('Link',foreground='blue') for i in range(len(search_results)): searchTextBox.insert(tk.END,search_results[i][0]+"\n",'L...
code_fim
hard
{ "lang": "python", "repo": "andrewsu31098/ICS-SEARCH-ENGINE-PROJECT", "path": "/searchEngineMain.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: seagull7/DigitalCrafts path: /Python classwork/t_exercises.py from turtle import * from shapes import * #1- #1.triangle def eTriangle(): forward(100) right(120) forward(100) right(120) forward(100) right(120) mainloop() #2.square def square(): forward(100) ...
code_fim
hard
{ "lang": "python", "repo": "seagull7/DigitalCrafts", "path": "/Python classwork/t_exercises.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>right (90) pendown() house() left(180) forward(200) left(90) penup() forward(100) right(90) pendown door() penup() forward(40) left(90) forward(50) pendown() sidewalk() right(5) penup() forward(200) right(90) forward(200) right(90) left(40) pendown() roof() penup() left(90) forward(75) left(90) fo...
code_fim
hard
{ "lang": "python", "repo": "seagull7/DigitalCrafts", "path": "/Python classwork/t_exercises.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>bgcolor("skyblue") right(90) penup() forward(100) right(90) forward(200) grass() right (90) pendown() house() left(180) forward(200) left(90) penup() forward(100) right(90) pendown door() penup() forward(40) left(90) forward(50) pendown() sidewalk() right(5) penup() forward(200) right(90) forward(...
code_fim
hard
{ "lang": "python", "repo": "seagull7/DigitalCrafts", "path": "/Python classwork/t_exercises.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def save_images(images, file_pattern, start_idx=1): for i, image in enumerate(images): file_path = file_pattern % (start_idx+i) make_dir(file_path) image_funcs.save_image(image, file_path) def main(): optical_flows = compute_optical_flow_tvl1("") frame_file_pattern =...
code_fim
hard
{ "lang": "python", "repo": "mrkzwng/TSCN", "path": "/i3d/preprocess_acnet/extract_flows.py", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> for i, image in enumerate(images): file_path = file_pattern % (start_idx+i) make_dir(file_path) image_funcs.save_image(image, file_path) def main(): optical_flows = compute_optical_flow_tvl1("") frame_file_pattern = "%05d.jpg" folder = "" file_pattern = os.pat...
code_fim
hard
{ "lang": "python", "repo": "mrkzwng/TSCN", "path": "/i3d/preprocess_acnet/extract_flows.py", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|># repo: mrkzwng/TSCN path: /i3d/preprocess_acnet/extract_flows.py from __future__ import absolute_import from __future__ import division from __future__ import print_function from cv2 import DualTVL1OpticalFlow_create as DualTVL1 from tensorflow.python.platform import flags import os import sys sys.pat...
code_fim
hard
{ "lang": "python", "repo": "mrkzwng/TSCN", "path": "/i3d/preprocess_acnet/extract_flows.py", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|>000011.DFT", "NAME/N0000012.DFT", "NAME/N0000013.DFT", "NAME/N0000020.DFT", "NAME/N0000021.DFT", "NAME/N0000022.DFT", "NAME/N0000029.DFT", "NAME/N0000030.DFT", "NAME/N0000031.DFT...
code_fim
hard
{ "lang": "python", "repo": "MartinThoma/lumixmaptool", "path": "/tests/utils_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Exawind/nalu-wind path: /reg_tests/check_norms.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Check mean system norm errors in regression tests This script determines the pass/fail status of a regression test by comparing the "Mean System Norm" values output at each timestep against "gol...
code_fim
hard
{ "lang": "python", "repo": "Exawind/nalu-wind", "path": "/reg_tests/check_norms.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> return (test_pass, abs_diff, rel_diff) def main(): """Driver function""" args = parse_arguments() test_norms = generate_test_norms(args.test_name) gold_norms = load_norm_file(args.gold_norms) run_time = get_run_time(args.test_name) run_time = float(run_time) if run_time else 0...
code_fim
hard
{ "lang": "python", "repo": "Exawind/nalu-wind", "path": "/reg_tests/check_norms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def generate_test_norms(testname): """Parse the log file and generate test norms""" logname = testname + ".log" norm_name = testname + ".norm" cmdline = """awk '/Mean System Norm:/ { print $4, $5, $6; }' %s > %s """%( logname, norm_name) os.system(cmdline) args = parse_argu...
code_fim
hard
{ "lang": "python", "repo": "Exawind/nalu-wind", "path": "/reg_tests/check_norms.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>class ProductForm(forms.Form): name = forms.CharField(max_length=100, label='Наименование') description = forms.CharField(max_length=2000, required=True, label='Описание', widget=forms.Textarea) category = forms.ChoiceField(required=False, widget=forms.Select, choices=PRODUCT_CATEGORY_CHOICES,...
code_fim
hard
{ "lang": "python", "repo": "aydarbekov/Product", "path": "/product/webapp/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: aydarbekov/Product path: /product/webapp/forms.py from django import forms from django.forms import widgets # from product.models import PRODUCT_OTHER_CHOICE, PRODUCT_CATEGORY_CHOICES <|fim_suffix|> name = forms.CharField(max_length=100, label='Наименование') description = forms.CharField...
code_fim
hard
{ "lang": "python", "repo": "aydarbekov/Product", "path": "/product/webapp/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class FindForm(forms.Form): name = forms.CharField(max_length=100, label='Наименование')<|fim_prefix|># repo: aydarbekov/Product path: /product/webapp/forms.py from django import forms from django.forms import widgets # from product.models import PRODUCT_OTHER_CHOICE, PRODUCT_CATEGORY_CHOICES PRODUC...
code_fim
hard
{ "lang": "python", "repo": "aydarbekov/Product", "path": "/product/webapp/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>""" print('Question 8') print('Observe that as long as q > N, the equality holds as the combinatorial term goes to 0') print('Hence, once N = q, then the equality fails. This occurs for mH(N+1)') print('The largest N where the equality holds is therefore q') """ Question 9 First, we evaluate which sta...
code_fim
hard
{ "lang": "python", "repo": "Swisk/learning_from_data", "path": "/HW4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Swisk/learning_from_data path: /HW4.py # -*- coding: utf-8 -*- """ Created on Fri Oct 5 17:05:12 2018 @author: Shane """ import math import scipy.integrate as integrate import random import numpy as np import sympy as sym ''' Question 1 plug and play into formula for VC generalization ''' ...
code_fim
hard
{ "lang": "python", "repo": "Swisk/learning_from_data", "path": "/HW4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print('Question 8') print('Observe that as long as q > N, the equality holds as the combinatorial term goes to 0') print('Hence, once N = q, then the equality fails. This occurs for mH(N+1)') print('The largest N where the equality holds is therefore q') """ Question 9 First, we evaluate which statemen...
code_fim
hard
{ "lang": "python", "repo": "Swisk/learning_from_data", "path": "/HW4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def back_propagation(self, digit, inputs, target): hidden_output, output = self.ffnn(digit, inputs) new_output = [] new_hidden = [] error = sum((output - target) * (output - target) for output, target in zip(output, target)) * 0.5 delta_output = [output...
code_fim
hard
{ "lang": "python", "repo": "jlozano254/digits", "path": "/NeuralNetwork.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jlozano254/digits path: /NeuralNetwork.py import math import random import time import numpy as np class NeuralNetwork: digits = [ [ 1,1,1,1,1, 1,0,0,0,1, 1,0,0,0,1, 1,0,0,0,1, 1,1,1,1,1 ], [ 0,0...
code_fim
hard
{ "lang": "python", "repo": "jlozano254/digits", "path": "/NeuralNetwork.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: HavenKey/TSception path: /code/train_model.py from utils import * import copy import torch.nn as nn CUDA = torch.cuda.is_available() def train_one_epoch(data_loader, net, loss_fn, optimizer): net.train() tl = Averager() pred_train = [] act_train = [] for i, (x...
code_fim
hard
{ "lang": "python", "repo": "HavenKey/TSception", "path": "/code/train_model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test(args, data, label, reproduce, subject, fold): seed_all(args.random_seed) set_up(args) test_loader = get_dataloader(data, label, args.batch_size, False) model = get_model(args) if CUDA: model = model.cuda() loss_fn = nn.CrossEntropyLoss() if repr...
code_fim
hard
{ "lang": "python", "repo": "HavenKey/TSception", "path": "/code/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> loss_train, pred_train, act_train = train_one_epoch( data_loader=train_loader, net=model, loss_fn=loss_fn, optimizer=optimizer) acc_train, f1_train, _ = get_metrics(y_pred=pred_train, y_true=act_train) print('epoch {}, loss={:.4f} acc={:.4f} f1={:.4f}' ...
code_fim
hard
{ "lang": "python", "repo": "HavenKey/TSception", "path": "/code/train_model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_marc_fields(self, len_title): self._get_marc() if self.marc: with io.BytesIO(self.marc.encode('utf-8')) as fh: reader = MARCReader(fh) for record in reader: self.record = record self.title = sel...
code_fim
hard
{ "lang": "python", "repo": "uoslibraries/findbooks", "path": "/findbooks/item.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def _get_year(self): date = self.record.pubyear() if date: # dates should only have numbers nums = '1234567890' new_date = '' for ch in date: if ch in nums: new_date += ch # dates should hav...
code_fim
hard
{ "lang": "python", "repo": "uoslibraries/findbooks", "path": "/findbooks/item.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: uoslibraries/findbooks path: /findbooks/item.py # -*- coding: utf-8 -*- import io import urllib.request from pymarc import MARCReader class Item: """ Represents an item from our Library catalogue (https://www-lib.soton.ac.uk) Usage: #>>> import findbooks #>>> it...
code_fim
hard
{ "lang": "python", "repo": "uoslibraries/findbooks", "path": "/findbooks/item.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pass # At the moment I just wanna test my workspace so it's working tomorrow it's time for the problems # @lc code=end<|fim_prefix|># repo: cRYP70n-13/Algorithms path: /Leetcoding/14.longest-common-prefix.py # # @lc app=leetcode id=14 lang=python3 # # [14] Longest Common Prefix # # ...
code_fim
easy
{ "lang": "python", "repo": "cRYP70n-13/Algorithms", "path": "/Leetcoding/14.longest-common-prefix.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cRYP70n-13/Algorithms path: /Leetcoding/14.longest-common-prefix.py # # @lc app=leetcode id=14 lang=python3 # # [14] Longest Common Prefix # # @lc code=start class Solution: <|fim_suffix|> pass # At the moment I just wanna test my workspace so it's working tomorrow it's time for the p...
code_fim
easy
{ "lang": "python", "repo": "cRYP70n-13/Algorithms", "path": "/Leetcoding/14.longest-common-prefix.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def longestCommonPrefix(self, strs: List[str]) -> str: pass # At the moment I just wanna test my workspace so it's working tomorrow it's time for the problems # @lc code=end<|fim_prefix|># repo: cRYP70n-13/Algorithms path: /Leetcoding/14.longest-common-prefix.py # # @lc app=leetc...
code_fim
easy
{ "lang": "python", "repo": "cRYP70n-13/Algorithms", "path": "/Leetcoding/14.longest-common-prefix.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gem/oq-mbt path: /mbt/sources.py import inspect import re import openquake.hazardlib.source as oqsrc # List of valid attributes for an area source AREAS_ATTRIBUTES = set(['source_id', 'name', 'tectonic_region_type', 'mfd', 'rupture_mesh_spacing', ...
code_fim
hard
{ "lang": "python", "repo": "gem/oq-mbt", "path": "/mbt/sources.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> :parameter str source_id: The ID of the source :parameter str source_type: Source type i.e. Object name amongst the ones admitted in the OpenQuake Hazardlib. """ def __init__(self, *args, **kwargs): # Checks if len(args): self.source_id ...
code_fim
hard
{ "lang": "python", "repo": "gem/oq-mbt", "path": "/mbt/sources.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chriseal/udacity_data_engineering_nanodegree path: /2data_modeling/L2_relational_data_models/lesson-2-demo-3-creating-fact-and-dimension-tables-with-star-schema.py #!/usr/bin/env python # coding: utf-8 # # Lesson 2 Demo 3: Creating Fact and Dimension Tables with Star Schema # # <img src="images...
code_fim
hard
{ "lang": "python", "repo": "chriseal/udacity_data_engineering_nanodegree", "path": "/2data_modeling/L2_relational_data_models/lesson-2-demo-3-creating-fact-and-dimension-tables-with-star-schema.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> try: cur.execute("CREATE TABLE IF NOT EXISTS items_purchased (customer_id int, item_number int, item_name varchar);") except psycopg2.Error as e: print("Error: Issue creating table") print (e) try: cur.execute("INSERT INTO items_purchased (customer_id, item_number, item_name) ...
code_fim
hard
{ "lang": "python", "repo": "chriseal/udacity_data_engineering_nanodegree", "path": "/2data_modeling/L2_relational_data_models/lesson-2-demo-3-creating-fact-and-dimension-tables-with-star-schema.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Carried value is ignored. """ nand_a_b = nand(a, b) nand_c = nand(nand_a_b, a) nand_d = nand(nand_a_b, b) low_a_b = nand(nand_c, nand_d) nand_low_a_b_c = nand(low_a_b, c) nand_e = nand(low_a_b, nand_low_a_b_c) nand_f = nand(nand_low_a_b_c, c) high = nand(na...
code_fim
medium
{ "lang": "python", "repo": "M-110/PyPC", "path": "/pypc/c_basic_arithmetic/arithmetic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: M-110/PyPC path: /pypc/c_basic_arithmetic/arithmetic.py from pypc.a_primitives.nand import nand # nand gates used: 5 def half_adder(a: bool, b: bool) -> (bool, bool): <|fim_suffix|> Carried value is ignored. """ nand_a_b = nand(a, b) nand_c = nand(nand_a_b, a) nand_d...
code_fim
hard
{ "lang": "python", "repo": "M-110/PyPC", "path": "/pypc/c_basic_arithmetic/arithmetic.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># nand gates used: 9 def full_adder(a: bool, b: bool, c: bool) -> (bool, bool): """Returns a + b + c in the form of a tuple of two bools representing the two bits. Carried value is ignored. """ nand_a_b = nand(a, b) nand_c = nand(nand_a_b, a) nand_d = nand(nand_a_...
code_fim
hard
{ "lang": "python", "repo": "M-110/PyPC", "path": "/pypc/c_basic_arithmetic/arithmetic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ''' Sign up form fetching form the User creation form and the email and password is necessary not the user ''' class Meta: model = User fields = ('email','password1','password2')<|fim_prefix|># repo: tanviredu/DJANGO_ECOMMERCE path: /My_Ecom_Project/App_LOgin/forms.py fro...
code_fim
medium
{ "lang": "python", "repo": "tanviredu/DJANGO_ECOMMERCE", "path": "/My_Ecom_Project/App_LOgin/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tanviredu/DJANGO_ECOMMERCE path: /My_Ecom_Project/App_LOgin/forms.py from django import forms from .models import User,Profile from django.contrib.auth.forms import UserCreationForm class ProfileForm(forms.ModelForm): ''' Form for the profile ''' class Meta: model = Profile ...
code_fim
medium
{ "lang": "python", "repo": "tanviredu/DJANGO_ECOMMERCE", "path": "/My_Ecom_Project/App_LOgin/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class SignUpForm(UserCreationForm): ''' Sign up form fetching form the User creation form and the email and password is necessary not the user ''' class Meta: model = User fields = ('email','password1','password2')<|fim_prefix|># repo: tanviredu/DJANGO_ECOMMERCE path: /M...
code_fim
medium
{ "lang": "python", "repo": "tanviredu/DJANGO_ECOMMERCE", "path": "/My_Ecom_Project/App_LOgin/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vipulgpt10/eid-fall2018 path: /test/test2.py # -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'test1.ui' # # Created by: PyQt5 UI code generator 5.7 # # WARNING! All changes made in this file will be lost! <|fim_suffix|> def setupUi(self, Dialog): Dialog.s...
code_fim
medium
{ "lang": "python", "repo": "vipulgpt10/eid-fall2018", "path": "/test/test2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Ui_Dialog(object): def setupUi(self, Dialog): Dialog.setObjectName("Dialog") Dialog.resize(670, 483) self.pushButton = QtWidgets.QPushButton(Dialog) self.pushButton.setGeometry(QtCore.QRect(190, 240, 101, 31)) self.pushButton.setObjectName("pushButton") ...
code_fim
medium
{ "lang": "python", "repo": "vipulgpt10/eid-fall2018", "path": "/test/test2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s/jwm/target', ignore_errors = True) shutil.rmtree('examples/swt/target', ignore_errors = True) return 0 if __name__ == '__main__': sys.exit(main())<|fim_prefix|># repo: JetBrains/skija path: /script/clean.py #! /usr/bin/env python3 import common, os, shutil, sys def main(): os.chdir(common.ro...
code_fim
hard
{ "lang": "python", "repo": "JetBrains/skija", "path": "/script/clean.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: JetBrains/skija path: /script/clean.py #! /usr/bin/env python3 import common, os, shutil, sys def main(): os.chdir(common.root) shutil.rmtree('shared/target', ignore_errors = True) shutil.rmtree('platform/build', ignore_errors = True) shutil.rmtree('platform/target', ignore_errors = True...
code_fim
medium
{ "lang": "python", "repo": "JetBrains/skija", "path": "/script/clean.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='baby', name='Auth_Id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Asha.BasicDetails'), ), ]<|fim_prefix|># repo: annumalu/ashaworker path: /first review/New fo...
code_fim
medium
{ "lang": "python", "repo": "annumalu/ashaworker", "path": "/first review/New folder/Asha_Worker/Asha/migrations/0006_auto_20210325_1917.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: annumalu/ashaworker path: /first review/New folder/Asha_Worker/Asha/migrations/0006_auto_20210325_1917.py # Generated by Django 3.0.8 on 2021-03-25 13:47 from django.db import migrations, models import django.db.models.deletion <|fim_suffix|> operations = [ migrations.AlterFiel...
code_fim
medium
{ "lang": "python", "repo": "annumalu/ashaworker", "path": "/first review/New folder/Asha_Worker/Asha/migrations/0006_auto_20210325_1917.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('Asha', '0005_baby'), ] operations = [ migrations.AlterField( model_name='baby', name='Auth_Id', field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='Asha.BasicDetails'), ), ]<|fim_...
code_fim
easy
{ "lang": "python", "repo": "annumalu/ashaworker", "path": "/first review/New folder/Asha_Worker/Asha/migrations/0006_auto_20210325_1917.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fusion-energy/neutronics-workshop path: /tasks/task_09_CSG_dose_tallies/4_cell_dose_from_photon.py # This simulation obtains dose on a cylindical disk phantom at various # distances from a 14MeV photon source. Dose in millisieverts is found # and compared to the yearly limit # The model is built...
code_fim
hard
{ "lang": "python", "repo": "fusion-energy/neutronics-workshop", "path": "/tasks/task_09_CSG_dose_tallies/4_cell_dose_from_photon.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Instantiate a Settings object my_settings = openmc.Settings() my_settings.output = {"tallies": False} my_settings.batches = 2 my_settings.inactive = 0 my_settings.particles = 500000 my_settings.photon_transport = True my_settings.run_mode = "fixed source" # Create a ...
code_fim
hard
{ "lang": "python", "repo": "fusion-energy/neutronics-workshop", "path": "/tasks/task_09_CSG_dose_tallies/4_cell_dose_from_photon.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sheikabdullah5/guvi path: /vowelrconsonant.py sheik=['a','e','i','o','u','A','E','I','O','U'] s=raw_input() if(s in sheik)<|fim_suffix|>nt('Consonant') else: print('invalid')<|fim_middle|>: print('Vowel') elif(s!=sheik): pri
code_fim
easy
{ "lang": "python", "repo": "sheikabdullah5/guvi", "path": "/vowelrconsonant.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: sheikabdullah5/guvi path: /vowelrconsonant.py sheik=['a','e','i','o','u','A','E','I'<|fim_suffix|>: print('Vowel') elif(s!=sheik): print('Consonant') else: print('invalid')<|fim_middle|>,'O','U'] s=raw_input() if(s in sheik)
code_fim
easy
{ "lang": "python", "repo": "sheikabdullah5/guvi", "path": "/vowelrconsonant.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nt('Consonant') else: print('invalid')<|fim_prefix|># repo: sheikabdullah5/guvi path: /vowelrconsonant.py sheik=['a','e','i','o','u','A','E','I'<|fim_middle|>,'O','U'] s=raw_input() if(s in sheik): print('Vowel') elif(s!=sheik): pri
code_fim
medium
{ "lang": "python", "repo": "sheikabdullah5/guvi", "path": "/vowelrconsonant.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ianmatheson/craigslist-poll path: /main.py """ Created on Fri Aug 4 19:19:31 2017 @author: aw1042 """ import requests import threading import sys import re import xml.etree.ElementTree as ET import smtplib from credentials import * argsObj = {} for arg1, arg2 in zip(sys.argv[:-1], sys.argv[1...
code_fim
hard
{ "lang": "python", "repo": "ianmatheson/craigslist-poll", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> msg = '' for post in newPostsArray: msg += post.title + '\n' if (post.description): msg += post.description + '\n' msg += post.link + '\n \n \n' toPass = password server = smtplib.SMTP_SSL() server.connect("smtp.gmail.com", 465) server.ehlo() ...
code_fim
hard
{ "lang": "python", "repo": "ianmatheson/craigslist-poll", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattasmith/dailyfaces path: /imagecompress.py ''' Compress images ''' from PIL import Image def resizeImage(image_file): try: # get the image's width and height in pixels img = Image.open(image_file) width, height = img.size <|fim_suffix|> if max_dim > 1000: # resize the image usin...
code_fim
medium
{ "lang": "python", "repo": "mattasmith/dailyfaces", "path": "/imagecompress.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # save the resized image to a file # overwrite existing file resized_image_file = image_file resized_image.save(resized_image_file) # print("%s resized" % resized_image_file) except: print 'Cannot open ' + image_file # pick an image file you have in the working directory # (or give...
code_fim
hard
{ "lang": "python", "repo": "mattasmith/dailyfaces", "path": "/imagecompress.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class PublishingHouse(models.Model): house = models.CharField( "Publishing House", max_length=40, blank=False, null=False ) history = models.TextField( "Other books of this house", max_length=500, blank=True, null=True ) ...
code_fim
hard
{ "lang": "python", "repo": "MargitStar/shop", "path": "/references/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.genre class PublishingHouse(models.Model): house = models.CharField( "Publishing House", max_length=40, blank=False, null=False ) history = models.TextField( "Other books of this house", max_length=5...
code_fim
hard
{ "lang": "python", "repo": "MargitStar/shop", "path": "/references/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MargitStar/shop path: /references/models.py from django.db import models class Author(models.Model): author = models.CharField( "Author", max_length=30, blank=False, null=False ) biography = models.TextField( "About author", max_lengt...
code_fim
hard
{ "lang": "python", "repo": "MargitStar/shop", "path": "/references/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xhdhr10000/captcha-break path: /hjyd/test_actual.py # coding=utf-8 from __future__ import print_function import os import sys os.environ['TF_CPP_MIN_LOG_LEVEL'] = '3' basedir = os.getcwd() os.chdir(os.path.dirname(os.path.abspath(__file__))) sys.path.append('trainer') sys.path.append('downloade...
code_fim
hard
{ "lang": "python", "repo": "xhdhr10000/captcha-break", "path": "/hjyd/test_actual.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> label = prediction.eval(feed_dict={x: dataset, keep_prob: 1.0}, session=session)[0] string = '' for i in range(4): string += chr(label[i] + ord('0')) print(string) if __name__ == "__main__": if len(sys.argv) <= 1: captcha = download(1)[0] else:...
code_fim
hard
{ "lang": "python", "repo": "xhdhr10000/captcha-break", "path": "/hjyd/test_actual.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # dataset, labels = gen_dataset(1, templates) # generate one image dataset = [] dataset.append(np.asarray(im.convert("L")).reshape([30 * 96]) / 255) label = prediction.eval(feed_dict={x: dataset, keep_prob: 1.0}, session=session)[0] string = '' for i in ra...
code_fim
medium
{ "lang": "python", "repo": "xhdhr10000/captcha-break", "path": "/hjyd/test_actual.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wachira90/python-configparser path: /app-configparser.py #!python3 import configparser parser = configparser.ConfigParser() <|fim_suffix|>print(parser.get("config", "option1")) print(parser.get("config", "option2")) print(parser.get("config", "option3"))<|fim_middle|>parser.read("sim.conf")
code_fim
easy
{ "lang": "python", "repo": "wachira90/python-configparser", "path": "/app-configparser.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>print(parser.get("config", "option1")) print(parser.get("config", "option2")) print(parser.get("config", "option3"))<|fim_prefix|># repo: wachira90/python-configparser path: /app-configparser.py #!python3 import configparser parser = configparser.ConfigParser() <|fim_middle|>parser.read("sim.conf")
code_fim
easy
{ "lang": "python", "repo": "wachira90/python-configparser", "path": "/app-configparser.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from StringIO import StringIO from bs4 import BeautifulSoup import requests import os try: os.mkdir('walls') except OSError: pass page = 1 while True: page_request = requests.get('http://simpledesktops.com/browse/%s/' % page) if page_request.status_code != 200: print 'page %s does not exist' % pag...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/2517912/snippet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>page = 1 while True: page_request = requests.get('http://simpledesktops.com/browse/%s/' % page) if page_request.status_code != 200: print 'page %s does not exist' % page break html = BeautifulSoup(page_request.text) images = html.findAll('img') for image in images: img_src = image['src'] if '...
code_fim
medium
{ "lang": "python", "repo": "gistable/gistable", "path": "/dockerized-gists/2517912/snippet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> writer_train = tf.python_io.TFRecordWriter('./data/train.record') writer_test = tf.python_io.TFRecordWriter('./data/test.record') filename_list=tf.train.match_filenames_once("./data/annotations/*.xml") init = (tf.global_variables_initializer(), tf.local_variables_initializer()) se...
code_fim
hard
{ "lang": "python", "repo": "nheidloff/object-detection-anki-overdrive-cars", "path": "/volume/create_tfrecord.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>-fA-F][0-9a-fA-F]))+',sys.stdin.read())))<|fim_prefix|># repo: k4ndAr3c/pyth0nS path: /urlsExtract.py #!/usr/bin/env python import sys,re print<|fim_middle|>('\n'.join(re.findall(r'http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a
code_fim
medium
{ "lang": "python", "repo": "k4ndAr3c/pyth0nS", "path": "/urlsExtract.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: k4ndAr3c/pyth0nS path: /urlsExtract.py #!/usr/bin/env python import sys,re print<|fim_suffix|>zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',sys.stdin.read())))<|fim_middle|>('\n'.join(re.findall(r'http[s]?://(?:[a-
code_fim
easy
{ "lang": "python", "repo": "k4ndAr3c/pyth0nS", "path": "/urlsExtract.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+',sys.stdin.read())))<|fim_prefix|># repo: k4ndAr3c/pyth0nS path: /urlsExtract.py #!/usr/bin/env python import sys,re print<|fim_middle|>('\n'.join(re.findall(r'http[s]?://(?:[a-
code_fim
easy
{ "lang": "python", "repo": "k4ndAr3c/pyth0nS", "path": "/urlsExtract.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wenchao5211/Smart-Cutting-using-AWS path: /code/sc-04-video-clip.py import json import boto3 import os import datetime regionName = os.environ['AWS_REGION'] BUCKET_PATH = os.environ['BUCKET_PATH'] SENSITIVIT = os.environ['SENSITIVIT'] s3_client = boto3.client('s3', region_name=regionName) ddb_...
code_fim
hard
{ "lang": "python", "repo": "wenchao5211/Smart-Cutting-using-AWS", "path": "/code/sc-04-video-clip.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> response = mediaconvert_client.describe_endpoints(Mode='DEFAULT') mediaURL = response['Endpoints'][0]['Url'] mediaconvert_client = boto3.client('mediaconvert',endpoint_url=mediaURL) with open("/tmp/job-all.json", "r") as jsonfile: job_object = json.load(jsonfile) ...
code_fim
hard
{ "lang": "python", "repo": "wenchao5211/Smart-Cutting-using-AWS", "path": "/code/sc-04-video-clip.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ZachChristensen28/TA-opnsense path: /src/TA-opnsense/bin/ta_opnsense/aob_py3/splunktalib/concurrent/concurrent_executor.py # # Copyright 2021 Splunk Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You ma...
code_fim
hard
{ "lang": "python", "repo": "ZachChristensen28/TA-opnsense", "path": "/src/TA-opnsense/bin/ta_opnsense/aob_py3/splunktalib/concurrent/concurrent_executor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def run_compute_func_async(self, func, args=(), kwargs={}, callback=None): """ :param func: callable :param args: free params :param kwargs: named params :calllback: when func is done and without exception, call the callback :return whatever the func ret...
code_fim
hard
{ "lang": "python", "repo": "ZachChristensen28/TA-opnsense", "path": "/src/TA-opnsense/bin/ta_opnsense/aob_py3/splunktalib/concurrent/concurrent_executor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awsanand2018/MyCodeFiles path: /parse-csv-file.py import csv import os with open("sample.csv") as rf: csv_reader=csv.DictReader(rf) with open("sample1.csv","w") as wf: csv_headers=['fname','lname','email'] if os.path.isfile('sample1.csv'): q=input("File ...
code_fim
medium
{ "lang": "python", "repo": "awsanand2018/MyCodeFiles", "path": "/parse-csv-file.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }