text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>""" from datetime import datetime from datetime import timedelta class Dog: def __init__(self, name='Имя', birth_date = [1970, 1, 1], voice='Голос'): self.name = name self.voice = voice self.birth_date = birth_date def __add__(self, other): birth_date = self....
code_fim
hard
{ "lang": "python", "repo": "apalevich/PyMentor", "path": "/06_dogs.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: schlogl2017/Deepshape path: /bin/mutate_and_map_1.py #! /usr/bin/env python # coding: utf-8 import warnings warnings.filterwarnings('ignore') import numpy as np import argparse, sys, os, errno from glob import glob import pandas as pd import matplotlib.pyplot as plt import seaborn as sns import h...
code_fim
hard
{ "lang": "python", "repo": "schlogl2017/Deepshape", "path": "/bin/mutate_and_map_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def generate_boxplot(mutationmap): new_map = np.ndarray([384,256]) for i in range(128): new_map[3*i] = np.concatenate((np.concatenate((np.zeros(128-i),mutationmap[3*i])),np.zeros(i))) new_map[3*i+1] = np.concatenate((np.concatenate((np.zeros(128-i),mutationmap[3*i+1])),np.zeros(i))...
code_fim
hard
{ "lang": "python", "repo": "schlogl2017/Deepshape", "path": "/bin/mutate_and_map_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Samarpitr/education path: /education/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy.org/en/latest/topics/items.html import scrapy from scrapy.loader.processors import Join, MapCompose, TakeFirst from w3lib.html impo...
code_fim
hard
{ "lang": "python", "repo": "Samarpitr/education", "path": "/education/items.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # define the fields for your item here like: # name = scrapy.Field() title = scrapy.Field( input_processor=MapCompose(remove_tags), output_processor=TakeFirst() ) details = scrapy.Field( input_processor=MapCompose(remove_tags), output_processor=Join() ) p...
code_fim
medium
{ "lang": "python", "repo": "Samarpitr/education", "path": "/education/items.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> details = scrapy.Field( input_processor=MapCompose(remove_tags), output_processor=Join() ) pass<|fim_prefix|># repo: Samarpitr/education path: /education/items.py # -*- coding: utf-8 -*- # Define here the models for your scraped items # # See documentation in: # http://doc.scrapy....
code_fim
medium
{ "lang": "python", "repo": "Samarpitr/education", "path": "/education/items.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: papulovskiy/nugsl-worldmap path: /scripts/nugsl-worldmap #!/usr/bin/env python from nugsl.worldmap import worldMap from optparse import OptionParser import sys, os.path, re from nugsl.worldmap import pinConfig, countryConfig from nugsl.worldmap import imageMap from nugsl.worldmap import html_me...
code_fim
hard
{ "lang": "python", "repo": "papulovskiy/nugsl-worldmap", "path": "/scripts/nugsl-worldmap", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> if not options.ofile: parser.print_help() print "\nERROR: The -o option is mandatory.\n" sys.exit() render_width = float( options.render_width ) render_height = float( options.render_height ) if options.rendered_pinwidth: if not render_widt...
code_fim
hard
{ "lang": "python", "repo": "papulovskiy/nugsl-worldmap", "path": "/scripts/nugsl-worldmap", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|>[North Pole] latitude: 90n longitude: 0 [Greenwich] latitude: 51n28 longitude: 0 ''' parser = OptionParser(usage=usage) parser.set_defaults(mode="rotated") parser.add_option("-c", "--country", dest="country", metavar="COUNTRY", default=None, ...
code_fim
hard
{ "lang": "python", "repo": "papulovskiy/nugsl-worldmap", "path": "/scripts/nugsl-worldmap", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_prefix|># repo: goern/word-fountain path: /app.py import argparse import gzip import os import random import time from kafka import KafkaProducer from prometheus_client import start_http_server, Counter <|fim_suffix|>start_http_server(8080) producer = KafkaProducer(bootstrap_servers=servers) with gzip.open...
code_fim
hard
{ "lang": "python", "repo": "goern/word-fountain", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>producer = KafkaProducer(bootstrap_servers=servers) with gzip.open('words.gz', 'r') as f: words = f.readlines() # subset words to produce more duplicates words = [random.choice(words).strip() for i in range(max(42, rate ** 2))] while count: producer.send(topic, random.choice(words)) ...
code_fim
medium
{ "lang": "python", "repo": "goern/word-fountain", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>while count: producer.send(topic, random.choice(words)) words_send.inc() count -= 1 # if not count % (rate * 5): # print(producer.metrics()) time.sleep(1.0 / rate)<|fim_prefix|># repo: goern/word-fountain path: /app.py import argparse import gzip import os import random import ...
code_fim
hard
{ "lang": "python", "repo": "goern/word-fountain", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DGmoN/Genger path: /test/imageTest.py from display.Placement import Image from display.Effect import PlainColor import pygame <|fim_suffix|>panel = Image((250,250)) background = Image((100,100)) foreground = Image((50, 50)) background.addPainter("baseColor",PlainColor((100,100,100))) foreground....
code_fim
medium
{ "lang": "python", "repo": "DGmoN/Genger", "path": "/test/imageTest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>panel = Image((250,250)) background = Image((100,100)) foreground = Image((50, 50)) background.addPainter("baseColor",PlainColor((100,100,100))) foreground.addPainter("foregroundColor",PlainColor((250,100,100))) panel.linkImage(background) panel.linkImage(foreground) display = Display((300,300)) display.l...
code_fim
medium
{ "lang": "python", "repo": "DGmoN/Genger", "path": "/test/imageTest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def evaluate_hits(pos_val_pred, neg_val_pred, pos_test_pred, neg_test_pred): results = {} for K in [20, 50, 100]: evaluator.K = K valid_hits = evaluator.eval({ 'y_pred_pos': pos_val_pred, 'y_pred_neg': neg_val_pred, })[f'hits@{K}'] test_hits ...
code_fim
hard
{ "lang": "python", "repo": "lbn187/IGNN", "path": "/link_pred.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lbn187/IGNN path: /link_pred.py import torch import argparse import os import math import numpy as np import torch.nn as nn import torch.nn.functional as F from torch.utils.data import TensorDataset, DataLoader import torch_geometric.transforms as T from transforms import Normalize from torch_geo...
code_fim
hard
{ "lang": "python", "repo": "lbn187/IGNN", "path": "/link_pred.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='post', name='date', field=models.DateField(default='12:44:16', verbose_name='Date'), ), ]<|fim_prefix|># repo: Bharat0011/InstaClone path: /myInsta/migrations/0010_auto_20210201_1244.py # Generat...
code_fim
medium
{ "lang": "python", "repo": "Bharat0011/InstaClone", "path": "/myInsta/migrations/0010_auto_20210201_1244.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bharat0011/InstaClone path: /myInsta/migrations/0010_auto_20210201_1244.py # Generated by Django 3.1.2 on 2021-02-01 07:14 from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AlterField( model_name='post', name='date', ...
code_fim
medium
{ "lang": "python", "repo": "Bharat0011/InstaClone", "path": "/myInsta/migrations/0010_auto_20210201_1244.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sitemap=download(url) links=re.findall('<loc>(.*?)</loc>',sitemap) for count in range(1,6): print"CRAW" for link in links: html=download(link) time.sleep(3) print"craw end"<|fim_prefix|># repo: jekoy/python path: /python/download_sitemap.py i...
code_fim
medium
{ "lang": "python", "repo": "jekoy/python", "path": "/python/download_sitemap.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jekoy/python path: /python/download_sitemap.py import urllib2 import re import time def download(url): <|fim_suffix|>def crawl_sitemap(url): sitemap=download(url) links=re.findall('<loc>(.*?)</loc>',sitemap) for count in range(1,6): print"CRAW" for link in lin...
code_fim
medium
{ "lang": "python", "repo": "jekoy/python", "path": "/python/download_sitemap.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def crawl_sitemap(url): sitemap=download(url) links=re.findall('<loc>(.*?)</loc>',sitemap) for count in range(1,6): print"CRAW" for link in links: html=download(link) time.sleep(3) print"craw end"<|fim_prefix|># repo: jekoy/python path: /pyt...
code_fim
medium
{ "lang": "python", "repo": "jekoy/python", "path": "/python/download_sitemap.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mitsuhiko/celery path: /celery/tests/test_worker_control.py import socket import unittest2 as unittest from celery import conf from celery.decorators import task from celery.registry import tasks from celery.task.builtins import PingTask from celery.utils import gen_unique_id from celery.worker ...
code_fim
hard
{ "lang": "python", "repo": "mitsuhiko/celery", "path": "/celery/tests/test_worker_control.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class Listener(object): class ReadyQueue(object): fresh = False def refresh(self): self.fresh = True def __init__(self): self.ready_queue = self.ReadyQueue() listener = Listener() panel ...
code_fim
hard
{ "lang": "python", "repo": "mitsuhiko/celery", "path": "/celery/tests/test_worker_control.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_dump_tasks(self): info = "\n".join(self.panel.execute("dump_tasks")) self.assertIn("mytask", info) self.assertIn("rate_limit=200", info) def test_dump_schedule(self): listener = Listener() panel = self.create_panel(listener=listener) self.a...
code_fim
hard
{ "lang": "python", "repo": "mitsuhiko/celery", "path": "/celery/tests/test_worker_control.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ## set the order of reactions occurring in the tanks self.order_tank = 1.0 # real ## set a global value for all bulk reaction coefficients self.global_bulk = 0.0 # real ## set a global value for all wall reaction coefficients self.global_wall ...
code_fim
hard
{ "lang": "python", "repo": "USEPA/SWMM-EPANET_User_Interface", "path": "/src/core/epanet/options/reactions.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: USEPA/SWMM-EPANET_User_Interface path: /src/core/epanet/options/reactions.py from core.project_base import Section from core.metadata import Metadata class Reactions(Section): """Defines parameters related to chemical reactions occurring in the network""" SECTION_NAME = "[REACTIONS]" ...
code_fim
hard
{ "lang": "python", "repo": "USEPA/SWMM-EPANET_User_Interface", "path": "/src/core/epanet/options/reactions.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ai-systems/transportability path: /tests/experiments/nli_experiment_test.py from regra.common.regra_unit_test import RegraTestCase from transport.experiments.trainer.nli_trainer import NLIExperiment import luigi <|fim_suffix|> def test_snli(self): task = NLIExperiment(mode=self.mode,...
code_fim
easy
{ "lang": "python", "repo": "ai-systems/transportability", "path": "/tests/experiments/nli_experiment_test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_snli(self): task = NLIExperiment(mode=self.mode, config_file=self.config_file) luigi.build([task])<|fim_prefix|># repo: ai-systems/transportability path: /tests/experiments/nli_experiment_test.py from regra.common.regra_unit_test import RegraTestCase from transport.experiment...
code_fim
easy
{ "lang": "python", "repo": "ai-systems/transportability", "path": "/tests/experiments/nli_experiment_test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: thakkarayush/Project_Petrol_Pump path: /c_payment/models.py from django.db import models from creditor.models import creditor_master from django.urls import reverse from datetime import datetime # Create your models here. class c_payment(models.Model): <|fim_suffix|> return f"{self.credito...
code_fim
hard
{ "lang": "python", "repo": "thakkarayush/Project_Petrol_Pump", "path": "/c_payment/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return f"{self.creditorid}-{self.amount}" def get_absolute_url(self): return reverse("cpayment-view")<|fim_prefix|># repo: thakkarayush/Project_Petrol_Pump path: /c_payment/models.py from django.db import models from creditor.models import creditor_master from django.urls import reve...
code_fim
hard
{ "lang": "python", "repo": "thakkarayush/Project_Petrol_Pump", "path": "/c_payment/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ccstp/IS211_Assignment1 path: /assignment1_part1.py # ASSIGNMENT 1_PART 01 #!/usr/bin/env python # -*- coding: utf-8 -*- def listDivide(numbers, divide = 2): <|fim_suffix|> Args: numbers (list): The list of numbers to be checked divide (int): The number to divide the elements in the ...
code_fim
medium
{ "lang": "python", "repo": "ccstp/IS211_Assignment1", "path": "/assignment1_part1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def testListDivide(): """ This function tests the listDivide function. """ assert listDivide([1,2,3,4,5]) == 2 assert listDivide([2,4,6,8,10]) == 5 assert listDivide([30, 54, 63,98, 100], divide = 10) == 2 assert listDivide([]) == 0 assert listDivide([1,2,3,4,5], 1) == 5 if __name__ == "...
code_fim
hard
{ "lang": "python", "repo": "ccstp/IS211_Assignment1", "path": "/assignment1_part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ This function tests the listDivide function. """ assert listDivide([1,2,3,4,5]) == 2 assert listDivide([2,4,6,8,10]) == 5 assert listDivide([30, 54, 63,98, 100], divide = 10) == 2 assert listDivide([]) == 0 assert listDivide([1,2,3,4,5], 1) == 5 if __name__ == "__main__": testListDi...
code_fim
medium
{ "lang": "python", "repo": "ccstp/IS211_Assignment1", "path": "/assignment1_part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mohakbhardwaj/auto-park path: /autopark/construct/formats/data/snoop.py """ what : snoop v2 capture file. how : http://tools.ietf.org/html/rfc1761 who : jesse @ housejunkie . ca """ import time from construct import (Adapter, Enum, Field, HexDumpAdapter, Magic, OptionalGreedyRange, Pad...
code_fim
medium
{ "lang": "python", "repo": "mohakbhardwaj/auto-park", "path": "/autopark/construct/formats/data/snoop.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>packet_record = Struct("packet_record", UBInt32("original_length"), UBInt32("included_length"), UBInt32("record_length"), UBInt32("cumulative_drops"), EpochTimeStampAdapter(UBInt32("timestamp_seconds")), UBInt32("timestamp_microseconds"), HexDumpAdap...
code_fim
hard
{ "lang": "python", "repo": "mohakbhardwaj/auto-park", "path": "/autopark/construct/formats/data/snoop.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> img1 = cv2.imread(CALIBRATION_IMG_DIR + "calibration1.jpg") img2 = cv2.imread(CALIBRATION_IMG_DIR + "calibration4.jpg") img3 = cv2.imread(CALIBRATION_IMG_DIR + "calibration5.jpg") udst1 = cv2.undistort(img1, mtx, dist, None, mtx) udst2 = cv2.undistort(img2, mtx, dis...
code_fim
hard
{ "lang": "python", "repo": "gmpatil/sdcnd", "path": "/term1/p04_advLaneFinding/Camera.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gmpatil/sdcnd path: /term1/p04_advLaneFinding/Camera.py import numpy as np import cv2 import glob import matplotlib.pyplot as plt import pickle CALIBRATION_IMG_DIR = "./camera_cal/" TEST_IMG_DIR = "./test_images/" class Camera(object): ''' Camera class to calibrate the camera, save the...
code_fim
hard
{ "lang": "python", "repo": "gmpatil/sdcnd", "path": "/term1/p04_advLaneFinding/Camera.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return ret, mtx, dist, rvecs, tvecs def undistort_calibration_images(self): mtx = self.mtx dist = self.dist img1 = cv2.imread(CALIBRATION_IMG_DIR + "calibration1.jpg") img2 = cv2.imread(CALIBRATION_IMG_DIR + "calibration4.jpg") img3 = cv2.imread(CALIB...
code_fim
hard
{ "lang": "python", "repo": "gmpatil/sdcnd", "path": "/term1/p04_advLaneFinding/Camera.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MacLure/python-basics path: /classes.py # Classes are named in capitalized camel-case # Classes are preceded and followed by 2 line breaks class Point: def __init__(self, x, y): self.x = x self.y = y def move(self): <|fim_suffix|>class Cat(Pet): def be_aloof(selfself...
code_fim
hard
{ "lang": "python", "repo": "MacLure/python-basics", "path": "/classes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># "input [filename - no extension]" -> in code: [filename, no extension].[function] # "from [filename - no extension] import [function]<|fim_prefix|># repo: MacLure/python-basics path: /classes.py # Classes are named in capitalized camel-case # Classes are preceded and followed by 2 line breaks class Po...
code_fim
hard
{ "lang": "python", "repo": "MacLure/python-basics", "path": "/classes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self.taskName return self.taskRequester return self.taskResourceRequired class comment(models.Model): commentSender=models.CharField(max_length=10) commentSubject = models.CharField(max_length=20) commentMessage = models.CharField(max_length=100) commentTeam...
code_fim
hard
{ "lang": "python", "repo": "gokulyesudoss/ProjectDash", "path": "/dashservice/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return self.taskName return self.taskRequester return self.taskResourceRequired class comment(models.Model): commentSender=models.CharField(max_length=10) commentSubject = models.CharField(max_length=20) commentMessage = models.CharField(max_leng...
code_fim
hard
{ "lang": "python", "repo": "gokulyesudoss/ProjectDash", "path": "/dashservice/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: gokulyesudoss/ProjectDash path: /dashservice/models.py from django.db import models # Create your models here. class team(models.Model): teamName = models.CharField(max_length=20) teamDescription = models.CharField(max_length=100) teamIncharge = models.CharField(max_length=20) def __st...
code_fim
hard
{ "lang": "python", "repo": "gokulyesudoss/ProjectDash", "path": "/dashservice/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> elif isinstance(adder, Medida): medida = adder medidas = [0]*self.lenght for i in xrange(self.lenght): medidas[i] = self[i] + medida values, s, units = self._calc_valores(medidas) return mArray(values, s, units) else: raise ValueError('mArray no puede ser sumado con %...
code_fim
hard
{ "lang": "python", "repo": "JorgeExp/Package-tecnicas", "path": "/PhysLab/medidas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JorgeExp/Package-tecnicas path: /PhysLab/medidas.py ce dos veces en la expresión class Medida(object): ''' La clase Medida permite crear y operar objetos con valor, unidades e incertidumbre, automatizando los cálculos. Se pueden usar sobre estos objetos los siguientes operadores: +, -, *, /...
code_fim
hard
{ "lang": "python", "repo": "JorgeExp/Package-tecnicas", "path": "/PhysLab/medidas.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class mArray(object): def _set_medidas(self): for i in xrange(self.lenght): self.medidas[i] = Medida(self.values[i], self.s[i], self.units[i]) def _calc_valores(self, medidas): #función auxiliar para las operaciones #medidas es una lista de Medidas, no un array values = [0]*len(...
code_fim
hard
{ "lang": "python", "repo": "JorgeExp/Package-tecnicas", "path": "/PhysLab/medidas.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def test_getbinarystate( fauxmo_server: pytest.fixture, simplehttpplugin_target: pytest.fixture ) -> None: """Test TCP server's "GetBinaryState" action for SimpleHTTPPlugin.""" data = b'Soapaction: "urn:Belkin:service:basicevent:1#GetBinaryState"' resp = requests.post( "http://12...
code_fim
hard
{ "lang": "python", "repo": "ccancellieri/fauxmo", "path": "/tests/test_fauxmo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ccancellieri/fauxmo path: /tests/test_fauxmo.py """test_fauxmo.py :: Tests for `fauxmo` package.""" import json import socket import xml.etree.ElementTree as ET # noqa import pytest import requests from fauxmo import fauxmo from fauxmo.plugins.simplehttpplugin import SimpleHTTPPlugin from faux...
code_fim
hard
{ "lang": "python", "repo": "ccancellieri/fauxmo", "path": "/tests/test_fauxmo.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fauxmo_server: pytest.fixture, simplehttpplugin_target: pytest.fixture ) -> None: """Test TCP server's "GetBinaryState" action for SimpleHTTPPlugin.""" data = b'Soapaction: "urn:Belkin:service:basicevent:1#GetBinaryState"' resp = requests.post( "http://127.0.0.1:12345/upnp/control...
code_fim
hard
{ "lang": "python", "repo": "ccancellieri/fauxmo", "path": "/tests/test_fauxmo.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chae1108/wheel-of-jeopardy path: /module/categorySelectWindow.py from PyQt5 import QtGui, QtWidgets from ui.categorySelect import Ui_categorySelect from module.gameWindow import GameWindow from PyQt5.QtWidgets import QAbstractItemView, QMessageBox <|fim_suffix|> if self.chosenList.count()...
code_fim
hard
{ "lang": "python", "repo": "chae1108/wheel-of-jeopardy", "path": "/module/categorySelectWindow.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, parent): super(CategorySelectWindow, self).__init__(parent) self.setupUi(self) self.startGame.clicked.connect(self.goToGame) self.cancel.clicked.connect(self.close) self.cancel.clicked.connect(parent.show) self.moveToRightColumn.clicke...
code_fim
hard
{ "lang": "python", "repo": "chae1108/wheel-of-jeopardy", "path": "/module/categorySelectWindow.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> with open(filePath, 'w') as f: #handle the summary f.write("@SUMMARY\n") for i in self.summary: f.write('== '.join([i, self.summary[i]]) + '\n') f.write("@PAPERS\n") for paperDict in self.papers: f.write("== ".join(["PMID", paperDict["PMID"]]) + "\n") f.write("== ".join(["TI ...
code_fim
hard
{ "lang": "python", "repo": "CSB5/atminter", "path": "/lib/modules/paperparse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """ loadSpFileDir(dirPath) input A path to a directory containing only .sp Files returns A list of spFile objects for all spFiles """ def loadSpFileDir(dirPath, purge = False): files = os.listdir(dirPath) if dirPath[-1] != "/": dirPath += '/' files = [dirPath + i for i in files] return [s...
code_fim
hard
{ "lang": "python", "repo": "CSB5/atminter", "path": "/lib/modules/paperparse.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CSB5/atminter path: /lib/modules/paperparse.py #!/usr/bin/env python3 """ paperparse.py A set of functions to deal with pubcrawl data """ import nltk import os import re import json """ getNames(filePath): input: pubcrawl json output: names, shortened name and genus of all species in ...
code_fim
hard
{ "lang": "python", "repo": "CSB5/atminter", "path": "/lib/modules/paperparse.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: basicworld/mengbao path: /test.py # -*- coding: utf-8 -*- import re import sys reload(sys) sys.setdefaultencoding('utf8') # 编译环境utf8 <|fim_suffix|>if __name__ == '__main__': print text_parse('test') print text_parse('你好')<|fim_middle|>from text_content_parse import text_parse
code_fim
easy
{ "lang": "python", "repo": "basicworld/mengbao", "path": "/test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': print text_parse('test') print text_parse('你好')<|fim_prefix|># repo: basicworld/mengbao path: /test.py # -*- coding: utf-8 -*- <|fim_middle|>import re import sys reload(sys) sys.setdefaultencoding('utf8') # 编译环境utf8 from text_content_parse import text_parse
code_fim
medium
{ "lang": "python", "repo": "basicworld/mengbao", "path": "/test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wanghan79/2020_Option_System path: /陶梦瑶2018012691/操作系统实验/平时作业1.py import platform def os(): print('操作系统及版本信息:[{}]'.format(platform.platform())) print('操作系统版本号:[{}]'.format(platform.v<|fim_suffix|>int('计算机类型:[{}]'.format(platform.machine())) print('计算机的网络名称:[{}]'.format(platform.node(...
code_fim
medium
{ "lang": "python", "repo": "wanghan79/2020_Option_System", "path": "/陶梦瑶2018012691/操作系统实验/平时作业1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mat(platform.processor())) print('汇总信息:[{}]'.format(platform.uname())) def main(): print("操作系统信息:") os() main()<|fim_prefix|># repo: wanghan79/2020_Option_System path: /陶梦瑶2018012691/操作系统实验/平时作业1.py import platform def os(): print('操作系统及版本信息:[{}]'.format(platform.platform())) prin...
code_fim
medium
{ "lang": "python", "repo": "wanghan79/2020_Option_System", "path": "/陶梦瑶2018012691/操作系统实验/平时作业1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cloudmesh-community/hid-sp18-405 path: /hadoop/archive/hadoop-python-2.9.0/python/deprecated/testingReducer_addE.py #!/usr/bin/env python """A more advanced Reducer, using Python iterators and generators.""" from itertools import groupby from operator import itemgetter import sys import math de...
code_fim
hard
{ "lang": "python", "repo": "cloudmesh-community/hid-sp18-405", "path": "/hadoop/archive/hadoop-python-2.9.0/python/deprecated/testingReducer_addE.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # input comes from STDIN (standard input) data = read_mapper_output(sys.stdin, separator=separator) #read in the training model pos, vocabulary_pos, total_pos = get_model("pos.txt") neg, vocabulary_neg, total_neg = get_model("neg.txt") vocabulary= vocabulary_pos.union(vocabulary_n...
code_fim
hard
{ "lang": "python", "repo": "cloudmesh-community/hid-sp18-405", "path": "/hadoop/archive/hadoop-python-2.9.0/python/deprecated/testingReducer_addE.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: benegg/hlpanotools path: /bin/dump_xls #! /usr/bin/env python # coding:utf-8 import xlrd import argparse import sys import codecs <|fim_suffix|> parser = argparse.ArgumentParser(description='dump xls content') parser.add_argument('xls', help='xls to dump') parser.add_argument('-i', '--index',...
code_fim
hard
{ "lang": "python", "repo": "benegg/hlpanotools", "path": "/bin/dump_xls", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sys.stdout = codecs.getwriter('utf8')(sys.stdout) wb = xlrd.open_workbook(xls) st = wb.sheet_by_index(isheet) for i in xrange(st.nrows): cells = [] for j in xrange(st.ncols): cell = st.cell_value(i, j) if not cell: cell = '<null>' cells.append(str(cell)) print delimiter.join(cells) ...
code_fim
medium
{ "lang": "python", "repo": "benegg/hlpanotools", "path": "/bin/dump_xls", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: KostadinDev/AMS210-Jacobi path: /jacobi.py import numpy as np # Returns normalized A and b so that |D| < 1 def normalize(A, b): normalizedMatrix = [] normalizedVector = [] for idx, row in enumerate(A): normalizedMatrix.append(row/np.max(row)) normalizedVector.append(b[...
code_fim
hard
{ "lang": "python", "repo": "KostadinDev/AMS210-Jacobi", "path": "/jacobi.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># Driver for part b) x = np.array([0,0,0]) x, num_iterations = jacobi(A, b, x, epsilon = 0.0001, return_iterations = True) print("PART b): x = ", x, f" in {num_iterations} iterations") # Driver for part c) x = [100,100,100] x, num_iterations = jacobi(A, b, x, epsilon = 0.0001, return_iterations = True) p...
code_fim
medium
{ "lang": "python", "repo": "KostadinDev/AMS210-Jacobi", "path": "/jacobi.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhuofalin/OCR_tools path: /ocr.py #!/usr/bin/python3 # encoding:utf-8 import apisettings as apis import os,time,tools,msvcrt global path,access_token from colorama import init init(autoreset=True) def printline(): print("-----------------------------------") def welcomeinfo(): print...
code_fim
hard
{ "lang": "python", "repo": "zhuofalin/OCR_tools", "path": "/ocr.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def ocrmain(): tools.create_sheet() tools.set_sheet() f_list = os.listdir(path) # print f_list for filename in f_list: # os.path.splitext():分离文件名与扩展名 suf = os.path.splitext(filename)[1] if suf == '.jpg' or suf == '.png': global access_token ...
code_fim
hard
{ "lang": "python", "repo": "zhuofalin/OCR_tools", "path": "/ocr.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GSI-CS-CO/wb_fec path: /testbench/fec_mux/Manifest.py action = "simulation" target = "altera" syn_device = "ep2agx125ef" syn_grade = "c5" syn_package = "29" #target = "xilinx" #syn_device = "xc6slx45t" #syn_grade = "-3" #syn_package = "fgg484" <|fim_suffix|>modules = { "local" : [ "../../../.....
code_fim
medium
{ "lang": "python", "repo": "GSI-CS-CO/wb_fec", "path": "/testbench/fec_mux/Manifest.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>files = [ "main.sv" ] modules = { "local" : [ "../../../../", "../../../../ip_cores/general-cores" ]};<|fim_prefix|># repo: GSI-CS-CO/wb_fec path: /testbench/fec_mux/Manifest.py action = "simulation" target = "altera" syn_device = "ep2agx125ef" syn_grade = "c5"...
code_fim
medium
{ "lang": "python", "repo": "GSI-CS-CO/wb_fec", "path": "/testbench/fec_mux/Manifest.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> result = False target_idx = 0 for idx, num in enumerate(nums): if num < (idx - target_idx): result = False else: result = True target_idx = idx return result<|fim_prefix|># repo: wding-dev/coding-challenge path: /jump_game/main.py """ ...
code_fim
hard
{ "lang": "python", "repo": "wding-dev/coding-challenge", "path": "/jump_game/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for idx, num in enumerate(nums): if num < (idx - target_idx): result = False else: result = True target_idx = idx return result<|fim_prefix|># repo: wding-dev/coding-challenge path: /jump_game/main.py """ Given an array of non-negative integers...
code_fim
hard
{ "lang": "python", "repo": "wding-dev/coding-challenge", "path": "/jump_game/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wding-dev/coding-challenge path: /jump_game/main.py """ Given an array of non-negative integers nums, you are initially positioned at the first index of the array. Each element in the array represents your maximum jump length at that position. Determine if you are able to reach the last index. E...
code_fim
medium
{ "lang": "python", "repo": "wding-dev/coding-challenge", "path": "/jump_game/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ping-Hsuan/PyROM path: /code/read_helpers/read_helpers.py import numpy as np def read_mat(fname, N): t = np.loadtxt(fname) lb = int(np.sqrt(len(t))) t1 = np.reshape(t, (lb, lb), order='F') msg = fname.split('/') if 'but' in msg[-1].split('_'): t = t1[0:N+1, 0:N+1] ...
code_fim
medium
{ "lang": "python", "repo": "Ping-Hsuan/PyROM", "path": "/code/read_helpers/read_helpers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> t = np.loadtxt(fname) lb = int(np.floor((len(t))**(1/3))) t1 = np.reshape(t, (lb, lb+1, lb+1), order='F') t = t1[0:N, 0:N+1, 0:N+1] return t def read_vector(fname): t = np.loadtxt(fname) return t<|fim_prefix|># repo: Ping-Hsuan/PyROM path: /code/read_helpers/read_helpers.py ...
code_fim
medium
{ "lang": "python", "repo": "Ping-Hsuan/PyROM", "path": "/code/read_helpers/read_helpers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FeiyuYin/272_Project path: /myapp/forms.py from django import forms #from models import Document from models import Webapp from models import Language from models import Package from models import Server from models import Source from django.forms.extras.widgets import SelectDateWidget from djang...
code_fim
medium
{ "lang": "python", "repo": "FeiyuYin/272_Project", "path": "/myapp/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class WebappForm(ModelForm): language_needed = forms.ModelMultipleChoiceField(queryset=Language.objects.all(), widget=forms.CheckboxSelectMultiple(),required=True) package_needed = forms.ModelMultipleChoiceField(queryset=Package.objects.all(),widget=forms.CheckboxSelectMultiple(),required=True) server ...
code_fim
medium
{ "lang": "python", "repo": "FeiyuYin/272_Project", "path": "/myapp/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cassidycy/machinelearning path: /com2018.py print("开始……") import pandas as pd from sklearn.linear_model import LogisticRegression from sklearn.feature_extraction.text import CountVectorizer df_train = pd.read_csv('./train_set.csv') df_test = pd.read_csv('./test_set.csv') df_train.drop(c...
code_fim
medium
{ "lang": "python", "repo": "cassidycy/machinelearning", "path": "/com2018.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>df_test['class']=y_test.tolist() df_test['class']=df_test['class']+1 df_result = df_test.loc[:,['id','class']] df_result.to_cvs('./result.csv',index=False) print("完成……")<|fim_prefix|># repo: cassidycy/machinelearning path: /com2018.py print("开始……") import pandas as pd from sklearn.linear_model ...
code_fim
medium
{ "lang": "python", "repo": "cassidycy/machinelearning", "path": "/com2018.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Gavin-sun/leetcode path: /Machine_learning/py/5.手写数字识别加载数据_GPU.py # 使用pytorch 完成手写数字的识别 import numpy as np import os import torch import torch.nn as nn import torch.nn.functional as F from torch.utils.data import DataLoader from torch.optim import Adam from torchvision.datasets import MNIST from...
code_fim
hard
{ "lang": "python", "repo": "Gavin-sun/leetcode", "path": "/Machine_learning/py/5.手写数字识别加载数据_GPU.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> data_loader = get_dataloader() for idx,(input,target) in enumerate(data_loader): optimizer.zero_grad() input = input.to(device) target = target.to(device) output = model(input) # 调用模型,得到预测值 loss = F.nll_loss(output,target).to(device) # 得到损失 loss.back...
code_fim
hard
{ "lang": "python", "repo": "Gavin-sun/leetcode", "path": "/Machine_learning/py/5.手写数字识别加载数据_GPU.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Parameters = { 'xmax':xmax, 'dx':Dx, 'tmax':tmax, 'dt':Dt, 'u0':u0, 'k':k, 'E_prior':E_prior, 'E_true':E_true, 'stations':stations, 'sigmaxa':sigmaxa, 'sigmaxe':sigmaxe, 'noisemult':noisemult, 'noiseadd':noiseadd, 'precon':Preconditioning, 'rerun...
code_fim
hard
{ "lang": "python", "repo": "MarkDekker1/InverseModelling", "path": "/Run_Adjoint.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarkDekker1/InverseModelling path: /Run_Adjoint.py # ------------------------------------------------------ # Define parameters # ------------------------------------------------------ import numpy as np import time as T xmax = 100 u0 = 5 tmax = 10* xmax...
code_fim
hard
{ "lang": "python", "repo": "MarkDekker1/InverseModelling", "path": "/Run_Adjoint.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># ------------------------------------------------------ # Testing the adjoint model # ------------------------------------------------------ m = AdjointModel(Parameters,method='Upwind',initialvalue=0) # ------------------------------------------------------ # Gaining results # -------------------------...
code_fim
hard
{ "lang": "python", "repo": "MarkDekker1/InverseModelling", "path": "/Run_Adjoint.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>', '辽宁经济职业技术学院', '辽宁科技大学', '辽宁师范大学', '辽宁石油化工大学', '辽宁中医药大学', '辽宁中医药大学杏林学院', '辽源职业技术学院', '聊城大学', '临沂大学', '龙岩学院', '鲁东大学', '洛阳理工学院', '洛阳师范学院', '漯河医学高等专科学校', '绵阳师范学院', '闽江学院', '闽南理工学院', '闽南师范大学', '牡丹江大学', '牡丹江师范学院', '牡丹江医学院', '内江师范学院', '内蒙古财经大学', '内蒙古大学', '内蒙古工业大学', '内蒙古建筑职业技术学院', '内蒙古科技大学', '内蒙古科技大学包头师范学院', '...
code_fim
hard
{ "lang": "python", "repo": "FatBallFish/NIAEC", "path": "/baidupic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: FatBallFish/NIAEC path: /baidupic.py alue 中的数字会被当成十进制unicode编码转换成字符 # 也可以直接用字符串作为value char_table = {ord(key): ord(value) for key, value in char_table.items()} # 解码图片URL def decode(url): # 先替换字符串 for key, value in str_table.items(): url = url.replace(key, value) # 再替换剩下的字符 ...
code_fim
hard
{ "lang": "python", "repo": "FatBallFish/NIAEC", "path": "/baidupic.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> dirpath = os.path.join(sys.path[0], dirName) if not os.path.exists(dirpath): os.mkdir(dirpath) return dirpath if __name__ == '__main__': word_list = ['安徽财经大学', '安徽财经大学商学院', '安徽财贸职业学院', '安徽大学', '安徽大学江淮学院', '安徽电气工程职业技术学院', '安徽工程大学', '安徽工商职业学院', '安徽工业大学', '安徽工业大学工商学院', '安徽国际商务职业学院', ...
code_fim
hard
{ "lang": "python", "repo": "FatBallFish/NIAEC", "path": "/baidupic.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #para manejar los errores sintacticos #def p_error(t): #en modo panico :v # print("token error: ",t) # print("Error sintáctico en '%s'" % t.value[0]) # print("Error sintáctico en '%s'" % t.value[1]) #def p_error(t): #en modo panico :v # while True: # tok=parser.token()...
code_fim
hard
{ "lang": "python", "repo": "bcfiusac/PruebaCompi2", "path": "/gramaticaAscendente.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bcfiusac/PruebaCompi2 path: /gramaticaAscendente.py # ----------------------------------------------------------------------------- # Grupo 6 # # Universidad de San Carlos de Guatemala # Facultad de Ingenieria # Escuela de Ciencias y Sistemas # Organizacion de Lenguajes y Compiladores 2 ...
code_fim
hard
{ "lang": "python", "repo": "bcfiusac/PruebaCompi2", "path": "/gramaticaAscendente.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r'[a-zA-Z0-9]+' t.type = reservadas.get(t.value.lower(),'ETIQUETA') # Check for reserved words return t # Comentario simple # ... def t_COMENTARIO_SIMPLE(t): r'--.*\n' t.lexer.lineno += 1 # ----------------------- Caracteres ignorados ----------------------- # carac...
code_fim
hard
{ "lang": "python", "repo": "bcfiusac/PruebaCompi2", "path": "/gramaticaAscendente.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>outputs = model_ft(inputs) _, preds = torch.max(outputs.data, 1) y_true.append(labels.data.cpu().numpwpy()) y_pred.append(preds.cpu().numpy()) print (y_pred[0][0],y_true[0][0]) # plt.imshow(inputs.cpu()) break<|fim_prefix|># repo: Bala93/Digital-pathology path: /codes/evaluate.py from __future__ impo...
code_fim
hard
{ "lang": "python", "repo": "Bala93/Digital-pathology", "path": "/codes/evaluate.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Bala93/Digital-pathology path: /codes/evaluate.py from __future__ import print_function, division import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler from torch.autograd import Variable import numpy as np import torchvision from torchvision import...
code_fim
hard
{ "lang": "python", "repo": "Bala93/Digital-pathology", "path": "/codes/evaluate.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> r = _schema.parse_file('src/position_to_end.bin') self.assertEqual(len(r.pass_ints.nums), 3) self.assertEqual(r.pass_ints.nums[0], 513) self.assertEqual(r.pass_ints.nums[1], 1027) self.assertEqual(r.pass_ints.nums[2], 1541) self.assertEqual(len(r.pass_ints_...
code_fim
medium
{ "lang": "python", "repo": "kaitai-io/kaitai_struct_tests", "path": "/spec/construct/test_params_pass_array_int.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaitai-io/kaitai_struct_tests path: /spec/construct/test_params_pass_array_int.py # Autogenerated from KST: please remove this line if doing any edits by hand! import unittest from params_pass_array_int import _schema class TestParamsPassArrayInt(unittest.TestCase): <|fim_suffix|> r = _...
code_fim
medium
{ "lang": "python", "repo": "kaitai-io/kaitai_struct_tests", "path": "/spec/construct/test_params_pass_array_int.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nacoolp/portfolio path: /jobs/views.py from django.shortcuts import render <|fim_suffix|>def home(request): jobs = Job.objects im = '\media\images\sr40.jpg' return render(request, 'jobs/home.html', {'jobs': jobs, 'image': im})<|fim_middle|>from .models import Job import os cwd = os.g...
code_fim
medium
{ "lang": "python", "repo": "nacoolp/portfolio", "path": "/jobs/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> jobs = Job.objects im = '\media\images\sr40.jpg' return render(request, 'jobs/home.html', {'jobs': jobs, 'image': im})<|fim_prefix|># repo: nacoolp/portfolio path: /jobs/views.py from django.shortcuts import render <|fim_middle|>from .models import Job import os cwd = os.getcwd() base_dir = ...
code_fim
medium
{ "lang": "python", "repo": "nacoolp/portfolio", "path": "/jobs/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: JohnsonLu3/Gerrymandering-Analysis path: /dataParsers/dbImporter/ImportSimulation.py from sqlalchemy import create_engine from sqlalchemy import Table, Column, Integer, String, MetaData, ForeignKey from sqlalchemy.orm import sessionmaker, scoped_session from sqlalchemy.ext.automap import automap_...
code_fim
hard
{ "lang": "python", "repo": "JohnsonLu3/Gerrymandering-Analysis", "path": "/dataParsers/dbImporter/ImportSimulation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for row in session.execute(repVotePercent): actualRepPercent = float(row[0]) for row in session.execute(demVotePercent): actualDemPercent = float(row[0]) for i in range(K): # Randomly select N districts from the district table for ...
code_fim
hard
{ "lang": "python", "repo": "JohnsonLu3/Gerrymandering-Analysis", "path": "/dataParsers/dbImporter/ImportSimulation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>train_dataset = train.flow_from_directory("data/train/", target_size=(150,150), batch_size = 32, class_mode = 'binary') test_dataset = tes...
code_fim
hard
{ "lang": "python", "repo": "cryptobench/discord-image-recognition", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>model.add(keras.layers.Conv2D(256,(3,3),activation='relu')) model.add(keras.layers.MaxPool2D(2,2)) # This layer flattens the resulting image array to 1D array model.add(keras.layers.Flatten()) # Hidden layer with 512 neurons and Rectified Linear Unit activation function model.add(keras.layers.Dense(512...
code_fim
hard
{ "lang": "python", "repo": "cryptobench/discord-image-recognition", "path": "/train.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cryptobench/discord-image-recognition path: /train.py import tensorflow as tf import numpy as np from tensorflow import keras import os import cv2 from tensorflow.keras.preprocessing.image import ImageDataGenerator from tensorflow.keras.preprocessing import image import matplotlib.pyplot as plt f...
code_fim
hard
{ "lang": "python", "repo": "cryptobench/discord-image-recognition", "path": "/train.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: vellankikoti/PythonProjects path: /main.py from tkinter import* import qrcode from PIL import Image, ImageTk from resizeimage import resizeimage class Qr_Generator: def __init__(self,root): self.root = root self.root.geometry("900x500+200+50") self.root.title("...
code_fim
hard
{ "lang": "python", "repo": "vellankikoti/PythonProjects", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }