text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: gic91/2DGP_project path: /2D_GAME/game_source/menu_state.py import random import json import os from pico2d import * import game_framework import game_world import menu_world import game_state from Start_menu import Menu name = "MenuState" boy = None Start_menu = None menu_time =None def ent...
code_fim
hard
{ "lang": "python", "repo": "gic91/2DGP_project", "path": "/2D_GAME/game_source/menu_state.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def update(): for game_object in menu_world.all_objects(): game_object.update() def draw(): clear_canvas() for game_object in menu_world.all_objects(): game_object.draw() update_canvas()<|fim_prefix|># repo: gic91/2DGP_project path: /2D_GAME/game_source/menu_state.py im...
code_fim
medium
{ "lang": "python", "repo": "gic91/2DGP_project", "path": "/2D_GAME/game_source/menu_state.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.xfail(raises=pandas.errors.ParserError) def test_tns_watcher(self): log("Connecting to DB") mongo = Mongo( host=config["database"]["host"], port=config["database"]["port"], replica_set=config["database"]["replica_set"], u...
code_fim
medium
{ "lang": "python", "repo": "dekishalay/kowalski", "path": "/tests/test_tns_watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> log("Connecting to DB") mongo = Mongo( host=config["database"]["host"], port=config["database"]["port"], replica_set=config["database"]["replica_set"], username=config["database"]["username"], password=config["database"]["password...
code_fim
medium
{ "lang": "python", "repo": "dekishalay/kowalski", "path": "/tests/test_tns_watcher.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dekishalay/kowalski path: /tests/test_tns_watcher.py import pandas import pytest from tns_watcher import get_tns from utils import load_config, log, Mongo """ load config and secrets """ config = load_config(config_file="config.yaml")["kowalski"] <|fim_suffix|> log("Connecting to DB")...
code_fim
medium
{ "lang": "python", "repo": "dekishalay/kowalski", "path": "/tests/test_tns_watcher.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' @app.route('/process_game', methods=['POST']) def process_game(): move_sequence = json.loads(request.data)['moves'] return jsonify(run_game(move_sequence)) return app if __n...
code_fim
easy
{ "lang": "python", "repo": "josefdaly/python-chess-api", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return app if __name__ == '__main__': app = create_app() app.run(port=5000)<|fim_prefix|># repo: josefdaly/python-chess-api path: /app.py import json from flask import Flask, request, jsonify from lib.chess_utils import run_game def create_app(): app = Flask(__name__) @app.rout...
code_fim
medium
{ "lang": "python", "repo": "josefdaly/python-chess-api", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: josefdaly/python-chess-api path: /app.py import json from flask import Flask, request, jsonify <|fim_suffix|>def create_app(): app = Flask(__name__) @app.route('/') def hello_world(): return 'Hello, World!' @app.route('/process_game', methods=['POST']) def process_...
code_fim
easy
{ "lang": "python", "repo": "josefdaly/python-chess-api", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: leschzinerlab/SPIDER path: /Gold_analysis/alignHuge_ALL.py #!/usr/bin/env python import os import shutil import glob import re import subprocess <|fim_suffix|> cmd="alignhuge %s_filt.mrc %s %s" %(ef[:-4],en,efAli) subprocess.Popen(cmd,shell=True).wait() cmd='rm %s_filt.mrc %s' %(ef[:-4],efAl...
code_fim
hard
{ "lang": "python", "repo": "leschzinerlab/SPIDER", "path": "/Gold_analysis/alignHuge_ALL.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cmd='rm %s_filt.mrc %s' %(ef[:-4],efAli) subprocess.Popen(cmd,shell=True).wait()<|fim_prefix|># repo: leschzinerlab/SPIDER path: /Gold_analysis/alignHuge_ALL.py #!/usr/bin/env python import os import shutil import glob import re import subprocess <|fim_middle|>list = glob.glob("*en.mrc") for en in l...
code_fim
hard
{ "lang": "python", "repo": "leschzinerlab/SPIDER", "path": "/Gold_analysis/alignHuge_ALL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cmd='proc2d %s %s_filt.mrc apix=1.501 lp=20' %(ef,ef[:-4]) subprocess.Popen(cmd,shell=True).wait() cmd="alignhuge %s_filt.mrc %s %s" %(ef[:-4],en,efAli) subprocess.Popen(cmd,shell=True).wait() cmd='rm %s_filt.mrc %s' %(ef[:-4],efAli) subprocess.Popen(cmd,shell=True).wait()<|fim_prefix|># repo: les...
code_fim
medium
{ "lang": "python", "repo": "leschzinerlab/SPIDER", "path": "/Gold_analysis/alignHuge_ALL.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: karimmamer/WheatRustClassification path: /utils.py import torch import torch.nn as nn import torch.optim as optim from torch.optim import lr_scheduler import numpy as np import torchvision from torchvision import datasets, models, transforms #import matplotlib.pyplot as plt import time import os ...
code_fim
hard
{ "lang": "python", "repo": "karimmamer/WheatRustClassification", "path": "/utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> imgs = [] labels = [] ids = [] for fname in os.listdir(p): #read image img = Image.open(os.path.join(p, fname)) #rotate image to original view try: if not('DMWVNR' in fname): exif=dict((ExifTags.TAGS[k], v) for k, v in img._getexi...
code_fim
hard
{ "lang": "python", "repo": "karimmamer/WheatRustClassification", "path": "/utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> v = self.cli("show version", cached=True) for platform, ver in [ ("ESCOM L", self.rx_ver_escom_l), ("ESCOM", self.rx_ver), ("ESCOM", self.rx_ver1), ]: match = ver.search(v) if match: break else: ...
code_fim
hard
{ "lang": "python", "repo": "nocproject/noc", "path": "/sa/profiles/Iskratel/ESCOM/get_version.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kneufeld/chatroom path: /txchat/txchat/client.py from __future__ import print_function import os from twisted.internet.task import react from twisted.internet.defer import Deferred, inlineCallbacks from twisted.internet.protocol import Factory from twisted.internet.protocol import Protocol from...
code_fim
medium
{ "lang": "python", "repo": "kneufeld/chatroom", "path": "/txchat/txchat/client.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self.protocol.sendMessage(self.nick, line) def __init__(self, nick, proto): self.nick = nick self.protocol = proto def connectionLost(self, reason): self.protocol.transport.loseConnection()<|fim_prefix|># repo: kneufeld/chatroom path: /txchat/txchat/client...
code_fim
hard
{ "lang": "python", "repo": "kneufeld/chatroom", "path": "/txchat/txchat/client.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def add_setup(setup=None, teardown=None): """decorate test functions to add additional setup/teardown contexts""" def decorate_function(test): def wrapper(self): if setup: setup(self) test(self) if teardown: teardown(self)...
code_fim
hard
{ "lang": "python", "repo": "sshyran/gpdb", "path": "/gpMgmt/bin/gppylib/test/unit/gp_unittest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sshyran/gpdb path: /gpMgmt/bin/gppylib/test/unit/gp_unittest.py import unittest2 as unittest class GpTestCase(unittest.TestCase): def __init__(self, methodName='runTest'): super(GpTestCase, self).__init__(methodName) self.patches = [] self.mock_objs = [] def app...
code_fim
medium
{ "lang": "python", "repo": "sshyran/gpdb", "path": "/gpMgmt/bin/gppylib/test/unit/gp_unittest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """decorate test functions to add additional setup/teardown contexts""" def decorate_function(test): def wrapper(self): if setup: setup(self) test(self) if teardown: teardown(self) return wrapper return decorat...
code_fim
medium
{ "lang": "python", "repo": "sshyran/gpdb", "path": "/gpMgmt/bin/gppylib/test/unit/gp_unittest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # These were found manually sta = 184000 end = sta + 1000 times = np.arange(end-sta, dtype = 'float') times /= record.fs # Extract the annotations for that fragment where = (sta < ann.annsamp) & (ann.annsamp < end) samples = ann.annsamp[where] - sta print samples ...
code_fim
hard
{ "lang": "python", "repo": "prerna-khanna/ECG", "path": "/utils/plotters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: prerna-khanna/ECG path: /utils/plotters.py import wfdb as wf import numpy as np from scipy import signal as ss from datasets import mitdb as dm from matplotlib import pyplot as plt def show_path(path): """ As a plot """ # Read in the data record = wf.rdsamp(path) annotation = wf....
code_fim
hard
{ "lang": "python", "repo": "prerna-khanna/ECG", "path": "/utils/plotters.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cha = record.p_signals[:, chid] # These were found manually sta = 184000 end = sta + 1000 times = np.arange(end-sta, dtype = 'float') times /= record.fs # Extract the annotations for that fragment where = (sta < ann.annsamp) & (ann.annsamp < end) samples = ann.annsamp...
code_fim
hard
{ "lang": "python", "repo": "prerna-khanna/ECG", "path": "/utils/plotters.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>user1.describe_user() user1.greet_user() user2.describe_user() user2.greet_user() user3.describe_user() user3.greet_user()<|fim_prefix|># repo: ntexplorer/PythonPractice path: /PythonCrashCoursePrac/Chapter9_Prac/9-3.py class User(): def __init__(self, first, last, gender, age): self.first_na...
code_fim
hard
{ "lang": "python", "repo": "ntexplorer/PythonPractice", "path": "/PythonCrashCoursePrac/Chapter9_Prac/9-3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ntexplorer/PythonPractice path: /PythonCrashCoursePrac/Chapter9_Prac/9-3.py class User(): def __init__(self, first, last, gender, age): self.first_name = first self.last_name = last self.gender = gender self.age = age self.full_name = self.first_name + ...
code_fim
medium
{ "lang": "python", "repo": "ntexplorer/PythonPractice", "path": "/PythonCrashCoursePrac/Chapter9_Prac/9-3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #def __str__(self): # return self.title<|fim_prefix|># repo: earu-devops/CP_Project path: /Django/UserRegProject1/UserRegApp1/models.py #This models.py is under UserRegApp1 folder from django.db import models <|fim_middle|># Create your models here. class UserRegModel(models.Model): user...
code_fim
hard
{ "lang": "python", "repo": "earu-devops/CP_Project", "path": "/Django/UserRegProject1/UserRegApp1/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> username = models.CharField(max_length=15) emailid = models.EmailField() password1= models.CharField(max_length=6) password2= models.CharField(max_length=6) mailsent = models.CharField(max_length=1) #def __str__(self): # return self.title<|fim_prefix|># repo: earu-devops/C...
code_fim
medium
{ "lang": "python", "repo": "earu-devops/CP_Project", "path": "/Django/UserRegProject1/UserRegApp1/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: earu-devops/CP_Project path: /Django/UserRegProject1/UserRegApp1/models.py #This models.py is under UserRegApp1 folder from django.db import models # Create your models here. class UserRegModel(models.Model): <|fim_suffix|> #def __str__(self): # return self.title<|fim_middle|> user...
code_fim
hard
{ "lang": "python", "repo": "earu-devops/CP_Project", "path": "/Django/UserRegProject1/UserRegApp1/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: zzgzjun/mylab path: /item/views.py from django.shortcuts import render, redirect # Create your views here. from item.models import Item, Unit def str_to_bool(s): return True if s.lower() == 'true' else False def item(request): if not request.session.get('is_login', None): re...
code_fim
hard
{ "lang": "python", "repo": "zzgzjun/mylab", "path": "/item/views.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if request.method == 'GET': nid = request.GET.get('nid') unit_info = Unit.objects.get(id=nid) return render(request, 'item/edit_unit.html', locals()) else: nid = request.GET.get('nid') unit_index = request.POST.get('unit_index') unit_name = request.P...
code_fim
hard
{ "lang": "python", "repo": "zzgzjun/mylab", "path": "/item/views.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>2017/commits') text = r.json() #asking the code to print out the commit message for all rows in the text for row in text: print row['commit']['message']<|fim_prefix|># repo: ablumenzak/secu2002_-ABLUM40- path: /Lab07/github.py #Task 4 - writing a code that prints all the commit message from reposito...
code_fim
medium
{ "lang": "python", "repo": "ablumenzak/secu2002_-ABLUM40-", "path": "/Lab07/github.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ablumenzak/secu2002_-ABLUM40- path: /Lab07/github.py #Task 4 - writing a code that prints all the commit message from repository import requests r = requests.get('https://api.github.com/repos/smeiklej/secu2002_<|fim_suffix|>ge for all rows in the text for row in text: print row['commit']['mes...
code_fim
medium
{ "lang": "python", "repo": "ablumenzak/secu2002_-ABLUM40-", "path": "/Lab07/github.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # gets text data from files with only maxlen words from each file. Gets whole file if maxlen is None def get_labelled_data_from_directories(data_dir, maxlen=None): texts = [] # list of text samples labels_index = {} # dictionary mapping label name to numeric id labels = [] # list of labe...
code_fim
hard
{ "lang": "python", "repo": "javedqadruddin/summarizer", "path": "/NLP_utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: javedqadruddin/summarizer path: /NLP_utils.py from keras.preprocessing.text import text_to_word_sequence import os # keras NLP tools filter out certain tokens by default # this function replaces the default with a smaller set of things to filter out def filter_not_punctuation(): return '"#$...
code_fim
medium
{ "lang": "python", "repo": "javedqadruddin/summarizer", "path": "/NLP_utils.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> string_sequence = text_to_word_sequence(text, filters=filter_not_punctuation()) truncated_string = '' for word in string_sequence[:n]: truncated_string = truncated_string + word + ' ' return truncated_string # gets text data from files with only maxlen words from each file. Get...
code_fim
medium
{ "lang": "python", "repo": "javedqadruddin/summarizer", "path": "/NLP_utils.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Client, ClientAdmin)<|fim_prefix|># repo: da-durand/facturier path: /web/admin.py from django.contrib import admin from .models import Client, Adress # Register your models here. class ClientInline(admin.StackedInline): model = Adress can_delete = False extra = 1 <|fim_...
code_fim
medium
{ "lang": "python", "repo": "da-durand/facturier", "path": "/web/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: da-durand/facturier path: /web/admin.py from django.contrib import admin from .models import Client, Adress # Register your models here. class ClientInline(admin.StackedInline): model = Adress can_delete = False extra = 1 class ClientAdmin(admin.ModelAdmin): <|fim_suffix|>admin.sit...
code_fim
easy
{ "lang": "python", "repo": "da-durand/facturier", "path": "/web/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: twoandahalf2/PythonBasics2 path: /TESTS_TEMP/classess/zadacha2.py import math class Point: def __init__(self, x:int, y:int): self.x = x self.y = y def create_point(self): point = [self.x, self.y] return point @staticmethod def calculate_distance...
code_fim
medium
{ "lang": "python", "repo": "twoandahalf2/PythonBasics2", "path": "/TESTS_TEMP/classess/zadacha2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> n = int(input()) total_points = [] while n > 0: n -= 1 a, b = [int(x) for x in input().split()] point = Point(a, b).create_point() total_points.append(point) segment_list = [] for index_1 in range(len(total_points)): for index_2 in range(len(total_points)): if index_1 != i...
code_fim
hard
{ "lang": "python", "repo": "twoandahalf2/PythonBasics2", "path": "/TESTS_TEMP/classess/zadacha2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> side_a = abs(point_1.x - point_2.x) side_b = abs(point_1.y - point_2.y) side_c = math.sqrt(side_a**2 + side_b**2) return side_c n = int(input()) total_points = [] while n > 0: n -= 1 a, b = [int(x) for x in input().split()] point = Point(a, b).create_point()...
code_fim
medium
{ "lang": "python", "repo": "twoandahalf2/PythonBasics2", "path": "/TESTS_TEMP/classess/zadacha2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ximepss2/web-scraping-challenge path: /FlaskMisiontoMars/mongo.py import pymongo import pandas as pd from scrape_mars import scrape import json # Create connection variable conn = 'mongodb://localhost:27017' # Pass connection to the pymongo instance. client = pymongo.MongoClient(conn) # Conn...
code_fim
hard
{ "lang": "python", "repo": "Ximepss2/web-scraping-challenge", "path": "/FlaskMisiontoMars/mongo.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Facts url = "https://space-facts.com/mars/" info = "Facts" # Drops collection if available to remove duplicates db.facts.drop() #Insert info #print(scrape(info,url)) df = pd.DataFrame(scrape(info,url)) df_json = df.to_json() df_json_list = json.loads(df_json).values() db.facts.insert(df_json_list) #Hemi...
code_fim
hard
{ "lang": "python", "repo": "Ximepss2/web-scraping-challenge", "path": "/FlaskMisiontoMars/mongo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#Hemispheres url = "https://astrogeology.usgs.gov/search/results?q=hemisphere+enhanced&k1=target&v1=Mars" info = "Hemis" # Drops collection if available to remove duplicates db.hemis.drop() #Insert info #print(scrape(info,url)) db.hemis.insert_many(scrape(info,url))<|fim_prefix|># repo: Ximepss2/web-scrap...
code_fim
hard
{ "lang": "python", "repo": "Ximepss2/web-scraping-challenge", "path": "/FlaskMisiontoMars/mongo.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from __future__ import absolute_import import unittest import io_stockx from io_stockx.models.portfolio_id_del_response_portfolio_item_product_media import PortfolioIdDelResponsePortfolioItemProductMedia # noqa: E501 from io_stockx.rest import ApiException class TestPortfolioIdDelResponsePortfolioIt...
code_fim
medium
{ "lang": "python", "repo": "stvncrn/stockx_api_ref", "path": "/sdk/python/lib/build/lib/test/test_portfolio_id_del_response_portfolio_item_product_media.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: stvncrn/stockx_api_ref path: /sdk/python/lib/build/lib/test/test_portfolio_id_del_response_portfolio_item_product_media.py # coding: utf-8 """ StockX API PRERELEASE API - Subject to change before release. Provides access to StockX's public services, allowing end users to query for produ...
code_fim
medium
{ "lang": "python", "repo": "stvncrn/stockx_api_ref", "path": "/sdk/python/lib/build/lib/test/test_portfolio_id_del_response_portfolio_item_product_media.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': main()<|fim_prefix|># repo: GaloMago/URI_Answers_py path: /uri_1143.py def main(): #entrada N = int(input()) num = 1 <|fim_middle|> #processamento for i in range (N+1): if i > 0: #saida print("%d %d %d" %(i, i**2, ...
code_fim
medium
{ "lang": "python", "repo": "GaloMago/URI_Answers_py", "path": "/uri_1143.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: GaloMago/URI_Answers_py path: /uri_1143.py def main(): #entrada N = int(input()) num = 1 <|fim_suffix|>if __name__ == '__main__': main()<|fim_middle|> #processamento for i in range (N+1): if i > 0: #saida print("%d %d %d" %(i, i**2, i*...
code_fim
medium
{ "lang": "python", "repo": "GaloMago/URI_Answers_py", "path": "/uri_1143.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kvraman1/QUESTION-BANK path: /Qbank/migrations/0001_initial.py # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import migrations, models from django.conf import settings class Migration(migrations.Migration): dependencies = [ migrations.swappable_dep...
code_fim
hard
{ "lang": "python", "repo": "kvraman1/QUESTION-BANK", "path": "/Qbank/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rations.CreateModel( name='QuestionBank', fields=[ ('id', models.AutoField(verbose_name='ID', serialize=False, auto_created=True, primary_key=True)), ('CourseTitle', models.CharField(max_length=50)), ('CourseCode', models.CharField(ma...
code_fim
hard
{ "lang": "python", "repo": "kvraman1/QUESTION-BANK", "path": "/Qbank/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # 从JSON字符串读取图片数据 dataUrl = self.get_body_argument("image") Orientation = self.get_body_argument("orientation") # 得到图片方向以便旋转处理 content = base64.b64decode(dataUrl) '''保存到图片target.jpg''' file = open('./static/images/target.jpg', 'wb') file.write(...
code_fim
hard
{ "lang": "python", "repo": "halloayu/inception_v3_flowerIdentify", "path": "/handlers/fi_handlers.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: halloayu/inception_v3_flowerIdentify path: /handlers/fi_handlers.py # -*- coding: utf-8 -*- # @File :fi_handlers.py # @Author:ZengYu # @Date :2019/5/16 # @software:PyCharm import tornado.web import tornado.websocket from PIL import Image import base64 from model.flower_identify impor...
code_fim
hard
{ "lang": "python", "repo": "halloayu/inception_v3_flowerIdentify", "path": "/handlers/fi_handlers.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> output = '#' + OPT_APPNAME environment.Program( output, objs, duplicate=0) ################################# platform_build = 'build' + os.path.sep + sys.platform #Set up a building environment env = Environment() env.BuildSharedLib = BuildSharedLib env.CreateAppFromObjs = CreateAppFromObjs #Check ...
code_fim
hard
{ "lang": "python", "repo": "jacmoe/OgreOpcode", "path": "/SConstruct", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jacmoe/OgreOpcode path: /SConstruct ############################## # SConscript for OgreOpcode # ############################## #SCons scripts maintained by: # Van Aarde "nanocell" Krynauw. #TODO: # - Add commandline options to specify include dirs, defines, compiler defs, libraries, etc. # - ...
code_fim
hard
{ "lang": "python", "repo": "jacmoe/OgreOpcode", "path": "/SConstruct", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> contact = models.ForeignKey(Contact) name = models.CharField(max_length=50) def __unicode__(self): return self.name<|fim_prefix|># repo: winner-sheng/HelloWorld path: /TestModel/models.py # -*- coding: utf-8 -*- from django.db import models # Create your models here. class Test(...
code_fim
hard
{ "lang": "python", "repo": "winner-sheng/HelloWorld", "path": "/TestModel/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: winner-sheng/HelloWorld path: /TestModel/models.py # -*- coding: utf-8 -*- from django.db import models # Create your models here. class Test(models.Model): name = models.CharField(max_length=20) def __unicode__(self): return self.name <|fim_suffix|> class Tag(models.Model...
code_fim
hard
{ "lang": "python", "repo": "winner-sheng/HelloWorld", "path": "/TestModel/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Contact(models.Model): GENDER_TYPES = ( ('M', u'男'), ('F', u'女'), ('X', u'不告诉你'), ) name = models.CharField(u'姓名', max_length=20) age = models.IntegerField(u'年龄', default=0) gender = models.CharField(u'性别', max_length=1, null=False, blank=False, choices=GE...
code_fim
medium
{ "lang": "python", "repo": "winner-sheng/HelloWorld", "path": "/TestModel/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> file = open(args.json_file,'r') res = [] a = 0 for line in file.readlines(): dic = json.loads(line) img_url = dic["url"] t = {"url": img_url, "true":0, "simialr_uri":[]} if not "error" in dic.keys(): a += 1 #im_num = img_url.split('....
code_fim
hard
{ "lang": "python", "repo": "walkoncross/retrieval_for_image", "path": "/top5_correct.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: walkoncross/retrieval_for_image path: /top5_correct.py # -*- coding: utf-8 -*- import json import argparse def parse_args(): """ Parse input arguments. :return: """ parser = argparse.ArgumentParser(description='以图搜图API测试') parser.add_argument('--ak', dest='access_key', he...
code_fim
hard
{ "lang": "python", "repo": "walkoncross/retrieval_for_image", "path": "/top5_correct.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiaxiaochu/spider path: /06-About_json/1-qq_music.py # !/Library/Frameworks/Python.framework/Versions/3.7/bin/python3 # -*- coding:utf-8 -*- # @Author : Jiazhixiang import requests from bs4 import BeautifulSoup headers = { "User-Agent": "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/535.1...
code_fim
hard
{ "lang": "python", "repo": "jiaxiaochu/spider", "path": "/06-About_json/1-qq_music.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nt(type(json_response)) list_music = json_response['data']['song']['list'] for music in list_music: print(music['name']) print("所属专辑:" + music['album']['name']) print("歌曲时长:" + str(music['interval']) + "秒") # https: // y.qq.com / n / yqq / song / 001qvvgF38HVc4.html print("歌曲播放链接:https...
code_fim
hard
{ "lang": "python", "repo": "jiaxiaochu/spider", "path": "/06-About_json/1-qq_music.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>at=json&inCharset=utf8&outCharset=utf-8&notice=0&platform=yqq.json&needNewCode=0" response = requests.get(url=client_url, headers=headers) print(response.status_code) print(response.apparent_encoding) response.encoding = response.apparent_encoding # response = response.text # print(type(response)) json_re...
code_fim
hard
{ "lang": "python", "repo": "jiaxiaochu/spider", "path": "/06-About_json/1-qq_music.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: WarlingZhang/pytools path: /test_mysql.py import pymysql conn = None cur = None try: conn = pymysql.connect(host='127.0.0.1', port=3306, user='root', passwd='ro<|fim_suffix|>nt # row_number = cur.rownumber for r in cur.fetchall(): print("userId is %s, userName is %s" % r) ex...
code_fim
medium
{ "lang": "python", "repo": "WarlingZhang/pytools", "path": "/test_mysql.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nt # row_number = cur.rownumber for r in cur.fetchall(): print("userId is %s, userName is %s" % r) except Exception as e: print(e) finally: if cur is not None: cur.close() if conn is not None: conn.close()<|fim_prefix|># repo: WarlingZhang/pytools path: /test_m...
code_fim
medium
{ "lang": "python", "repo": "WarlingZhang/pytools", "path": "/test_mysql.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ahopkins/sanic-jwt path: /tests/test_decorators.py from sanic import Sanic from sanic.blueprints import Blueprint from sanic.response import html, json, text from sanic_jwt import Initialize from sanic_jwt.decorators import inject_user, protected, scoped def test_forgotten_initialized_on_prote...
code_fim
hard
{ "lang": "python", "repo": "ahopkins/sanic-jwt", "path": "/tests/test_decorators.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert response.json.get("me").get("user_id") == 1 _, response = sanic_app.test_client.get( "/protected/user", headers={"Authorization": "Bearer {}".format(access_token)}, ) assert response.status == 200 assert response.json.get("user_id") == 1 def test_inject_user_o...
code_fim
hard
{ "lang": "python", "repo": "ahopkins/sanic-jwt", "path": "/tests/test_decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @sanic_app.route("/protected/user") @sanic_jwt.inject_user() @sanic_jwt.protected() def my_protected_user(request, user): return json({"user_id": user.user_id}) access_token = response.json.get( sanic_jwt.config.access_token_name(), None ) _, response = sanic_...
code_fim
hard
{ "lang": "python", "repo": "ahopkins/sanic-jwt", "path": "/tests/test_decorators.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>row(['Vadachennai',2018]) csv_writer.writerow(['Naran',2007])<|fim_prefix|># repo: jisshub/learning_python3 path: /CSV MODULE - reader and writer/writer.py from csv import writer with open("movies.csv","w") as file: csv_writer=writer(file) csv_writer.writerow(['Name','Year']) <|fim_middle|> ...
code_fim
medium
{ "lang": "python", "repo": "jisshub/learning_python3", "path": "/CSV MODULE - reader and writer/writer.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jisshub/learning_python3 path: /CSV MODULE - reader and writer/writer.py from csv import writer with open("movies.csv","w") as file: <|fim_suffix|> csv_writer.writerow(['Ratchasan',2018]) csv_writer.writerow(['Vadachennai',2018]) csv_writer.writerow(['Naran',2007])<|fim_middle|>cs...
code_fim
medium
{ "lang": "python", "repo": "jisshub/learning_python3", "path": "/CSV MODULE - reader and writer/writer.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: actuallyachraf/superstark path: /superstark/merkle.py """ Merkle: Implementation of Merkle Trees over Blake2 """ from typing import List, Any from hashlib import blake2b class Merkle: """ We consider the merkle tree as a commitment protocol implementing the interface: * commit_(...
code_fim
hard
{ "lang": "python", "repo": "actuallyachraf/superstark", "path": "/superstark/merkle.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert len(leafs) & (len(leafs) - 1) == 0, "List must be of a power two length" assert 0 <= index and index < len(leafs) if len(leafs) == 2: return [leafs[1 - index]] elif index < (len(leafs) / 2): return Merkle.open_(index, leafs[: (len(leafs) // 2)...
code_fim
hard
{ "lang": "python", "repo": "actuallyachraf/superstark", "path": "/superstark/merkle.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tazexpress24/AdvanceData path: /hawaii_api.py import datetime as dt import numpy as np import pandas as pd import sqlalchemy from sqlalchemy.ext.automap import automap_base from sqlalchemy.orm import Session from sqlalchemy import create_engine, func from flask import Flask, jsonify, render_tem...
code_fim
hard
{ "lang": "python", "repo": "tazexpress24/AdvanceData", "path": "/hawaii_api.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@app.route('/api/v1.0/tobs') def tobs(): """Return a json list of Temperature Observations (tobs) for the previous year""" prev_year = dt.date.today() - dt.timedelta(days=365) # date_string = prev_year.strftime("%Y-%m-%d") tobsquery = session.query(Measurement.tobs).filter(Measurement.date >= prev_y...
code_fim
hard
{ "lang": "python", "repo": "tazexpress24/AdvanceData", "path": "/hawaii_api.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ambani07/aparaApi path: /api/models.py from django.db import models from django.contrib.auth.models import User from django.core.validators import MaxValueValidator, MinValueValidator class Person(models.Model): <|fim_suffix|> sum = 0 ratings = Rating.objects.filter(product=self) ...
code_fim
hard
{ "lang": "python", "repo": "Ambani07/aparaApi", "path": "/api/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Rating(models.Model): product = models.ForeignKey(Product, on_delete=models.CASCADE) user = models.ForeignKey(User, on_delete=models.CASCADE) stars = models.IntegerField(validators=[MinValueValidator(1), MaxValueValidator(5)]) class Meta: unique_together = (('user', 'product...
code_fim
hard
{ "lang": "python", "repo": "Ambani07/aparaApi", "path": "/api/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> sum = 0 ratings = Rating.objects.filter(product=self) for rating in ratings: sum += rating.stars if len(ratings) > 0: return sum / len(ratings) else: return 0 class Rating(models.Model): product = models.ForeignKey(Product, o...
code_fim
hard
{ "lang": "python", "repo": "Ambani07/aparaApi", "path": "/api/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: NMTCC/puppet-elws path: /site/profiles/files/CentOS/config/7/config/forge/modules/overlays #!/usr/bin/env python import remctl import json import datetime import time,random import argparse if __name__ == '__main__': parser = argparse.ArgumentParser( description = "List all TCC Forge overlay...
code_fim
medium
{ "lang": "python", "repo": "NMTCC/puppet-elws", "path": "/site/profiles/files/CentOS/config/7/config/forge/modules/overlays", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>list','{"group":"tcc","distro":"F19"}') c = remctl.remctl(host = 'update.nmt.edu', command=command) r = json.loads(c.stdout) for overlay in r: print overlay["name"]<|fim_prefix|># repo: NMTCC/puppet-elws path: /site/profiles/files/CentOS/config/7/config/forge/modules/overlays #!/usr/bin/env python ...
code_fim
hard
{ "lang": "python", "repo": "NMTCC/puppet-elws", "path": "/site/profiles/files/CentOS/config/7/config/forge/modules/overlays", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>m wait' ) cmdlineopts = parser.parse_args() if cmdlineopts.now: timeout = random.randint(0, 2 * 60 * 10) * 0.1 time.sleep(timeout) command = ('forge','overlay','list','{"group":"tcc","distro":"F19"}') c = remctl.remctl(host = 'update.nmt.edu', command=command) r = json.loads(c.stdout) for overl...
code_fim
medium
{ "lang": "python", "repo": "NMTCC/puppet-elws", "path": "/site/profiles/files/CentOS/config/7/config/forge/modules/overlays", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>int(f"{no}--->{rev} Input is not a palindrome")<|fim_prefix|># repo: rahmah18/HacktoberFest2021-1 path: /check_palindrome.py no = int(input("Enter a number: ")) no = str(no) rev = no[::-1] if no==rev: print(f"{no}<|fim_middle|>--->{rev} Input is a palindrome") else: pr
code_fim
easy
{ "lang": "python", "repo": "rahmah18/HacktoberFest2021-1", "path": "/check_palindrome.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: rahmah18/HacktoberFest2021-1 path: /check_palindrome.py no = int(input("Enter a number: ")) no = str(n<|fim_suffix|>--->{rev} Input is a palindrome") else: print(f"{no}--->{rev} Input is not a palindrome")<|fim_middle|>o) rev = no[::-1] if no==rev: print(f"{no}
code_fim
easy
{ "lang": "python", "repo": "rahmah18/HacktoberFest2021-1", "path": "/check_palindrome.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ScienceKot/DSL-PROJECT path: /flask app/migrations/versions/0bb5933fe69f_.py """empty message Revision ID: 0bb5933fe69f Revises: 09c6fdb3cf81 Create Date: 2021-03-11 16:48:06.771046 <|fim_suffix|> # ### commands auto generated by Alembic - please adjust! ### op.drop_constraint(None, 'use...
code_fim
hard
{ "lang": "python", "repo": "ScienceKot/DSL-PROJECT", "path": "/flask app/migrations/versions/0bb5933fe69f_.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: quewentian/PolicyTextAnalysis path: /policyContentExtract.py #####################将政策文件中的内容抽取出来:标准、伦理、 3部分内容########################## ###########step 1:把3部分内容找到近义词,组成一个词表###### ###########step 2:把文件与词表相匹配,判断文件到底在讲啥###### from nltk.corpus import wordnet as wn import os import codecs # goods...
code_fim
hard
{ "lang": "python", "repo": "quewentian/PolicyTextAnalysis", "path": "/policyContentExtract.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if ethic_prob>ethic_max_prob: ethic_max_prob=ethic_prob if standard_prob>standard_max_prob: standard_max_prob=standard_prob if privacy_prob>privacy_max_prob: privacy_max...
code_fim
hard
{ "lang": "python", "repo": "quewentian/PolicyTextAnalysis", "path": "/policyContentExtract.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def newImg(): x = 0 arr = [] tmp = "" for i in range(len(result)): tmp = tmp + str(result[x]) if(x < len(result)): x+=1 else: break arr = wrap(''.join(tmp), 1) print(arr) size = 5 dt = struct.pack('B'*le...
code_fim
hard
{ "lang": "python", "repo": "furret3/steganography", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: furret3/steganography path: /main.py import pathlib, binascii from textwrap import wrap from PIL import Image import struct def loadFile(): global data x = 0 data = [] subs = ["image", "text file"] exts = [".jpg", ".txt"] while x < 2: check = pathlib.P...
code_fim
hard
{ "lang": "python", "repo": "furret3/steganography", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>res = zr(pathname,prob) res.read_rcf() res.read_his() tx = [67] tsteps = [] for kt,step in enumerate(res.steps): if step.conv_status in [-1]: if step.time in tx: tsteps.append(kt) res.out_steps = tsteps res.read_dat() res.read_s00() for lab in res.ele_group_labels: if lab=='VOL...
code_fim
medium
{ "lang": "python", "repo": "mattpre/tool_browser", "path": "/scripts/zsoil_post/vtk/write_vtk_outline.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mattpre/tool_browser path: /scripts/zsoil_post/vtk/write_vtk_outline.py # @description Exporting outline (boundary faces) of zsoil results to vtu # @input zsoil results # @output vtu unstructured grid # @author Matthias Preisig # @date 2017/10/10 import numpy as np from zsoil_tools import zsoil...
code_fim
medium
{ "lang": "python", "repo": "mattpre/tool_browser", "path": "/scripts/zsoil_post/vtk/write_vtk_outline.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ##vtktools.write_vtu(res,beams=True,verbose=False) ##vtktools.write_vtu(res,trusses=True,verbose=False) vtktools.write_vtu(res,vol=True,verbose=False,outline=True) ##vtktools.write_vtu(res,shells=True,verbose=False)<|fim_prefix|># repo: mattpre/tool_browser path: /scripts/zsoil_post/vtk/write_vtk_outlin...
code_fim
hard
{ "lang": "python", "repo": "mattpre/tool_browser", "path": "/scripts/zsoil_post/vtk/write_vtk_outline.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ramjondhale/plant-disease path: /app.py import streamlit as st import tensorflow.keras from PIL import Image, ImageOps import numpy as np st.set_option('deprecation.showfileUploaderEncoding', False) np.set_printoptions(suppress=True) model = tensorflow.keras.models.load_model('keras_model.h5') da...
code_fim
hard
{ "lang": "python", "repo": "ramjondhale/plant-disease", "path": "/app.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> image_array = np.asarray(image) #image.show() st.image(image, caption='Uploaded Image.', width=300) normalized_image_array = (image_array.astype(np.float32) / 127.0) - 1 data[0] = normalized_image_array prediction = model.predict(data) data = np.rint(prediction) print(data)...
code_fim
hard
{ "lang": "python", "repo": "ramjondhale/plant-disease", "path": "/app.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x = np.zeros((3,1)) x[0,0] = -1*x_skew[1,2] x[1,0] = x_skew[0,2] x[2,0] = -1*x_skew[0,1] return x<|fim_prefix|># repo: dominikjurinic/geometric-integrator path: /python-implementation/SO3_to_R3.py import numpy as np <|fim_middle|>def SO3_to_R3(x_skew):
code_fim
easy
{ "lang": "python", "repo": "dominikjurinic/geometric-integrator", "path": "/python-implementation/SO3_to_R3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dominikjurinic/geometric-integrator path: /python-implementation/SO3_to_R3.py import numpy as np <|fim_suffix|> x = np.zeros((3,1)) x[0,0] = -1*x_skew[1,2] x[1,0] = x_skew[0,2] x[2,0] = -1*x_skew[0,1] return x<|fim_middle|>def SO3_to_R3(x_skew):
code_fim
easy
{ "lang": "python", "repo": "dominikjurinic/geometric-integrator", "path": "/python-implementation/SO3_to_R3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def addPercentileMessageToDB(): data = store.mapStore("data") states_walking = filters.filterStates(data[1:, :]) states_driving = filters.filterStates(data[1:, :], "driving") states_transit = filters.filterStates(data[1:, :], "transit") underq1, overq1, percentile_walking_25 = filters.filterPerc...
code_fim
hard
{ "lang": "python", "repo": "MarcelGeo/python-messages-apple-mobility", "path": "/tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarcelGeo/python-messages-apple-mobility path: /tasks.py import numpy as np from datetime import date, timedelta, datetime from pytz import timezone import store import psycopg2 import requests import os import filters FIRST = 4 def prepareDate(): pc_tz = timezone('US/Pacific') n = datetime...
code_fim
hard
{ "lang": "python", "repo": "MarcelGeo/python-messages-apple-mobility", "path": "/tasks.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: xiaolin0199/bbt path: /apps/BanBanTong/commands/management/commands/start_tasks.py #!/usr/bin/env python # coding=utf-8 from django.core.management.base import BaseCommand from BanBanTong.utils import task_scheduler <|fim_suffix|> task_scheduler.start()<|fim_middle|> class Command(BaseCom...
code_fim
medium
{ "lang": "python", "repo": "xiaolin0199/bbt", "path": "/apps/BanBanTong/commands/management/commands/start_tasks.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> task_scheduler.start()<|fim_prefix|># repo: xiaolin0199/bbt path: /apps/BanBanTong/commands/management/commands/start_tasks.py #!/usr/bin/env python # coding=utf-8 from django.core.management.base import BaseCommand from BanBanTong.utils import task_scheduler class Command(BaseCommand): '''...
code_fim
easy
{ "lang": "python", "repo": "xiaolin0199/bbt", "path": "/apps/BanBanTong/commands/management/commands/start_tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: columbustech/label-debugger path: /web.py/v6/brute_force.py ''' Created on Mar 7, 2019 @author: hzhang0418 ''' import pymp from v6.mono import Mono class BruteForce(Mono): def __init__(self, features, labels, params): super(BruteForce, self).__init__(features, labels, params)...
code_fim
hard
{ "lang": "python", "repo": "columbustech/label-debugger", "path": "/web.py/v6/brute_force.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if count>0: local_index2incons_count[mi] = count threads2incons_count[p.thread_num] = local_index2incons_count for _, local_index2incons_count in threads2incons_count.items(): for inde...
code_fim
hard
{ "lang": "python", "repo": "columbustech/label-debugger", "path": "/web.py/v6/brute_force.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimtsai23/Amortized-Flow-Posterior-Variational-Recurrent-Autoencoder path: /duc/preprocess.py import requests import os import numpy as np from bs4 import BeautifulSoup from nltk import word_tokenize from collections import Counter import random from utils import save_pickle root = 'data' rati...
code_fim
hard
{ "lang": "python", "repo": "jimtsai23/Amortized-Flow-Posterior-Variational-Recurrent-Autoencoder", "path": "/duc/preprocess.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> num_samples = len(data) for split, ratio in ratios: with open(os.path.join(root, "%s.txt"%split), 'w') as f: length = int(num_samples * ratio) f.write('\n'.join(data[:length])) data = data[length:] print("Building vocabulary from DUC data") counter ...
code_fim
hard
{ "lang": "python", "repo": "jimtsai23/Amortized-Flow-Posterior-Variational-Recurrent-Autoencoder", "path": "/duc/preprocess.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Rakhee06/Weather-Forecasting path: /classification.py <<<<<<< HEAD """Module docstring""" import os import numpy as np from sklearn.discriminant_analysis import LinearDiscriminantAnalysis from sklearn.model_selection import cross_val_score from sklearn.model_selection import KFold from sklearn.me...
code_fim
hard
{ "lang": "python", "repo": "Rakhee06/Weather-Forecasting", "path": "/classification.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }