text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: TheZenMind07/Algo-Trader path: /app/algos/kc_pattern_scanner.py time import numpy as np import sys cwd = os.chdir("/home/rajkp/code/Projects/Django-Dashboard/boilerplate-code-django-dashboard/app/algos") #generate trading session access_token = open("access_token.txt",'r').read() key...
code_fim
hard
{ "lang": "python", "repo": "TheZenMind07/Algo-Trader", "path": "/app/algos/kc_pattern_scanner.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if candle_type(ohlc_df) == "maru_bozu_green": pattern = "maru_bozu_bullish" if candle_type(ohlc_df) == "maru_bozu_red": pattern = "maru_bozu_bearish" if trend(ohlc_df.iloc[:-1,:],7) == "uptrend" and candle_type(ohlc_df) == "hammer": pattern = "hangi...
code_fim
hard
{ "lang": "python", "repo": "TheZenMind07/Algo-Trader", "path": "/app/algos/kc_pattern_scanner.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ('COVID_19_Tracker', '0001_initial'), ] operations = [ migrations.AddField( model_name='global', name='date', field=models.DateTimeField(default=django.utils.timezone.now), ), ...
code_fim
medium
{ "lang": "python", "repo": "Subhrans/COVID-19_Tracker", "path": "/COVID_19_Tracker/migrations/0002_global_date.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('COVID_19_Tracker', '0001_initial'), ] operations = [ migrations.AddField( model_name='global', name='date', field=models.DateTimeField(default=django.utils.timezone.now), ), ...
code_fim
medium
{ "lang": "python", "repo": "Subhrans/COVID-19_Tracker", "path": "/COVID_19_Tracker/migrations/0002_global_date.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Subhrans/COVID-19_Tracker path: /COVID_19_Tracker/migrations/0002_global_date.py # Generated by Django 3.0.1 on 2021-01-19 16:59 import django.utils.timezone from django.db import migrations, models <|fim_suffix|> operations = [ migrations.AddField( model_name='global', ...
code_fim
medium
{ "lang": "python", "repo": "Subhrans/COVID-19_Tracker", "path": "/COVID_19_Tracker/migrations/0002_global_date.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> report_missed_translations = dictionary_report_name_getter(lang_id) for report in report_missed_translations: update_report_local_name(report['report_id'], report['lang_id'], report['dictionary_answer']) def report_parameters_autotranslate(lang_id): report_missed_translations = dictio...
code_fim
medium
{ "lang": "python", "repo": "arkadyorg/xmlptranslator", "path": "/dictionary.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: arkadyorg/xmlptranslator path: /dictionary.py #! /usr/bin/env python # -*- coding: utf-8 -*- from dblogic import dictionary_writer, dictionary_report_naming_miner, dictionary_report_parameters_miner, dictionary_report_name_getter, update_report_local_name, dictionary_report_parameters_getter, up...
code_fim
medium
{ "lang": "python", "repo": "arkadyorg/xmlptranslator", "path": "/dictionary.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tuhinsaud4614/tkinter_app_with_mysql path: /src/main.py # ! Author tuhinsaud@tuhinsaud # version: 1 import os from io import BytesIO from PIL import ImageTk, Image as PILImage import tkinter as tk from tkinter import * from tkinter import ttk, filedialog, messagebox import database_helper as db...
code_fim
hard
{ "lang": "python", "repo": "tuhinsaud4614/tkinter_app_with_mysql", "path": "/src/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> global product_name_txt global product_price_txt global category_variable product_name_txt.delete(0, "end") product_price_txt.delete(0, "end") category_variable.set(category[0]) def saveData(): global_product_data["name"] = str(product_name_txt.get()) if len(global_produc...
code_fim
hard
{ "lang": "python", "repo": "tuhinsaud4614/tkinter_app_with_mysql", "path": "/src/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>gth/2)%length)])): total += num print (total)<|fim_prefix|># repo: shogun21/adventofcode2017 path: /1/1b.py fp = open("input.dat", "r") line = fp.readline() total = 0 length = len(line) for i in range(length): <|fim_middle|>num = int(line[i]) if (num == int(line[int((i+len
code_fim
easy
{ "lang": "python", "repo": "shogun21/adventofcode2017", "path": "/1/1b.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shogun21/adventofcode2017 path: /1/1b.py fp = open("input.dat", "r") line = fp.readline() total = 0 length = len(line) for i in range(length): <|fim_suffix|>gth/2)%length)])): total += num print (total)<|fim_middle|>num = int(line[i]) if (num == int(line[int((i+len
code_fim
easy
{ "lang": "python", "repo": "shogun21/adventofcode2017", "path": "/1/1b.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: CBIIT/ctdc-data-processing path: /transformation_script/nucleic_acid.py import pandas as pd from transformation_script.property_function import rename_properties, remove_trailing_zero import os def nucleic_acid_transformation(nucleic_acid_file_name, log, input_files, output_folder): log.info...
code_fim
hard
{ "lang": "python", "repo": "CBIIT/ctdc-data-processing", "path": "/transformation_script/nucleic_acid.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input_file_name = os.path.splitext(input_files['nucleic_acid'])[0] output_file = os.path.join(output_folder, input_file_name + ".tsv") nucleic_acid_df.to_csv(output_file, sep = "\t", index = False)<|fim_prefix|># repo: CBIIT/ctdc-data-processing path: /transformation_script/nucleic_acid.py im...
code_fim
hard
{ "lang": "python", "repo": "CBIIT/ctdc-data-processing", "path": "/transformation_script/nucleic_acid.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: plvaliente/Trabajos-Academicos path: /Teoria de las Comunicaciones/net-sniffing/script.py #! /usr/bin/env python #For Python, this file uses encoding: utf-8 import sys import numpy as np import math as mat from tabulate import tabulate def esBroadcast(packet): return packet.dst == "ff:ff:ff:ff...
code_fim
hard
{ "lang": "python", "repo": "plvaliente/Trabajos-Academicos", "path": "/Teoria de las Comunicaciones/net-sniffing/script.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> p1 = np.percentile(informacionesOrdenadas, 25) p3 = np.percentile(informacionesOrdenadas, 75) distinguidosA = [] distinguidosB = [] for linea in tablaOrdenadaXInfo: if linea[2]<= p1: distinguidosA.append(linea[0]) elif linea[2]>= p3: distinguidosB.insert(0, linea[0]) ranking = [] i = ...
code_fim
hard
{ "lang": "python", "repo": "plvaliente/Trabajos-Academicos", "path": "/Teoria de las Comunicaciones/net-sniffing/script.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if ( int(sys.argv[2] )==1): print "Porcentaje de tráfico broadcast: " print "\t\t",str(float(cantidadBroadcast)/cantidadDePaquetes) + "%" print " " if(len(probabilidades)>0): print "¿Desea ver un ranking de los simbolos distinguidos?(S/N)" respuesta = "" while True: respuesta = raw_input...
code_fim
hard
{ "lang": "python", "repo": "plvaliente/Trabajos-Academicos", "path": "/Teoria de las Comunicaciones/net-sniffing/script.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Wattyyy/LeetCode path: /submissions/ransom-note/solution.py # https://leetcode.com/problems/ransom-note from collections import Counter <|fim_suffix|> def canConstruct(self, ransomNote: str, magazine: str) -> bool: r_cnt = Counter(ransomNote) m_cnt = Counter(magazine) ...
code_fim
easy
{ "lang": "python", "repo": "Wattyyy/LeetCode", "path": "/submissions/ransom-note/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> r_cnt = Counter(ransomNote) m_cnt = Counter(magazine) for key in r_cnt: if r_cnt[key] > m_cnt[key]: return False return True<|fim_prefix|># repo: Wattyyy/LeetCode path: /submissions/ransom-note/solution.py # https://leetcode.com/problems/ransom-...
code_fim
medium
{ "lang": "python", "repo": "Wattyyy/LeetCode", "path": "/submissions/ransom-note/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sys.path.append(here.parent) os.chdir(here.parent) from bar import Bar b = Bar('hello') #emit_signal('on_start') b.start() sleep(3) b.stop() #emit_signal('on_stop')<|fim_prefix|># repo: cfobel/multiprocessing___chdir_example path: /chdir_example/test_bar.py from time...
code_fim
medium
{ "lang": "python", "repo": "cfobel/multiprocessing___chdir_example", "path": "/chdir_example/test_bar.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cfobel/multiprocessing___chdir_example path: /chdir_example/test_bar.py from time import sleep from path import path here = path(__file__).abspath() <|fim_suffix|> from bar import Bar b = Bar('hello') #emit_signal('on_start') b.start() sleep(3) b.stop() #emit_signal...
code_fim
medium
{ "lang": "python", "repo": "cfobel/multiprocessing___chdir_example", "path": "/chdir_example/test_bar.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> from bar import Bar b = Bar('hello') #emit_signal('on_start') b.start() sleep(3) b.stop() #emit_signal('on_stop')<|fim_prefix|># repo: cfobel/multiprocessing___chdir_example path: /chdir_example/test_bar.py from time import sleep from path import path here = path(__file__)....
code_fim
medium
{ "lang": "python", "repo": "cfobel/multiprocessing___chdir_example", "path": "/chdir_example/test_bar.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: fraromesc/conceptos_raspberry path: /prueba_arduino.py import time import serial ser= serial.Serial("/dev/ttyACM0", baudrate=9600) <|fim_suffix|>except KeyboardInterrupt: print("\nInterrupcion por teclado") except ValueError as ve: print(ve) print("Otra interrupcion") finally: ser.clo...
code_fim
hard
{ "lang": "python", "repo": "fraromesc/conceptos_raspberry", "path": "/prueba_arduino.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>except KeyboardInterrupt: print("\nInterrupcion por teclado") except ValueError as ve: print(ve) print("Otra interrupcion") finally: ser.close()<|fim_prefix|># repo: fraromesc/conceptos_raspberry path: /prueba_arduino.py import time import serial ser= serial.Serial("/dev/ttyACM0", baudrate=9600...
code_fim
hard
{ "lang": "python", "repo": "fraromesc/conceptos_raspberry", "path": "/prueba_arduino.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ntust-Course/coper-files path: /courses/forms.py from django import forms from django.contrib.auth.models import User from courses.models import CourseFile, CourseInformation <|fim_suffix|> class Meta: model = CourseFile fields = ("cfile", "cfile_class", "cfile_year", "cfile...
code_fim
easy
{ "lang": "python", "repo": "Ntust-Course/coper-files", "path": "/courses/forms.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = CourseFile fields = ("cfile", "cfile_class", "cfile_year", "cfile_content") exlcude = ("uploader", "course", "cfile") def __init__(self, *args, **kwargs): super(CourseFilesForm, self).__init__(*args, **kwargs)<|fim_prefix|># repo: Ntust-Course/c...
code_fim
medium
{ "lang": "python", "repo": "Ntust-Course/coper-files", "path": "/courses/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> super(CourseFilesForm, self).__init__(*args, **kwargs)<|fim_prefix|># repo: Ntust-Course/coper-files path: /courses/forms.py from django import forms from django.contrib.auth.models import User from courses.models import CourseFile, CourseInformation class CourseFilesForm(forms.ModelForm): ...
code_fim
easy
{ "lang": "python", "repo": "Ntust-Course/coper-files", "path": "/courses/forms.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: TheJacksonLaboratory/gm-cells-chiadrop path: /scripts/9region_sort.py import pybedtools from pybedtools import BedTool import numpy as np from tqdm import tqdm import pandas as pd import multiprocessing from multiprocessing import Pool import functools import argparse # Process the given regio...
code_fim
hard
{ "lang": "python", "repo": "TheJacksonLaboratory/gm-cells-chiadrop", "path": "/scripts/9region_sort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># ipdb.set_trace() if CHR == FF[0]: # print(CHR,FF[0],'True') interval = [0,0,0,0] interval[0] = Temp[0] interval[1] = Temp[1] interval[2] = Temp[2] interval[3] = Temp[3] NumFrag = FF[4] Start = list(map(int, FF[1:3])) End = ...
code_fim
hard
{ "lang": "python", "repo": "TheJacksonLaboratory/gm-cells-chiadrop", "path": "/scripts/9region_sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Check for the left/right/both/none condition def Checkintersect(s1,s2,e1,e2): return (min(e1, e2) - max(s1, s2)) > 0 def inInterval(FF,Temp,Type,Length,CHR): # ipdb.set_trace() if CHR == FF[0]: # print(CHR,FF[0],'True') interval = [0,0,0,0] interval[0] = Temp[0] ...
code_fim
hard
{ "lang": "python", "repo": "TheJacksonLaboratory/gm-cells-chiadrop", "path": "/scripts/9region_sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p = re.compile('http(.*?)(png|jpg|jpeg|gif)', re.IGNORECASE) for line in lines: m = p.search(line) if m and 'readme' in m.group(): print(m.group()) for element in result: extractImages(element)<|fim_prefix|># repo: laalaguer/vechain-docs-legacy path: /getImages.p...
code_fim
medium
{ "lang": "python", "repo": "laalaguer/vechain-docs-legacy", "path": "/getImages.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: laalaguer/vechain-docs-legacy path: /getImages.py import os import re result = [] for root, dirs, files in os.walk('.'): for filename in files: if 'rst' == filename.split('.')[-1]: result.append(os.path.join(root, filename)) if 'md' == filename.split('.')[-1]: ...
code_fim
medium
{ "lang": "python", "repo": "laalaguer/vechain-docs-legacy", "path": "/getImages.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: agongee/prema_sim path: /test.py import os import csv import matplotlib.pyplot as plt import pandas as pd path = "./result" file_list = os.listdir(path) instance_list = [] scheduler_list = [] for i in file_list: if i.find("instance") != -1: instance_list.append(i) else:...
code_fim
hard
{ "lang": "python", "repo": "agongee/prema_sim", "path": "/test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> index = algo_num + mecha_num * 4 antt[index] += ser['ANTT'] stp[index] += ser['STP'] fairness[index] += ser['Fairness'] num[index] += 1 for i in range(8): if num[i] == 0: continue else: antt[i] /= num[i] stp[i] /= num[i]...
code_fim
hard
{ "lang": "python", "repo": "agongee/prema_sim", "path": "/test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: samgmansfield/PIMAP_System path: /pimap/pimapsensetcp.py """PIMAP Sense component that listens for TCP packets. PIMAP Sense TCP is a PIMAP Sense component that starts a multi-process server on a given host and port. PIMAP Sense TCP supports both IPv4 and IPv6. License: Author: Sam Mansfield """...
code_fim
hard
{ "lang": "python", "repo": "samgmansfield/PIMAP_System", "path": "/pimap/pimapsensetcp.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Terminates server processes and closes the socket. """ self.running.value = False # Empty queues or processes won't join. while not self.pimap_data_queue.empty(): self.pimap_data_queue.get() while not self.received_address_queue.empty(): self.received_address_queue.get() for wo...
code_fim
hard
{ "lang": "python", "repo": "samgmansfield/PIMAP_System", "path": "/pimap/pimapsensetcp.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>1, 1, 1000), ([1] * 1001, 1000, 1), ([9, 4, 3, 5, 6, 3, 4, 1, 8, 8, 1, 3, 8, 5, 2, 4, 2, 2, 9, 1, 6, 4, 5, 2, 7, 1, 3, 3, 4], 0, 29), ([7, 3, 9, 4, 6, 7, 8, 9, 3, 8, 7, 5, 2, 6, 8, 7, 2, 8, 6, 6, 7, 2, 3, 3, 9], 1, 2) ) ) def test_solution(n, sequence, expected): ass...
code_fim
medium
{ "lang": "python", "repo": "mlevesquedion/Coding-dojo-CSG", "path": "/n_back/test_solution.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlevesquedion/Coding-dojo-CSG path: /n_back/test_solution.py import pytest from solution import n_back @pytest.mark.parametrize( ('sequence', 'n', 'expected'), ( ([1, 1, 1, 1, 1], 1, 4), ([1, 1, 1, 1<|fim_suffix|>, 4, 6, 7, 8, 9, 3, 8, 7, 5, 2, 6, 8, 7, 2, 8, 6, 6,...
code_fim
hard
{ "lang": "python", "repo": "mlevesquedion/Coding-dojo-CSG", "path": "/n_back/test_solution.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyzhouhzau/Web_Crawler path: /craw_jobs/db.py #! usr/bin/env python3 # -*- coding:utf-8 -*- import pymongo from 抓取招聘信息.craw_jobs.setting import * client = pymongo.MongoClient(MONGO_URL) db = client[MONGO_DB] <|fim_suffix|> if db['zhilianzhaopin'].insert(result): print('插入数据库...
code_fim
easy
{ "lang": "python", "repo": "kyzhouhzau/Web_Crawler", "path": "/craw_jobs/db.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if db['zhilianzhaopin'].insert(result): print('插入数据库成功', result) return None<|fim_prefix|># repo: kyzhouhzau/Web_Crawler path: /craw_jobs/db.py #! usr/bin/env python3 # -*- coding:utf-8 -*- <|fim_middle|>import pymongo from 抓取招聘信息.craw_jobs.setting import * client = pymongo.MongoC...
code_fim
medium
{ "lang": "python", "repo": "kyzhouhzau/Web_Crawler", "path": "/craw_jobs/db.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def save_to_mongo(result): if db['zhilianzhaopin'].insert(result): print('插入数据库成功', result) return None<|fim_prefix|># repo: kyzhouhzau/Web_Crawler path: /craw_jobs/db.py #! usr/bin/env python3 # -*- coding:utf-8 -*- <|fim_middle|>import pymongo from 抓取招聘信息.craw_jobs.setting impor...
code_fim
medium
{ "lang": "python", "repo": "kyzhouhzau/Web_Crawler", "path": "/craw_jobs/db.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> # if there is no context_annotations else: # make it NULL # print("context_annotation is null") context_domain_array = None # PLACES # if tweet_place_id is not None if tweet_place_id is not None: ...
code_fim
hard
{ "lang": "python", "repo": "DavidRimar/TwitterETL_FullArchive_AcademicAPI", "path": "/TweetCollector_FullArchiveAPI/TweetLoader.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: DavidRimar/TwitterETL_FullArchive_AcademicAPI path: /TweetCollector_FullArchiveAPI/TweetLoader.py from sqlalchemy import create_engine from datetime import datetime from TweetCollector_FullArchiveAPI.Tables import Base, Tweet, Place from sqlalchemy.orm import sessionmaker from contextlib import c...
code_fim
hard
{ "lang": "python", "repo": "DavidRimar/TwitterETL_FullArchive_AcademicAPI", "path": "/TweetCollector_FullArchiveAPI/TweetLoader.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> JobDes = [] CompanyType = [] NumberStaff = [] Industry = [] for i in range(len(href)): web_sub = requests.get(href[i]) web_sub.encoding = 'GBK' dom_sub = etree.HTML(web_sub.text) job_des = dom_sub.xpath('//div[@class="tCompany_main"]//div[@class="bmsg jo...
code_fim
hard
{ "lang": "python", "repo": "hhongker/java", "path": "/笔记本电脑的东西/暑期线上培训/作业/5/大数据岗位人才招聘信息的分析与挖掘/大数据岗位人才招聘信息的分析与挖掘-数据&代码/get_info.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hhongker/java path: /笔记本电脑的东西/暑期线上培训/作业/5/大数据岗位人才招聘信息的分析与挖掘/大数据岗位人才招聘信息的分析与挖掘-数据&代码/get_info.py import requests import pandas as pd from lxml import etree import time url_pa = 'https://search.51job.com/list/000000,000000,0000,00,9,99,%25E6%2595%25B0%25E6%258D%25AE,2,' url_end = '.html?lang=c&pos...
code_fim
hard
{ "lang": "python", "repo": "hhongker/java", "path": "/笔记本电脑的东西/暑期线上培训/作业/5/大数据岗位人才招聘信息的分析与挖掘/大数据岗位人才招聘信息的分析与挖掘-数据&代码/get_info.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> """Initialize a command line set of subparsers with the add command. Args: subparsers: A collection of subparsers as defined by `argsparse`. """ # add add_p = subparsers.add_parser('add', description='Create a bundle from a .csv, .tsv, or a directory of files.') add_p.add_...
code_fim
hard
{ "lang": "python", "repo": "kyocum/disdat", "path": "/disdat/add.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def add_arg_parser(subparsers): """Initialize a command line set of subparsers with the add command. Args: subparsers: A collection of subparsers as defined by `argsparse`. """ # add add_p = subparsers.add_parser('add', description='Create a bundle from a .csv, .tsv, or a dire...
code_fim
medium
{ "lang": "python", "repo": "kyocum/disdat", "path": "/disdat/add.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kyocum/disdat path: /disdat/add.py # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
code_fim
medium
{ "lang": "python", "repo": "kyocum/disdat", "path": "/disdat/add.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # IDS search algorithm's outer function, iterating over depth_limited_search def iterative_deepening_search(problem): developed_counter = 0 for depth in range(1, 20): result, developed_counter_in_iteration, final_path_cost = depth_limited_search(problem, depth) developed_cou...
code_fim
hard
{ "lang": "python", "repo": "israelElad/AI", "path": "/ex1/solution/IDS_Searcher.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: israelElad/AI path: /ex1/solution/IDS_Searcher.py from Node import Node # IDS search algorithm's inner function def depth_limited_search(problem, limit): <|fim_suffix|># IDS search algorithm's outer function, iterating over depth_limited_search def iterative_deepening_search(problem): ...
code_fim
hard
{ "lang": "python", "repo": "israelElad/AI", "path": "/ex1/solution/IDS_Searcher.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 机器学习的问题大致可以分为分类问题和回归问题。分类问题是数据属于哪一个类别的问题。 # 比如,区分图像中的人是男性还是女性的问题就是分类问题。 # 而回归问题是根据某个输入预测一个(连续的)数值的问题。 # 比如,根据一个人的图像预测这个人的体重的问题就是回归问题(类似“57.4kg”这样的预测)<|fim_prefix|># repo: tangkangtai/pythonProject3 path: /book/1/函数tips.py # 一般,回归问题可以使用恒等函数,二元分类问题可以使用sigmoid函数, # 多元分类问题可以使用softmax函数 <|fim_middle|># --...
code_fim
easy
{ "lang": "python", "repo": "tangkangtai/pythonProject3", "path": "/book/1/函数tips.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tangkangtai/pythonProject3 path: /book/1/函数tips.py # 一般,回归问题可以使用恒等函数,二元分类问题可以使用sigmoid函数, # 多元分类问题可以使用softmax函数 <|fim_suffix|># 机器学习的问题大致可以分为分类问题和回归问题。分类问题是数据属于哪一个类别的问题。 # 比如,区分图像中的人是男性还是女性的问题就是分类问题。 # 而回归问题是根据某个输入预测一个(连续的)数值的问题。 # 比如,根据一个人的图像预测这个人的体重的问题就是回归问题(类似“57.4kg”这样的预测)<|fim_middle|># --...
code_fim
easy
{ "lang": "python", "repo": "tangkangtai/pythonProject3", "path": "/book/1/函数tips.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: planetodooofficial/time_tracker path: /hr_timesheet_task_domain/__manifest__.py { 'name': 'Task Log: limit Task by Project', 'version': '12.0.1.0.0', 'category': 'H<|fim_suffix|>n to tasks on currently-selected project' ), 'depends': [ 'hr_timesheet', ], }<|fim_mi...
code_fim
medium
{ "lang": "python", "repo": "planetodooofficial/time_tracker", "path": "/hr_timesheet_task_domain/__manifest__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>n to tasks on currently-selected project' ), 'depends': [ 'hr_timesheet', ], }<|fim_prefix|># repo: planetodooofficial/time_tracker path: /hr_timesheet_task_domain/__manifest__.py { 'name': 'Task Log: limit Task by Project', 'version': '12.0.1.0.0', 'category': 'Human Res...
code_fim
medium
{ "lang": "python", "repo": "planetodooofficial/time_tracker", "path": "/hr_timesheet_task_domain/__manifest__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>start = time.time() k = 200 b = 10000000 result = count(b,k) count = 0 print(time.time() - start) for i in result: if i >= 0 and i <= k: count += 1 print(count) print(time.time() - start)<|fim_prefix|># repo: chongliw/algorithm_py path: /fun/Zhijie_Collatz.py __author__ = "Zhijie Huang" imp...
code_fim
hard
{ "lang": "python", "repo": "chongliw/algorithm_py", "path": "/fun/Zhijie_Collatz.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chongliw/algorithm_py path: /fun/Zhijie_Collatz.py __author__ = "Zhijie Huang" import time def f(a): if a % 2 == 0: return a // 2 else: return 3 * a + 1 def count(b, k): <|fim_suffix|>start = time.time() k = 200 b = 10000000 result = count(b,k) count = 0 print(time.tim...
code_fim
hard
{ "lang": "python", "repo": "chongliw/algorithm_py", "path": "/fun/Zhijie_Collatz.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jstacoder/flask-angular-blog-example path: /phlaskr/api/__init__.py from flask import Flask,views,jsonify,request,make_response,json,g,redirect,abort,g,current_app from ..models import Comment,Post,Tag,Email,AppUser as User,PublicUser from itsdangerous import TimedJSONWebSignatureSerializer as si...
code_fim
hard
{ "lang": "python", "repo": "jstacoder/flask-angular-blog-example", "path": "/phlaskr/api/__init__.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def post(self): if 'application/json' in request.headers['Content-Type']: data = json.loads(request.data) else: data = dict(request.form.items()) print data if not user_exists(data['username']): if not email_exists(data['email']): ...
code_fim
hard
{ "lang": "python", "repo": "jstacoder/flask-angular-blog-example", "path": "/phlaskr/api/__init__.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> url(r'^add/(?P<id>\d+)$', views.add), url(r'^song/(?P<id>\d+)$', views.songUser), url(r'^show/(?P<id>\d+)$', views.showUser), ]<|fim_prefix|># repo: bmcconchie/playlist path: /apps/main_app/urls.py from django.conf.urls import url from . import views urlpatterns = [ <|fim_middle|>...
code_fim
medium
{ "lang": "python", "repo": "bmcconchie/playlist", "path": "/apps/main_app/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: bmcconchie/playlist path: /apps/main_app/urls.py from django.conf.urls import url from . import views urlpatterns = [ <|fim_suffix|>$', views.songUser), url(r'^show/(?P<id>\d+)$', views.showUser), ]<|fim_middle|> url(r'^$', views.main), url(r'^create$', views.create), ...
code_fim
medium
{ "lang": "python", "repo": "bmcconchie/playlist", "path": "/apps/main_app/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: cleoold/segmentation-fault path: /python3-ctypes/crashme/__init__.py import ctypes import pathlib <|fim_suffix|> c_crash_me() __all__ = [ 'crash_me' ]<|fim_middle|>libfile = ctypes.CDLL( # relative to this module file str(pathlib.Path(__file__).parent.absolute() / 'libcrashme.so') ) ...
code_fim
hard
{ "lang": "python", "repo": "cleoold/segmentation-fault", "path": "/python3-ctypes/crashme/__init__.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>c_crash_me = libfile.crash_me c_crash_me.argtypes = [] def crash_me() -> None: c_crash_me() __all__ = [ 'crash_me' ]<|fim_prefix|># repo: cleoold/segmentation-fault path: /python3-ctypes/crashme/__init__.py import ctypes import pathlib <|fim_middle|>libfile = ctypes.CDLL( # relative to this mo...
code_fim
medium
{ "lang": "python", "repo": "cleoold/segmentation-fault", "path": "/python3-ctypes/crashme/__init__.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>def crash_me() -> None: c_crash_me() __all__ = [ 'crash_me' ]<|fim_prefix|># repo: cleoold/segmentation-fault path: /python3-ctypes/crashme/__init__.py import ctypes import pathlib <|fim_middle|>libfile = ctypes.CDLL( # relative to this module file str(pathlib.Path(__file__).parent.absolute...
code_fim
medium
{ "lang": "python", "repo": "cleoold/segmentation-fault", "path": "/python3-ctypes/crashme/__init__.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ramesh960386/django-advance-workflow path: /daw/urls.py from django.conf.urls import patterns, url urlpatterns = patterns('daw.views', url( r'^init_object_approvements/(?P<content_type_id>[$a-zA-Z0-9]+)/(?P<obj_pk>[$a-zA-Z0-9]+)/(?P<state_field>[...
code_fim
hard
{ "lang": "python", "repo": "ramesh960386/django-advance-workflow", "path": "/daw/urls.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>te'), url( r'^get_state_by_label/(?P<label>[$a-zA-Z0-9]+)/?$', 'get_state_by_label'), url( r'^skip_transition/(?P<content_type_id>[$a-zA-Z0-9]+)/(?P<object_id>[$a-zA-Z0-9]+)/(?P<state_field>[$a-zA-Z0-9_]+)/...
code_fim
hard
{ "lang": "python", "repo": "ramesh960386/django-advance-workflow", "path": "/daw/urls.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for event in pygame.event.get(): if event.type == pygame.QUIT: run = False keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] and x > vel: x -= vel left = True right = False elif keys[pygame.K_RIGHT] and x < (win_width - width - vel...
code_fim
hard
{ "lang": "python", "repo": "abriggs914/Coding_Practice", "path": "/Python/Pygame/TechWithTim/intro_game/game_1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: abriggs914/Coding_Practice path: /Python/Pygame/TechWithTim/intro_game/game_1.py import pygame import math pygame.init() win_height = 480 win_width = 500 win = pygame.display.set_mode((win_width, win_height)) pygame.display.set_caption('First Game') x = 50 y = 400 width = 64 height = 64 vel = ...
code_fim
hard
{ "lang": "python", "repo": "abriggs914/Coding_Practice", "path": "/Python/Pygame/TechWithTim/intro_game/game_1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shannywu/digital-humanity path: /webcrawl/seCrawler/seCrawler/spiders/keywordSpider.py import scrapy from scrapy.spiders import Spider from seCrawler.common.searResultPages import searResultPages from seCrawler.common.searchEngines import SearchEngineResultSelectors from seCrawler.common.searchEn...
code_fim
hard
{ "lang": "python", "repo": "shannywu/digital-humanity", "path": "/webcrawl/seCrawler/seCrawler/spiders/keywordSpider.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> name = 'keywordSpider' allowed_domains = ['bing.com', 'google.com', 'baidu.com'] start_urls = [] keyword = None searchEngine = None selector = None maxpage = None def __init__(self, keyword, se='bing', maxpage=10): self.keyword = keyword.lower() self.search...
code_fim
medium
{ "lang": "python", "repo": "shannywu/digital-humanity", "path": "/webcrawl/seCrawler/seCrawler/spiders/keywordSpider.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, keyword, se='bing', maxpage=10): self.keyword = keyword.lower() self.searchEngine = se.lower() self.selector = SearchEngineResultSelectors[self.searchEngine] self.start_urls.append(SearchEngines[se].format(keyword, 1)) self.maxpage = maxpage ...
code_fim
hard
{ "lang": "python", "repo": "shannywu/digital-humanity", "path": "/webcrawl/seCrawler/seCrawler/spiders/keywordSpider.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: SHUKLA123/Medicine path: /testapp/migrations/0007_auto_20190303_1729.py # -*- coding: utf-8 -*- # Generated by Django 1.11 on 2019-03-03 11:59 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations =...
code_fim
hard
{ "lang": "python", "repo": "SHUKLA123/Medicine", "path": "/testapp/migrations/0007_auto_20190303_1729.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.CreateModel( name='Buy1', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('Medicine', models.CharField(max_length=30)), ('Company_Name'...
code_fim
hard
{ "lang": "python", "repo": "SHUKLA123/Medicine", "path": "/testapp/migrations/0007_auto_20190303_1729.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: juliepratx/Projets_Master_Bioinfo_Bordeaux path: /AssemblerADN/data_ADN_part1.py # -*- coding: utf-8 -*- """ Created on Mon Nov 18 10:07:36 2019 @author: Julie Crétion d'un fichier contenant la séquence d'ADN (brin sens et brin non sens) ainsi que les Read et leurs valeurs de qualité. ...
code_fim
hard
{ "lang": "python", "repo": "juliepratx/Projets_Master_Bioinfo_Bordeaux", "path": "/AssemblerADN/data_ADN_part1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>saveDicoBS("Dictionnaire_BS_OBI.txt") def saveDicoBNS(file): NomDuFichier = (file) Fichier = open(NomDuFichier,'w') # Crée un fichier *.txt en écriture Fichier.write(str(dico_readsNS)) # Ecrit le dictionnaire dans le fichier Fichier.close() saveDicoBNS("Dictionnaire_BNS_OB...
code_fim
hard
{ "lang": "python", "repo": "juliepratx/Projets_Master_Bioinfo_Bordeaux", "path": "/AssemblerADN/data_ADN_part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#adaptateursF(10) ############################################################################### # Sauvegarde dans un fichier # ############################################################################### """ Ces 5 procédures ont pour même argument...
code_fim
hard
{ "lang": "python", "repo": "juliepratx/Projets_Master_Bioinfo_Bordeaux", "path": "/AssemblerADN/data_ADN_part1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jpegbert/TensorFlow1.x path: /tf_save_model_and_load/demo1/save_and_load.py import tensorflow as tf import numpy as np """ https://www.jianshu.com/p/52e7ae04cecf 保存模型和加载模型 这种方法不方便的在于,在使用模型的时候,必须把模型的结构重新定义一遍,然后载入对应名字的变量的值。 """ <|fim_suffix|>def load(): W = tf.Variable(tf.truncated_normal(sh...
code_fim
hard
{ "lang": "python", "repo": "jpegbert/TensorFlow1.x", "path": "/tf_save_model_and_load/demo1/save_and_load.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> W = tf.Variable(tf.truncated_normal(shape=(2, 3)), dtype=tf.float32, name='w') b = tf.Variable(tf.truncated_normal(shape=(3,)), dtype=tf.float32, name='b') saver = tf.train.Saver() with tf.Session() as sess: saver.restore(sess, "save/model.ckpt") def main(): save() # loa...
code_fim
medium
{ "lang": "python", "repo": "jpegbert/TensorFlow1.x", "path": "/tf_save_model_and_load/demo1/save_and_load.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if email.max_send != None and recent_logs.count() + 1 >= email.max_send: email.active = False message = '%s\nYour price notification was activated due to price of $%s on %s.\n\n' % (str(now), ...
code_fim
hard
{ "lang": "python", "repo": "wayfarer/daybittrader", "path": "/base/dbtrade/apps/trader/tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: wayfarer/daybittrader path: /base/dbtrade/apps/trader/tasks.py from datetime import timedelta, datetime #from datetime import datetime from decimal import Decimal from pprint import pprint from django.conf import settings from django.core.mail import send_mail from celery.task import task from ...
code_fim
hard
{ "lang": "python", "repo": "wayfarer/daybittrader", "path": "/base/dbtrade/apps/trader/tasks.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print 'mtgox_price=%s' % mtgox_price print 'coinbase_price=%s' % coinbase_price print 'bitstamp_price=%s' % bitstamp_price mtgox_price = Decimal(mtgox_price) coinbase_price = Decimal(coinbase_price) bitstamp_price = Decimal(bitstamp_price) timedeltas = { ...
code_fim
hard
{ "lang": "python", "repo": "wayfarer/daybittrader", "path": "/base/dbtrade/apps/trader/tasks.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ingafter60/MaikaCRM path: /accounts/admin.py from django.contrib import admin # Register your models here. <|fim_suffix|>admin.site.register(Customer) admin.site.register(Tag) admin.site.register(Product) admin.site.register(Order)<|fim_middle|># from .models import Customer # from .models impo...
code_fim
medium
{ "lang": "python", "repo": "ingafter60/MaikaCRM", "path": "/accounts/admin.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>admin.site.register(Customer) admin.site.register(Tag) admin.site.register(Product) admin.site.register(Order)<|fim_prefix|># repo: ingafter60/MaikaCRM path: /accounts/admin.py from django.contrib import admin <|fim_middle|># Register your models here. # from .models import Customer # from .models impo...
code_fim
medium
{ "lang": "python", "repo": "ingafter60/MaikaCRM", "path": "/accounts/admin.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> existing_paths = [] for path in paths: try: os.makedirs(path) existing_paths += path except OSError as e: if e.errno != errno.EEXIST: raise else: existing_paths +...
code_fim
hard
{ "lang": "python", "repo": "mxmrlv/aREST", "path": "/arest/core.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: mxmrlv/aREST path: /arest/core.py import os import errno import aria as aria_ from aria import core as aria_core from aria.orchestrator import ( plugin, workflow_runner ) from aria.storage import sql_mapi from aria.storage import filesystem_rapi class AriaCore(): def __init__(sel...
code_fim
hard
{ "lang": "python", "repo": "mxmrlv/aREST", "path": "/arest/core.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self._plugin_manager.validate_plugin(source) self._plugin_manager.install(source) def create_service_template(self, path, name): aria_.install_aria_extensions() self._core.create_service_template(path, os.path.dirname(path), name) return str(self.model.service_...
code_fim
hard
{ "lang": "python", "repo": "mxmrlv/aREST", "path": "/arest/core.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x=np.array(sorted(x)) a=np.array(a) b=np.array(b) b_err=np.array(b_err) b_med = np.array(b_med) b_Q1 = np.array(b_Q1) b_Q3 = np.array(b_Q3) c=np.array(c) wa=np.array(wa) axes[0][i].set_title("N="+str(sizes[s])) if(not boxplot): axes[0][i].plot(x,b,c...
code_fim
hard
{ "lang": "python", "repo": "Nicambier/swarm-lingustics", "path": "/conceptual_model/perf.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Nicambier/swarm-lingustics path: /conceptual_model/perf.py # Libraries import numpy as np import matplotlib.pyplot as plt import matplotlib.ticker as ticker from scipy.stats import ranksums directory='com_range1_8n' start=1 qt=100 time=300000 boxplot = True #nValues=[0.001] sizes=[25,50,100,20...
code_fim
hard
{ "lang": "python", "repo": "Nicambier/swarm-lingustics", "path": "/conceptual_model/perf.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> a = [] b = [] b_err = [] b_med = [] b_Q1 = [] b_Q3 = [] c = [] wa = [] for z in range(len(y1)): a.append(np.mean(y1[z])) b.append(np.mean(y2[z])) b_err.append(np.std(y2[z])) b_med.append(np.median(y2[z])) b_Q1.append(np.percentil...
code_fim
hard
{ "lang": "python", "repo": "Nicambier/swarm-lingustics", "path": "/conceptual_model/perf.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def rotate_string(text, rot): encrypt_text = "" for character in text: encrypt_text += rotate_character(character, rot) return encrypt_text<|fim_prefix|># repo: linwang314/web-caesar path: /caesar.py def alphabet_position(letter): alphabet = "abcdefghijklmnopqrstuvwxyz" return...
code_fim
hard
{ "lang": "python", "repo": "linwang314/web-caesar", "path": "/caesar.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: linwang314/web-caesar path: /caesar.py def alphabet_position(letter): alphabet = "abcdefghijklmnopqrstuvwxyz" return alphabet.index(letter.lower()) def rotate_character(char, rot): alphabet = "abcdefghijklmnopqrstuvwxyz" if char.isalpha(): idx = (alphabet_position(char) +...
code_fim
medium
{ "lang": "python", "repo": "linwang314/web-caesar", "path": "/caesar.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def test_quicksort_list_with_just_one_element(): assert quicksort([1]) == [1] def test_quicksort_list_with_two_elements_already_sorted(): assert quicksort([1, 2]) == [1, 2] def test_quicksort_sort_2_1_in_1_2(): assert quicksort([2, 1]) == [1, 2] def test_quicksort_sort_2_3_1_in_1_2_3(): ...
code_fim
hard
{ "lang": "python", "repo": "lipemorais/py_to_hs", "path": "/test_presentation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def test_factorial2_of_3_is_6(): assert factorial2(3) == 6 def test_factorial2_of_4_is_24(): assert factorial2(4) == 24 # _map def test_map_plus_1_in_empty_list(): assert _map(lambda x: x + 1, []) == [] def test_map_plus_1_in_list_just_with_2(): assert _map(lambda x: x + 1, [1]) == [2] ...
code_fim
hard
{ "lang": "python", "repo": "lipemorais/py_to_hs", "path": "/test_presentation.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: lipemorais/py_to_hs path: /test_presentation.py from presentation import elem, elem2, factorial, factorial2, _map, _map2, quicksort # elem assert elem(1, [1,2]) == True assert elem(3, [1,2]) == False assert elem(4, [1,2]) == False assert elem(4, [4]) == True assert elem(1, []) == False # elem2...
code_fim
hard
{ "lang": "python", "repo": "lipemorais/py_to_hs", "path": "/test_presentation.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: tectronics/blogiscms path: /tools/Captcha.py # -*- coding: utf8 -*- # import Image, ImageDraw, ImageFont import random from cStringIO import StringIO import tornado from Base import BaseHandler class Captcha( BaseHandler ): def create_captcha( self, charNum, fontSize ): alphArr = ['...
code_fim
hard
{ "lang": "python", "repo": "tectronics/blogiscms", "path": "/tools/Captcha.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>height - 3 ) ), fill = ( random.randint( 70, 150 ), random.randint( 20, 220 ), random.randint( 160, 220 ) ), width = random.randint( 1, 2 ) ) #image.save("captcha.jpg") out = StringIO() ...
code_fim
hard
{ "lang": "python", "repo": "tectronics/blogiscms", "path": "/tools/Captcha.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ем маску, чтобы фон буквы стал прозрачным: mask = Image.new( 'L', ( fontSize + 10, fontSize + 10 ), 0 ) mask.paste( charImg, ( 0, 0 ) ) hpos = 10 + ( i * interval + random.randint( 10, interval - 10 ) ) vpos = random.randint( 10, 20 ) image.paste...
code_fim
hard
{ "lang": "python", "repo": "tectronics/blogiscms", "path": "/tools/Captcha.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print(self.result) return self.result def dfs(self, index, n, k): if len(self.tmp) == k: self.result.append(self.tmp.copy()) return for i in range(index, n + 1): self.tmp.append(i) self.dfs(i + 1, n, k) self....
code_fim
medium
{ "lang": "python", "repo": "imlifeilong/MyAlgorithm", "path": "/leetcode/回溯/77.组合.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: imlifeilong/MyAlgorithm path: /leetcode/回溯/77.组合.py from typing import List ''' 给定两个整数 n 和 k,返回 1 ... n 中所有可能的 k 个数的组合。 示例: 输入: n = 4, k = 2 输出: [ [2,4], [3,4], [2,3], [1,2], [1,3], [1,4], ] ''' class Solution: <|fim_suffix|> print(self.result) return self.result ...
code_fim
medium
{ "lang": "python", "repo": "imlifeilong/MyAlgorithm", "path": "/leetcode/回溯/77.组合.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> vanishPoints = [] for vanishPencil in self.pencils.values(): rays = vanishPencil.vanishRays for ray in rays: vanishPoints.append((ray.vanishPoint, ray.pencil_id)) return vanishPoints def getVirtualPoints(self): virtualPoints = [] for vanishPencil in self.pencils.values(): rays = va...
code_fim
hard
{ "lang": "python", "repo": "Charamba/Cross-Ratio-Arrays-Shape-Descriptor", "path": "/src/VanishPencilsTable.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> return self.pencils.items() def getVanishPoints(self): vanishPoints = [] for vanishPencil in self.pencils.values(): rays = vanishPencil.vanishRays for ray in rays: vanishPoints.append((ray.vanishPoint, ray.pencil_id)) return vanishPoints def getVirtualPoints(self): virtualPoints = []...
code_fim
medium
{ "lang": "python", "repo": "Charamba/Cross-Ratio-Arrays-Shape-Descriptor", "path": "/src/VanishPencilsTable.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: Charamba/Cross-Ratio-Arrays-Shape-Descriptor path: /src/VanishPencilsTable.py from ShapeDescriptor import * class VanishPencil: def __init__(self, vanishRay=None): self.vanishRays = None if vanishRay: self.vanishRays = [vanishRay] # List of vanishRays def updateVanishRay(self, newVanish...
code_fim
hard
{ "lang": "python", "repo": "Charamba/Cross-Ratio-Arrays-Shape-Descriptor", "path": "/src/VanishPencilsTable.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }