text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> work = (inline_install(customer) for customer in customers) coop = task.Cooperator() # every time get 5 jobs as a batch join = defer.DeferredList([coop.coiterate(work) for i in range(5)]) join.addCallback(lambda _: reactor.stop()) print("Bye from Twisted developer!") twisted_deve...
code_fim
medium
{ "lang": "python", "repo": "Bingwen-Hu/hackaway", "path": "/books/learnScrapy/twisted/twisted_coordiate.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikesparr/helpscout-to-hubspot-migration path: /helpscout_to_hubspot/loader.py # loading via CSV for Hubspot # https://knowledge.hubspot.com/articles/kcs_article/contacts/associate-records-via-import <|fim_suffix|> return "See the README file for instructions on loading"<|fim_middle|>def help...
code_fim
easy
{ "lang": "python", "repo": "mikesparr/helpscout-to-hubspot-migration", "path": "/helpscout_to_hubspot/loader.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> return "See the README file for instructions on loading"<|fim_prefix|># repo: mikesparr/helpscout-to-hubspot-migration path: /helpscout_to_hubspot/loader.py # loading via CSV for Hubspot # https://knowledge.hubspot.com/articles/kcs_article/contacts/associate-records-via-import <|fim_middle|>def help...
code_fim
easy
{ "lang": "python", "repo": "mikesparr/helpscout-to-hubspot-migration", "path": "/helpscout_to_hubspot/loader.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> outcome_number = (roll1-1) * 5 + (roll2-1) + 1 # if we hit an extraneous # outcome we just re-roll if outcome_number > 21: continue # our outcome was fine. return it! return outcome_number % 7 + 1 print(rand7())<|fim_prefix|># repo: katchengl...
code_fim
medium
{ "lang": "python", "repo": "katchengli/tech-interview-prep", "path": "/interview_cake/ic38.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> while True: # do our die rolls roll1 = rand5() roll2 = rand5() outcome_number = (roll1-1) * 5 + (roll2-1) + 1 # if we hit an extraneous # outcome we just re-roll if outcome_number > 21: continue # our outcome was fine. re...
code_fim
medium
{ "lang": "python", "repo": "katchengli/tech-interview-prep", "path": "/interview_cake/ic38.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: katchengli/tech-interview-prep path: /interview_cake/ic38.py import random def rand5(): return random.randint(1, 5) # Does not work because it is not a uniform distribution of randomness def rand7bleh(): number = 0 while number < 1 or number > 23: number = rand5() + rand5()...
code_fim
medium
{ "lang": "python", "repo": "katchengli/tech-interview-prep", "path": "/interview_cake/ic38.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> with open(os.path.join(output_dir,"simfin.com.csv"), newline='') as csvfile: reader = list(csv.reader(csvfile, delimiter=',', quotechar='"')) assert len(reader) == 12 for a in range(1,len(reader)): assert reader[a][0] == files_to_be_found[a-1][0] asser...
code_fim
medium
{ "lang": "python", "repo": "Finance-Investissements/pdf-crawler", "path": "/unit-test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert os.path.isdir(output_dir) assert os.path.isfile(os.path.join(output_dir,"simfin.com.csv")) with open(os.path.join(output_dir,"simfin.com.csv"), newline='') as csvfile: reader = list(csv.reader(csvfile, delimiter=',', quotechar='"')) assert len(reader) == 12 fo...
code_fim
medium
{ "lang": "python", "repo": "Finance-Investissements/pdf-crawler", "path": "/unit-test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Finance-Investissements/pdf-crawler path: /unit-test.py import os from shutil import rmtree import csv import crawler # change this to your geckodriver path gecko_path = "/Applications/MAMP/htdocs/simfin-ml/geckodriver" output_dir = "unit_tests_files" def test_crawl_rendered_all(): file...
code_fim
medium
{ "lang": "python", "repo": "Finance-Investissements/pdf-crawler", "path": "/unit-test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pad_len = total_len - len(data) return data + pad_len * '\0' def sa_in4(addr, port=0): data = struct.pack("!H4s", port, addrconv.ipv4.text_to_bin(addr)) hdr = _hdr(_SIN_SIZE, socket.AF_INET) return _pad_to(hdr + data, _SIN_SIZE) def sa_in6(addr, port=0, flowinfo=0, scope_id=0): ...
code_fim
hard
{ "lang": "python", "repo": "faucetsdn/ryu", "path": "/ryu/lib/sockaddr.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: faucetsdn/ryu path: /ryu/lib/sockaddr.py # Copyright (C) 2014 Nippon Telegraph and Telephone Corporation. # Copyright (C) 2014 YAMAMOTO Takashi <yamamoto at valinux co jp> # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the...
code_fim
hard
{ "lang": "python", "repo": "faucetsdn/ryu", "path": "/ryu/lib/sockaddr.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _hdr(ss_len, af): if _HAVE_SS_LEN: return struct.pack(_HDR_FMT, ss_len, af) else: return struct.pack(_HDR_FMT, af) def _pad_to(data, total_len): pad_len = total_len - len(data) return data + pad_len * '\0' def sa_in4(addr, port=0): data = struct.pack("!H4s", po...
code_fim
hard
{ "lang": "python", "repo": "faucetsdn/ryu", "path": "/ryu/lib/sockaddr.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: devilry/devilry-django path: /devilry/utils/graphviz/djangomodels.py from inspect import getmodule import re from importlib import import_module from django.db.models import fields from django.db.models.base import ModelBase from .dot import UmlClassLabel, Association, Node, Edge, UmlField ...
code_fim
hard
{ "lang": "python", "repo": "devilry/devilry-django", "path": "/devilry/utils/graphviz/djangomodels.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> class ModelSet(set, GetIdMixin): """ A set containing django db models, with methods to ease creating a set of related models and all models in install apps. """ def __init__(self, pattern, *models): super(ModelSet, self).__init__(*models) self.patt = re.compile(pattern) ...
code_fim
hard
{ "lang": "python", "repo": "devilry/devilry-django", "path": "/devilry/utils/graphviz/djangomodels.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def add_installed_apps_models(self): from django.conf import settings for app in settings.INSTALLED_APPS: try: mod = import_module("%s.models" % app) except ImportError as e: continue for name in dir(mod): ...
code_fim
hard
{ "lang": "python", "repo": "devilry/devilry-django", "path": "/devilry/utils/graphviz/djangomodels.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> data = BatchOperator.fromDataframe(df, schemaStr="row double, col string, val double") op = TripleToCsvBatchOp()\ .setTripleRowCol("row")\ .setTripleColumnCol("col")\ .setTripleValueCol("val")\ .setCsvCol("csv")\ .setSche...
code_fim
medium
{ "lang": "python", "repo": "vacaly/Alink", "path": "/python/src/main/python/pyalink/alink/tests/examples/from_docs/test_tripletocsvbatchop.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vacaly/Alink path: /python/src/main/python/pyalink/alink/tests/examples/from_docs/test_tripletocsvbatchop.py import unittest from pyalink.alink import * import numpy as np import pandas as pd class TestTripleToCsvBatchOp(unittest.TestCase): <|fim_suffix|> df = pd.DataFrame([ [1...
code_fim
medium
{ "lang": "python", "repo": "vacaly/Alink", "path": "/python/src/main/python/pyalink/alink/tests/examples/from_docs/test_tripletocsvbatchop.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ''' Train decision tree :param self.all_syms: All permutations of input structures :param self.site_is_active: 0 if inactive, 1 if active ''' # Use this section for choosing hyperparameters self.classifier = tree.DecisionTr...
code_fim
hard
{ "lang": "python", "repo": "VlachosGroup/Structure-Optimization", "path": "/OML/train_surrogate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mat.rcParams['mathtext.default'] = 'regular' mat.rcParams['text.latex.unicode'] = 'False' mat.rcParams['legend.numpoints'] = 1 mat.rcParams['lines.linewidth'] = 2 mat.rcParams['lines.markersize'] = 12 plt.figure() ...
code_fim
hard
{ "lang": "python", "repo": "VlachosGroup/Structure-Optimization", "path": "/OML/train_surrogate.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VlachosGroup/Structure-Optimization path: /OML/train_surrogate.py # Read X and Y and train the neural network import numpy as np import matplotlib as mat import matplotlib.pyplot as plt from sklearn import tree from sklearn.neural_network import MLPClassifier from sklearn.neural_network import...
code_fim
hard
{ "lang": "python", "repo": "VlachosGroup/Structure-Optimization", "path": "/OML/train_surrogate.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nmayorov/pyins path: /pyins/tests/test_util.py import numpy as np from numpy.testing import assert_allclose from pyins import util <|fim_suffix|> vec = np.array([ [0, 1, 2], [-2, 3, 5] ]) check = np.array([ [-2, 3, 6], [0, -2, 3] ]) assert_allcl...
code_fim
medium
{ "lang": "python", "repo": "nmayorov/pyins", "path": "/pyins/tests/test_util.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> vec = np.array([ [0, 1, 2], [-2, 3, 5] ]) check = np.array([ [-2, 3, 6], [0, -2, 3] ]) assert_allclose(util.skew_matrix(vec[0]) @ check[0], np.cross(vec[0], check[0])) assert_allclose(util.skew_matrix(vec[1]) @ check[1], ...
code_fim
medium
{ "lang": "python", "repo": "nmayorov/pyins", "path": "/pyins/tests/test_util.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sidson1/Hacktoberfest-2022 path: /Algorithms/quicksort.py #QUICK SORT from sys import stdin, stdout # This function takes first element as pivot, places the pivot element at its correct position in sorted array, # and places all smaller (smaller than pivot) to left of pivot and all greater elem...
code_fim
hard
{ "lang": "python", "repo": "sidson1/Hacktoberfest-2022", "path": "/Algorithms/quicksort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == "__main__": ar = list(map(int, stdin.readline().split())) low, high = 0, len(ar)-1 QuickSort(ar, low, high) print(*ar)<|fim_prefix|># repo: sidson1/Hacktoberfest-2022 path: /Algorithms/quicksort.py #QUICK SORT from sys import stdin, stdout # This function takes first ele...
code_fim
hard
{ "lang": "python", "repo": "sidson1/Hacktoberfest-2022", "path": "/Algorithms/quicksort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def QuickSort(ar, low, high): if(len(ar) == 1): return (ar) if(low < high): j = partition(ar, low, high) QuickSort(ar, low, j-1) QuickSort(ar, j+1, high) if __name__ == "__main__": ar = list(map(int, stdin.readline().split())) low, high = 0, len(ar)-1 ...
code_fim
hard
{ "lang": "python", "repo": "sidson1/Hacktoberfest-2022", "path": "/Algorithms/quicksort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dileepsingh96/jupyterhub path: /docs/test_docs.py import sys from pathlib import Path from subprocess import run from ruamel.yaml import YAML yaml = YAML(typ="safe") here = Path(__file__).absolute().parent root = here.parent def test_rest_api_version(): version_py = root.joinpath("jupyte...
code_fim
medium
{ "lang": "python", "repo": "Dileepsingh96/jupyterhub", "path": "/docs/test_docs.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_restapi_scopes(): run([sys.executable, "source/rbac/generate-scope-table.py"], cwd=here, check=True) run( ['pre-commit', 'run', 'prettier', '--files', 'source/_static/rest-api.yml'], cwd=here, check=False, ) run( [ "git", "d...
code_fim
hard
{ "lang": "python", "repo": "Dileepsingh96/jupyterhub", "path": "/docs/test_docs.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': tcp_server_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) tcp_server_socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True) tcp_server_socket.bind(('', 9000)) tcp_server_socket.listen(128) while True: service_client_socket, ip_po...
code_fim
hard
{ "lang": "python", "repo": "youaresherlock/PythonPractice", "path": "/Foundation/socket/tcp_server.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: youaresherlock/PythonPractice path: /Foundation/socket/tcp_server.py #!usr/bin/python # -*- coding:utf8 -*- import socket import threading # 处理客户端的请求操作 def handle_client_request(service_client_socket, ip_port): <|fim_suffix|> if __name__ == '__main__': tcp_server_socket = socket.socket(sock...
code_fim
hard
{ "lang": "python", "repo": "youaresherlock/PythonPractice", "path": "/Foundation/socket/tcp_server.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: wso2/security-tools path: /external/django-DefectDojo-1.2.1/dojo/tools/dependencycheck/parser.py import hashlib from defusedxml import ElementTree from dojo.models import Finding import re class DependencyCheckParser(object): def get_field_value(self, parent_node, field_name): field...
code_fim
hard
{ "lang": "python", "repo": "wso2/security-tools", "path": "/external/django-DefectDojo-1.2.1/dojo/tools/dependencycheck/parser.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, filename, test): self.dupes = dict() self.items = () if filename is None: return content = filename.read() if content is None: return scan = ElementTree.fromstring(content) scan = ElementTree.fromst...
code_fim
hard
{ "lang": "python", "repo": "wso2/security-tools", "path": "/external/django-DefectDojo-1.2.1/dojo/tools/dependencycheck/parser.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.dupes = dict() self.items = () if filename is None: return content = filename.read() if content is None: return scan = ElementTree.fromstring(content) scan = ElementTree.fromstring(content) regex = r"{.*}" ...
code_fim
hard
{ "lang": "python", "repo": "wso2/security-tools", "path": "/external/django-DefectDojo-1.2.1/dojo/tools/dependencycheck/parser.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>### option 1 write_api = client.write_api() data = "mem,host=host1 used_percent=23.43234543 1556896326" attempt_1 = write_api.write("bucketID", c.env_vars["INFLUXDB"]["BUCKET"], data) ### ### option 2 point = Point("mem")\ .tag("host", "host1")\ .field("used_percent", 23.43234543) attempt_2 = write...
code_fim
medium
{ "lang": "python", "repo": "lazycoderio/Locator-Performance-v2", "path": "/influxdb.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lazycoderio/Locator-Performance-v2 path: /influxdb.py import influxdb_client from influxdb_client import InfluxDBClient from config import Config from influxdb_client import Point, WritePrecision from datetime import datetime <|fim_suffix|>### option 1 write_api = client.write_api() data = "me...
code_fim
medium
{ "lang": "python", "repo": "lazycoderio/Locator-Performance-v2", "path": "/influxdb.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>### option 2 point = Point("mem")\ .tag("host", "host1")\ .field("used_percent", 23.43234543) attempt_2 = write_api.write("bucketID", c.env_vars["INFLUXDB"]["BUCKET"], point) ### print(write_api.) print(attempt_1) print(attempt_2)<|fim_prefix|># repo: lazycoderio/Locator-Performance-v2 path: /influ...
code_fim
medium
{ "lang": "python", "repo": "lazycoderio/Locator-Performance-v2", "path": "/influxdb.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: guillefix/nn-pacbayes path: /sandbox/sandbox_comp_bool.py from complexities import calc_KC funs=["10001000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "111111111111111111111111111111110101111101111111011111110111111111...
code_fim
hard
{ "lang": "python", "repo": "guillefix/nn-pacbayes", "path": "/sandbox/sandbox_comp_bool.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>011111111111111111111111111111111101010101010101010101010101010101", "00110011001100110000000000000000001100110011001100000000000000000000000000000000000000000000000000000000000000000000000000000000", "00001111000011110000111100001111000011110000111100001111000011111111111111111111111111111111111111111111...
code_fim
hard
{ "lang": "python", "repo": "guillefix/nn-pacbayes", "path": "/sandbox/sandbox_comp_bool.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ld(default="", max_length=32, verbose_name="创建者")), ("updated_at", models.DateTimeField(auto_now=True, db_index=True, null=True, verbose_name="更新时间")), ("updated_by", models.CharField(blank=True, default="", max_length=32, verbose_name="修改者")), ("is_deleted"...
code_fim
hard
{ "lang": "python", "repo": "jiazhizhong/bk-log", "path": "/apps/log_databus/migrations/0016_archiveconfig_restoreconfig.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiazhizhong/bk-log path: /apps/log_databus/migrations/0016_archiveconfig_restoreconfig.py # Generated by Django 2.2.6 on 2021-08-18 11:25 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("log_databus", "0015_auto_20210813_1148"), ...
code_fim
hard
{ "lang": "python", "repo": "jiazhizhong/bk-log", "path": "/apps/log_databus/migrations/0016_archiveconfig_restoreconfig.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lorenzo-bioinfo/ms_data_analysis path: /scripts/06_get_snps.py import requests import pandas as pd import re #importing snps(void columns are omitted) df = pd.read_excel('../database/db.xlsx', sheet_name = 'SM NM', usecols = 'LN:LV, LY, LZ, MC, MH, MN, MQ, MT, MZ, NA, NC, NF, NG, NL, NM, NO, NP, ...
code_fim
hard
{ "lang": "python", "repo": "lorenzo-bioinfo/ms_data_analysis", "path": "/scripts/06_get_snps.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>''' f = open('./data/snp/snp_info.tsv', 'w') f.write('id\tp\tfreq_p\tq\tfreq_q\n') for snp in snp_list: #formatting url to retrieve information about snp url = 'https://www.ncbi.nlm.nih.gov/snp/{}'.format(snp) #downloading html page with snp informations print('Downloading {} page'.format(snp)) page ...
code_fim
hard
{ "lang": "python", "repo": "lorenzo-bioinfo/ms_data_analysis", "path": "/scripts/06_get_snps.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SuperGandhi/Desktop-application-Tkinter path: /user.py #Importando librerias from tkinter import * from tkinter import messagebox from tkinter import ttk import sqlite3 from nltk import tree #Desarrollo del GUI root = Tk() root.title('Ferreteria El Tornillo Feliz') root.geometry("750x350") id...
code_fim
hard
{ "lang": "python", "repo": "SuperGandhi/Desktop-application-Tkinter", "path": "/user.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> item= tree.identify('item', event.x, event.y) id.set(tree.item(item,'text')) dni.set(tree.item(item,'values')[0]) name.set(tree.item(item,'values')[1]) address.set(tree.item(item,'values')[2]) phone.set(tree.item(item,'values')[3]) tree.bind('<Double-1>', select_on_click) def up...
code_fim
hard
{ "lang": "python", "repo": "SuperGandhi/Desktop-application-Tkinter", "path": "/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>l5 = Label(root, text= 'Dirección :') l5.place(x=50, y=70) e5 = Entry(root, textvariable=address, width=50) e5.place(x=115, y=70) l2 = Label(root, text= 'Teléfono :') l2.place(x=50, y=100) e2 = Entry(root, textvariable=phone, width=50) e2.place(x=115, y=100) # Botones b1=Button(root, text='Registrar'...
code_fim
hard
{ "lang": "python", "repo": "SuperGandhi/Desktop-application-Tkinter", "path": "/user.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: edeposit/cz-urnnbn-api path: /src/cz_urnnbn_api/xml_composer.py #! /usr/bin/env python # -*- coding: utf-8 -*- # # Interpreter version: python 2.7 # """ This module contains composers to allow creation of XML for URN:NBN, so you don't have to create XML by hand. See: - http://resolver.nkp.cz...
code_fim
hard
{ "lang": "python", "repo": "edeposit/cz-urnnbn-api", "path": "/src/cz_urnnbn_api/xml_composer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> root = odict[ "r:import": odict[ "@xmlns:r": "http://resolver.nkp.cz/v3/", "r:monograph": odict[ "r:titleInfo": odict[ "r:title": self.title, ], ], ] ] ...
code_fim
hard
{ "lang": "python", "repo": "edeposit/cz-urnnbn-api", "path": "/src/cz_urnnbn_api/xml_composer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Communication, CommunicationAdmin)<|fim_prefix|># repo: KristanArmstrong/CRM_Django_Project path: /crmapp/communications/admin.py from django.contrib import admin from .models import Communication <|fim_middle|>class CommunicationAdmin(admin.ModelAdmin): list_display = ('subject', '...
code_fim
medium
{ "lang": "python", "repo": "KristanArmstrong/CRM_Django_Project", "path": "/crmapp/communications/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KristanArmstrong/CRM_Django_Project path: /crmapp/communications/admin.py from django.contrib import admin from .models import Communication <|fim_suffix|> list_display = ('subject', 'uuid') admin.site.register(Communication, CommunicationAdmin)<|fim_middle|>class CommunicationAdmin(admin.Model...
code_fim
easy
{ "lang": "python", "repo": "KristanArmstrong/CRM_Django_Project", "path": "/crmapp/communications/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: TaihuLight/FINN path: /tests/transformation/streamline/test_absorb_opposite_transposes.py # Copyright (c) 2020, Xilinx # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * ...
code_fim
medium
{ "lang": "python", "repo": "TaihuLight/FINN", "path": "/tests/transformation/streamline/test_absorb_opposite_transposes.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> np.random.seed(0) input_shape = [1, 3, 4, 2] top_in = oh.make_tensor_value_info("top_in", TensorProto.FLOAT, input_shape) top_out = oh.make_tensor_value_info("top_out", TensorProto.FLOAT, input_shape) value_info = [oh.make_tensor_value_info("add_param_0", TensorProto.FLOAT, [1])] v...
code_fim
medium
{ "lang": "python", "repo": "TaihuLight/FINN", "path": "/tests/transformation/streamline/test_absorb_opposite_transposes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>import numpy as np import onnx.helper as oh from onnx import TensorProto from qonnx.core.modelwrapper import ModelWrapper from qonnx.transformation.infer_shapes import InferShapes import finn.core.onnx_exec as ox from finn.transformation.streamline.absorb import AbsorbConsecutiveTransposes @pytest.mark...
code_fim
medium
{ "lang": "python", "repo": "TaihuLight/FINN", "path": "/tests/transformation/streamline/test_absorb_opposite_transposes.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lucashsg77/HotelsScrapperDjangoApi path: /api/views.py from django.shortcuts import render from rest_framework import generics from .models import Hotel from .serializers import HotelSerializer <|fim_suffix|> queryset = Hotel.objects.all() serializer_class = HotelSerializer class HotelDetail(g...
code_fim
medium
{ "lang": "python", "repo": "lucashsg77/HotelsScrapperDjangoApi", "path": "/api/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> queryset = Hotel.objects.all() serializer_class = HotelSerializer<|fim_prefix|># repo: lucashsg77/HotelsScrapperDjangoApi path: /api/views.py from django.shortcuts import render from rest_framework import generics from .models import Hotel from .serializers import HotelSerializer <|fim_middle|># Creat...
code_fim
medium
{ "lang": "python", "repo": "lucashsg77/HotelsScrapperDjangoApi", "path": "/api/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: izot/smartserver-iot path: /apps/DCX Manager/src/P9000010600000000_4/profiles/groupCntrl.py # Copyright (C) 2013-2023 Echelon Corporation. All Rights Reserved. # Use of this code is subject to your compliance with the terms of the # Echelon IzoT(tm) Software Developer's Kit License Agreement whi...
code_fim
hard
{ "lang": "python", "repo": "izot/smartserver-iot", "path": "/apps/DCX Manager/src/P9000010600000000_4/profiles/groupCntrl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self): super().__init__( key=20011, scope=4 ) self.datapoints['iLocalOvrd'] = izot.resources.base.Profile.DatapointMember( doc="""Switch """, name='iLocalOvrd', profile=self, number=1, ...
code_fim
hard
{ "lang": "python", "repo": "izot/smartserver-iot", "path": "/apps/DCX Manager/src/P9000010600000000_4/profiles/groupCntrl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: adityadangeska/lmc-base-classes path: /skabase/SKASubarray/SKASubarray/__init__.py # -*- coding: utf-8 -*- # # This file is part of the SKASubarray project # # # """SKASubarray <|fim_suffix|>from . import release from .SKASubarray import SKASubarray, main __version__ = release.version __versio...
code_fim
easy
{ "lang": "python", "repo": "adityadangeska/lmc-base-classes", "path": "/skabase/SKASubarray/SKASubarray/__init__.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>from . import release from .SKASubarray import SKASubarray, main __version__ = release.version __version_info__ = release.version_info __author__ = release.author<|fim_prefix|># repo: adityadangeska/lmc-base-classes path: /skabase/SKASubarray/SKASubarray/__init__.py # -*- coding: utf-8 -*- # # This file...
code_fim
easy
{ "lang": "python", "repo": "adityadangeska/lmc-base-classes", "path": "/skabase/SKASubarray/SKASubarray/__init__.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: SecureThemAll/cb-repair path: /src/utils/test_result.py import re import signal pid_pattern = "# pid (\d{4,7})" polls_failed_pattern = "# polls failed: (\d{1,4})" pid_debug_pattern = "# \[DEBUG\] pid: (\d{1,7}), sig: (\d{1,2})" pid_process_pattern = "# Process generated signal \(pid: (\d{1,7}), ...
code_fim
hard
{ "lang": "python", "repo": "SecureThemAll/cb-repair", "path": "/src/utils/test_result.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match = re.search(pid_debug_pattern, self.result) match2 = re.search(pid_process_pattern, self.result) if match: self.pids.append(match.group(1)) self.sig = int(match.group(2)) elif match2: self.pids.append(match2.group(1)) s...
code_fim
hard
{ "lang": "python", "repo": "SecureThemAll/cb-repair", "path": "/src/utils/test_result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: darongliu/qacnn_1d path: /feature.py import os import numpy as np import jieba from fuzzysearch import find_near_matches from tqdm import tqdm from difflib import SequenceMatcher from sklearn.metrics.pairwise import cosine_similarity from sklearn.feature_extraction.text import CountVectorizer fr...
code_fim
hard
{ "lang": "python", "repo": "darongliu/qacnn_1d", "path": "/feature.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return accumulate_position/count def get_position_feat(context_no_space, question, options, valid_length, max_error, margin_error): pos_q = get_position(context_no_space, question, valid_length, max_error, margin_error) all_feat = [] for op in options: pos_op = get_position(contex...
code_fim
hard
{ "lang": "python", "repo": "darongliu/qacnn_1d", "path": "/feature.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># # append the string discription for the first site that matches # weeknum = l[row] # # o.append(datedict[weeknum]) # for s in np.arange(len(sites)): # tmp = list(timearray[s]) # try: # idx = tmp.index(we...
code_fim
hard
{ "lang": "python", "repo": "pipitone/datman", "path": "/bin/web-build.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pipitone/datman path: /bin/web-build.py #!/usr/bin/env python """ This builds a Github Pages site using the phantom (and possibly other) QC plots generated by datman, commits those changes, and finally pushes them up to github. This way, the online dashboards can be updated automatically. Usage:...
code_fim
hard
{ "lang": "python", "repo": "pipitone/datman", "path": "/bin/web-build.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return data # def read_subj_qc_database(base_path): # """ # """ # db = sqlite3.connect('{}/qc/subject-qc.db'.format(base_path)) # cur = db.cursor() # fmri_cols = parse_db_cols(cur, 'fmri') # dti_cols = parse_db_cols(cur, 'dti') # fmri_subj = get_subjects(cur, 'fmri') # ...
code_fim
hard
{ "lang": "python", "repo": "pipitone/datman", "path": "/bin/web-build.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pj0620/acca-video-series path: /accalib/table.py from manimlib.imports import * # not finished class Table(VGroup): CONFIG = { "col_widths_array": None, "first_row_height": None, "row_height": None, "col_alignment_array": None, "first_row_alignment_ar...
code_fim
medium
{ "lang": "python", "repo": "pj0620/acca-video-series", "path": "/accalib/table.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def build_table(self): pass def build_params(self): if self.col_widths_array is None: self.col_widths_array = [mob.get_width()*1.1 for mob in self.entries[1]]<|fim_prefix|># repo: pj0620/acca-video-series path: /accalib/table.py from manimlib.imports import * # not ...
code_fim
medium
{ "lang": "python", "repo": "pj0620/acca-video-series", "path": "/accalib/table.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: brianwilt/Interview path: /maze/maze.py from optparse import OptionParser import sys import random # Solve mazes generated from http://www.delorie.com/game-room/mazes/genmaze.cgi # Probably should make sure cells are size 2 class MazeSolver: maze = [] visited = [] person_emoji_list ...
code_fim
hard
{ "lang": "python", "repo": "brianwilt/Interview", "path": "/maze/maze.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> new_dir = (point[0]+1, point[1]) if self._is_open_space(new_dir): open_dirs.append(new_dir) new_dir = (point[0], point[1]-1) if self._is_open_space(new_dir): open_dirs.append(new_dir) new_dir = (point[0], point[1]+1) if self._is_ope...
code_fim
hard
{ "lang": "python", "repo": "brianwilt/Interview", "path": "/maze/maze.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: blocknetdx/cc-api-check path: /src/chain/rpc.py #!/usr/bin/env python3 # -*- coding: utf-8 -*- from typing import Union, List import decimal import logging import pprint from chain.source import ChainSource from chain.source import UTXO from util.authproxy import AuthServiceProxy log = loggin...
code_fim
hard
{ "lang": "python", "repo": "blocknetdx/cc-api-check", "path": "/src/chain/rpc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def rpc_getaddressutxos(self, addresses: list) -> list: """Returns all unspent outputs for an address (requires addressindex to be enabled) :return: rpc output """ return self._call_command(["getaddressutxos", {"addresses": addresses}]) def get_utxos(self, ticker...
code_fim
hard
{ "lang": "python", "repo": "blocknetdx/cc-api-check", "path": "/src/chain/rpc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: home-assistant/core path: /homeassistant/components/unifiprotect/models.py """The unifiprotect integration models.""" from __future__ import annotations from collections.abc import Callable, Coroutine from dataclasses import dataclass from enum import Enum import logging from typing import TYPE_...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/unifiprotect/models.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@dataclass class ProtectSetableKeysMixin(ProtectRequiredKeysMixin[T]): """Mixin for settable values.""" ufp_set_method: str | None = None ufp_set_method_fn: Callable[[T, Any], Coroutine[Any, Any, None]] | None = None async def ufp_set(self, obj: T, value: Any) -> None: """Set val...
code_fim
hard
{ "lang": "python", "repo": "home-assistant/core", "path": "/homeassistant/components/unifiprotect/models.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: laispa/2020.2-Projeto-Kokama-Wiki path: /scripts/planning_generator.py import json import sys import datetime class GithubUser: """Represent a github user from team 03 User is identified by a number, github username and name """ def __init__(self, number, username, name): ...
code_fim
hard
{ "lang": "python", "repo": "laispa/2020.2-Projeto-Kokama-Wiki", "path": "/scripts/planning_generator.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def print_sprint_time(self): self.f.write('## Tamanho da sprint\n\n') self.f.write('| Início da sprint | Término da Sprint | Duração |\n') self.f.write('|:---:|:---:|:---:|\n') self.f.write(f'| {self.sprint_start} | {self.sprint_end} | {self.sprint_duration} dias |\n') ...
code_fim
hard
{ "lang": "python", "repo": "laispa/2020.2-Projeto-Kokama-Wiki", "path": "/scripts/planning_generator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mimilazarova/dd2412_project_fixmatch_and_beyond path: /augment.py import tensorflow as tf import numpy as np from PIL import Image, ImageOps, ImageEnhance, ImageFilter class CTAugment: def __init__(self, n_classes, decay=0.99, threshold=0.85, depth=2, n_bins=17): self.decay = decay...
code_fim
hard
{ "lang": "python", "repo": "mimilazarova/dd2412_project_fixmatch_and_beyond", "path": "/augment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return aug_batch, batch_choices, batch_bins def update_weights(self, label, pred, choices, bins): label_one_hot = np.zeros(self.n_classes) label_one_hot[label] = 1 #tf.math.abs(label - pred) omega = 1 - 1 / (2 * self....
code_fim
hard
{ "lang": "python", "repo": "mimilazarova/dd2412_project_fixmatch_and_beyond", "path": "/augment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for k in range(self.depth): w = self.AUG_DICT[choices[k]]["weight"][0] # tmp = np.copy(w) w[bins[k]["bin"]] = self.decay * w[bins[k]["bin"]] + (1 - self.decay) * omega # print(tmp-w) if choices[k] == "rescale": w = self.A...
code_fim
hard
{ "lang": "python", "repo": "mimilazarova/dd2412_project_fixmatch_and_beyond", "path": "/augment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cdunn6754/cdunnSite path: /ticTacToe/tests.py from django.test import TestCase, Client import json from ticTacToe.views import MinimaxApiView # Create your tests here. class TestMinimax(TestCase): def setUp(self): <|fim_suffix|> """ Hit the minimax api and make sure the whole...
code_fim
hard
{ "lang": "python", "repo": "cdunn6754/cdunnSite", "path": "/ticTacToe/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Should be able to give it an empty ttt board and get a response of 0 for the first entry and then 4 """ # empty board board = "EEEEEEEEE" res = MinimaxApiView.get_next_move(board, 'O') self.assertEqual(res, 0) board = "OE...
code_fim
medium
{ "lang": "python", "repo": "cdunn6754/cdunnSite", "path": "/ticTacToe/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: asirobots/rclpy path: /rclpy/test/test_logging.py # Copyright 2017 Open Source Robotics Foundation, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://...
code_fim
hard
{ "lang": "python", "repo": "asirobots/rclpy", "path": "/rclpy/test/test_logging.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> message_was_logged = [] for i in range(5): message_was_logged.append(rclpy.logging.log( 'message_' + inspect.stack()[0][3] + '_' + str(i), LoggingSeverity.INFO, skip_first=True, )) self.assertEqual(message_was_...
code_fim
hard
{ "lang": "python", "repo": "asirobots/rclpy", "path": "/rclpy/test/test_logging.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pass @property @abstractmethod def key_id(self): pass @property @abstractmethod def key_type(self): pass @property def key_type_secmodule(self) -> int: vs_type = consts.VSKeyTypeS(self.key_type) t = consts.key_type_str_to_num_map.g...
code_fim
hard
{ "lang": "python", "repo": "kutashenko/virgil-iotkit", "path": "/tools/virgil-trust-provisioner/virgil_trust_provisioner/generators/keys/interface.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kutashenko/virgil-iotkit path: /tools/virgil-trust-provisioner/virgil_trust_provisioner/generators/keys/interface.py from abc import ABC, abstractmethod from virgil_trust_provisioner import consts class KeyGeneratorInterface(ABC): @abstractmethod def generate(self, *, ...
code_fim
hard
{ "lang": "python", "repo": "kutashenko/virgil-iotkit", "path": "/tools/virgil-trust-provisioner/virgil_trust_provisioner/generators/keys/interface.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @base.skip_test( 'SKIP_TRANSIENT_CLUSTER_TEST', message='Test for transient cluster was skipped.') def transient_cluster_testing(self, plugin_config, floating_ip_pool, internal_neutron_net): cluster_template_id = self.create_cluster_templat...
code_fim
hard
{ "lang": "python", "repo": "hortonworksqe/sahara", "path": "/sahara/tests/integration/tests/vanilla_transient_cluster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> internal_neutron_net): cluster_template_id = self.create_cluster_template( name='test-transient-cluster-template-vanilla', plugin_config=self.vanilla_config, description=('test cluster template for transient cluster ' ...
code_fim
hard
{ "lang": "python", "repo": "hortonworksqe/sahara", "path": "/sahara/tests/integration/tests/vanilla_transient_cluster.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hortonworksqe/sahara path: /sahara/tests/integration/tests/vanilla_transient_cluster.py # Copyright (c) 2014 Mirantis Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License ...
code_fim
hard
{ "lang": "python", "repo": "hortonworksqe/sahara", "path": "/sahara/tests/integration/tests/vanilla_transient_cluster.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>@register.filter(name="qtesturl") def qtesturl(question): qset = question.questionset return reverse("questionset", args=("test:%s" % qset.questionnaire.id, qset.sortid))<|fim_prefix|># repo: EbookFoundation/fef-questionnaire path: /questionnaire/templatetags/questionnaire...
code_fim
medium
{ "lang": "python", "repo": "EbookFoundation/fef-questionnaire", "path": "/questionnaire/templatetags/questionnaire.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> qset = question.questionset return reverse("questionset", args=("test:%s" % qset.questionnaire.id, qset.sortid))<|fim_prefix|># repo: EbookFoundation/fef-questionnaire path: /questionnaire/templatetags/questionnaire.py #!/usr/bin/python from django import template from dj...
code_fim
medium
{ "lang": "python", "repo": "EbookFoundation/fef-questionnaire", "path": "/questionnaire/templatetags/questionnaire.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: EbookFoundation/fef-questionnaire path: /questionnaire/templatetags/questionnaire.py #!/usr/bin/python from django import template from django.urls import reverse <|fim_suffix|> l = 2 + len(string.strip()) // 6 if l <= 4: return "span-4" if l <= 7: return "span-7" ...
code_fim
hard
{ "lang": "python", "repo": "EbookFoundation/fef-questionnaire", "path": "/questionnaire/templatetags/questionnaire.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: IITDU-BSSE06/ads-demystifying-the-logs-Arafat123-iit path: /assignment2/reducer.py #!/usr/bin/python import sys <|fim_suffix|> data_mapped = line.strip().split("\t") if len(data_mapped) != 2: continue ip, rest = data_mapped if '/assets/js/the-associates.js' in rest: Total=Total+...
code_fim
easy
{ "lang": "python", "repo": "IITDU-BSSE06/ads-demystifying-the-logs-Arafat123-iit", "path": "/assignment2/reducer.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data_mapped = line.strip().split("\t") if len(data_mapped) != 2: continue ip, rest = data_mapped if '/assets/js/the-associates.js' in rest: Total=Total+1 print str(Total)<|fim_prefix|># repo: IITDU-BSSE06/ads-demystifying-the-logs-Arafat123-iit path: /assignment2/reducer.py #!/usr/bin/pyt...
code_fim
easy
{ "lang": "python", "repo": "IITDU-BSSE06/ads-demystifying-the-logs-Arafat123-iit", "path": "/assignment2/reducer.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for _ in range(width): if random.randrange(1, 101) < cactus_change: cactus_output = cactus_output + ("C%02d" % (random.randrange(1, cactus_count + 1))) else: cactus_output = cactus_output + " " for _ in range(width): if random.randrange(1, 101) < aloe_change: aloe_ou...
code_fim
hard
{ "lang": "python", "repo": "JordyMoos/Talk-The-Tricks-of-Game-Programming-in-a-Pure-Functional-Language-Game-Version", "path": "/engine/dist/images/oredev/world-3/generate_environment.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JordyMoos/Talk-The-Tricks-of-Game-Programming-in-a-Pure-Functional-Language-Game-Version path: /engine/dist/images/oredev/world-3/generate_environment.py import random width = 24 rock_change = 4 cactus_change = 15 aloe_change = 30 rock_count = 5 cactus_count = 12 aloe_count = 15 <|fim_suffix|...
code_fim
medium
{ "lang": "python", "repo": "JordyMoos/Talk-The-Tricks-of-Game-Programming-in-a-Pure-Functional-Language-Game-Version", "path": "/engine/dist/images/oredev/world-3/generate_environment.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # iterables primes = (2, 3, 5, 7, 11) test2 = product(*primes) print(test2)<|fim_prefix|># repo: zubrik13/udacity_inter_py path: /lesson3-functional_programming/variadic_pos_args.py def product(*nums, start=1): running_product = start for number in nums: running_product *=...
code_fim
medium
{ "lang": "python", "repo": "zubrik13/udacity_inter_py", "path": "/lesson3-functional_programming/variadic_pos_args.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zubrik13/udacity_inter_py path: /lesson3-functional_programming/variadic_pos_args.py def product(*nums, start=1): running_product = start for number in nums: running_product *= number return running_product <|fim_suffix|> # iterables primes = (2, 3, 5, 7, 11) test2...
code_fim
medium
{ "lang": "python", "repo": "zubrik13/udacity_inter_py", "path": "/lesson3-functional_programming/variadic_pos_args.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Download model artifacts target_dir = download_model_folder(config) # Load model and tokenizer model, tokenizer = load_model(target_dir, config) # Run chatbot with GPT-2 run_chat(model, tokenizer, config) if __name__ == '__main__': main()<|fim_prefix|># repo: cerebroa...
code_fim
hard
{ "lang": "python", "repo": "cerebroai/AskIt", "path": "/interactive_bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Generate bot messages bot_message = generate_response(model, tokenizer, history, config) print("Bot >>>", bot_message) turn['bot_messages'].append(bot_message) def main(): # Script arguments can include path of the config arg_parser = argparse.ArgumentParser() ...
code_fim
hard
{ "lang": "python", "repo": "cerebroai/AskIt", "path": "/interactive_bot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cerebroai/AskIt path: /interactive_bot.py # Copyright (c) polakowo # Licensed under the MIT license. import configparser import argparse import logging from model import download_model_folder, load_model from decoder import generate_response # Enable logging logging.basicConfig(format='%(asc...
code_fim
hard
{ "lang": "python", "repo": "cerebroai/AskIt", "path": "/interactive_bot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ydl_opts = {} with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([yt_url])<|fim_prefix|># repo: v-user1098new/video_search path: /video_search/utils.py from __future__ import unicode_literals import youtube_dl <|fim_middle|>def download_youtube(yt_url, path, name):
code_fim
easy
{ "lang": "python", "repo": "v-user1098new/video_search", "path": "/video_search/utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: v-user1098new/video_search path: /video_search/utils.py from __future__ import unicode_literals import youtube_dl <|fim_suffix|> ydl_opts = {} with youtube_dl.YoutubeDL(ydl_opts) as ydl: ydl.download([yt_url])<|fim_middle|> def download_youtube(yt_url, path, name):
code_fim
easy
{ "lang": "python", "repo": "v-user1098new/video_search", "path": "/video_search/utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }