text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: bufferx/twork path: /scaffold/twork_app/tests/twork_test_base.py # encoding: utf-8 import os import requests import unittest import twork_env class TworkTestCase(unittest.TestCase): <|fim_suffix|> env_mode = os.environ['PY_TEST_ENV_TWDEMO'] self.run_env = twork_env.ENV[env_mode...
code_fim
medium
{ "lang": "python", "repo": "bufferx/twork", "path": "/scaffold/twork_app/tests/twork_test_base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> env_mode = os.environ['PY_TEST_ENV_TWDEMO'] self.run_env = twork_env.ENV[env_mode] self.run_host = self.run_env['twork_host'] def tearDown(self): if hasattr(self, 'response'): self.response.close() if __name__ == '__main__': unittest.main()<|fim_prefi...
code_fim
easy
{ "lang": "python", "repo": "bufferx/twork", "path": "/scaffold/twork_app/tests/twork_test_base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>tuple1=('anusha','shravya','priya','karthik','satish') print(tuple(enumerate(tuple1)))<|fim_prefix|># repo: Ananya-KU/Best-Enlist-CV-2021-Python-tasks path: /Day26.py # Enumerate a python list and try to print the counter with the list value list1= ['ananya','pooja','harshitha','anu','nithin'] print...
code_fim
medium
{ "lang": "python", "repo": "Ananya-KU/Best-Enlist-CV-2021-Python-tasks", "path": "/Day26.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ananya-KU/Best-Enlist-CV-2021-Python-tasks path: /Day26.py # Enumerate a python list and try to print the counter with the list value list1= ['ananya','pooja','harshitha','anu','nithin'] print(list(enumerate(list1))) <|fim_suffix|># Enumerate a python tuple and try to print the counter wit...
code_fim
easy
{ "lang": "python", "repo": "Ananya-KU/Best-Enlist-CV-2021-Python-tasks", "path": "/Day26.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> conn = sqlite3.connect(defaultDatabase) curs = conn.cursor() curs.execute("INSERT INTO textStrings (strings) VALUES (?)", (stringValue,)) conn.commit() curs.close() conn.close()<|fim_prefix|># repo: invisiblebiron/Localization_Tools path: /database.py ''' Created on 2017/01/31 @a...
code_fim
hard
{ "lang": "python", "repo": "invisiblebiron/Localization_Tools", "path": "/database.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def create_table(): conn = sqlite3.connect(defaultDatabase) curs = conn.cursor() curs.execute('CREATE TABLE IF NOT EXISTS textStrings(strings TEXT)') curs.close() conn.close() def data_entry(stringValue): conn = sqlite3.connect(defaultDatabase) curs = conn.cursor() cur...
code_fim
medium
{ "lang": "python", "repo": "invisiblebiron/Localization_Tools", "path": "/database.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: invisiblebiron/Localization_Tools path: /database.py ''' Created on 2017/01/31 @author: Brian ''' import sqlite3 from os.path import isfile, getsize <|fim_suffix|> conn = sqlite3.connect(defaultDatabase) curs = conn.cursor() curs.execute("INSERT INTO textStrings (strings) VALUES (?)"...
code_fim
hard
{ "lang": "python", "repo": "invisiblebiron/Localization_Tools", "path": "/database.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>class SHSZSelection(object): """docstring for SHSZSelection""" def __init__(self, data_folder, selection_func, equities=None): super(SHSZSelection, self).__init__() self.selection_func = selection_func self.DATA_FOLDER = data_folder stocks = ts.get_stock_basics() ...
code_fim
hard
{ "lang": "python", "repo": "feng1918/qfeng", "path": "/qtrader/qtrader/AData.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """docstring for get_name""" return self.stocks.loc[code] class SHSZSelection(object): """docstring for SHSZSelection""" def __init__(self, data_folder, selection_func, equities=None): super(SHSZSelection, self).__init__() self.selection_func = selection_func ...
code_fim
hard
{ "lang": "python", "repo": "feng1918/qfeng", "path": "/qtrader/qtrader/AData.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: feng1918/qfeng path: /qtrader/qtrader/AData.py import tushare as ts import pandas as pd class SHSZData(object): """docstring for SHSZData""" def __init__(self, data_folder): super(SHSZData, self).__init__() stocks = ts.get_stock_basics() self.stocks = stocks[stoc...
code_fim
hard
{ "lang": "python", "repo": "feng1918/qfeng", "path": "/qtrader/qtrader/AData.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pultzlucas/desafios-curso-python path: /desafio015.py days = int(input('O carro foi alugado por quan<|fim_suffix|>15 * kms) print('Total a pagar:', totalPrice)<|fim_middle|>tos dias? ')) kms = float(input('Quandos Km foram rodados? ')) totalPrice = (60 * days) + (0.
code_fim
medium
{ "lang": "python", "repo": "pultzlucas/desafios-curso-python", "path": "/desafio015.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>15 * kms) print('Total a pagar:', totalPrice)<|fim_prefix|># repo: pultzlucas/desafios-curso-python path: /desafio015.py days = int(input('O carro foi alugado por quantos dias? ')) kms = float(input('Quandos Km for<|fim_middle|>am rodados? ')) totalPrice = (60 * days) + (0.
code_fim
easy
{ "lang": "python", "repo": "pultzlucas/desafios-curso-python", "path": "/desafio015.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>am rodados? ')) totalPrice = (60 * days) + (0.15 * kms) print('Total a pagar:', totalPrice)<|fim_prefix|># repo: pultzlucas/desafios-curso-python path: /desafio015.py days = int(input('O carro foi alugado por quan<|fim_middle|>tos dias? ')) kms = float(input('Quandos Km for
code_fim
easy
{ "lang": "python", "repo": "pultzlucas/desafios-curso-python", "path": "/desafio015.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: security-force-monitor/sfm-cms path: /source/models.py import threading import uuid import re import requests import reversion from django.conf import settings from django.contrib.auth import get_user_model from django.urls import reverse_lazy from django.db import models from django.db.models...
code_fim
hard
{ "lang": "python", "repo": "security-force-monitor/sfm-cms", "path": "/source/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return self._get_date_or_timestamp('uploaded') @property def related_entities(self): """ Return a list of dicts representing the access points that are linked to this source. Dicts must include the following metadata: - name - archi...
code_fim
hard
{ "lang": "python", "repo": "security-force-monitor/sfm-cms", "path": "/source/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for prop in dir(self): if prop.endswith('_related'): related = getattr(self, prop).all() if related: for entity in related: record_type = entity.object_ref._meta.object_name entity_metad...
code_fim
hard
{ "lang": "python", "repo": "security-force-monitor/sfm-cms", "path": "/source/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>the first occurance, we need more. print(phoneregex.findall('Here goes my number 555-999-111 and 999-000-777')) # returns all the occurances found in a string in a list<|fim_prefix|># repo: mujeebishaque/AutomateTheBoringStuffWithPython path: /regex.py import re message = "some message having 123-555-9...
code_fim
hard
{ "lang": "python", "repo": "mujeebishaque/AutomateTheBoringStuffWithPython", "path": "/regex.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mujeebishaque/AutomateTheBoringStuffWithPython path: /regex.py import re message = "some message having 123-555-999 nummbers. Call 111-333-111" # regex basics till line 20 # we pass raw string to compile() # call re.compile() function to create regex object phoneregex = re.compile(r'\d\d\d-\d\d\...
code_fim
medium
{ "lang": "python", "repo": "mujeebishaque/AutomateTheBoringStuffWithPython", "path": "/regex.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: coderedcorp/wagtail-cache path: /wagtailcache/urls.py """ URLs for the wagtail admin dashboard. """ from django.urls import path <|fim_suffix|>urlpatterns = [ path("", index, name="index"), path("clearcache", clear, name="clearcache"), ]<|fim_middle|>from wagtailcache.views import clear ...
code_fim
medium
{ "lang": "python", "repo": "coderedcorp/wagtail-cache", "path": "/wagtailcache/urls.py", "mode": "psm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|>urlpatterns = [ path("", index, name="index"), path("clearcache", clear, name="clearcache"), ]<|fim_prefix|># repo: coderedcorp/wagtail-cache path: /wagtailcache/urls.py """ URLs for the wagtail admin dashboard. """ from django.urls import path <|fim_middle|>from wagtailcache.views import clear ...
code_fim
medium
{ "lang": "python", "repo": "coderedcorp/wagtail-cache", "path": "/wagtailcache/urls.py", "mode": "spm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|> urlpatterns = [ path("", index, name="index"), path("clearcache", clear, name="clearcache"), ]<|fim_prefix|># repo: coderedcorp/wagtail-cache path: /wagtailcache/urls.py """ URLs for the wagtail admin dashboard. """ from django.urls import path <|fim_middle|>from wagtailcache.views import clear...
code_fim
medium
{ "lang": "python", "repo": "coderedcorp/wagtail-cache", "path": "/wagtailcache/urls.py", "mode": "spm", "license": "CC-BY-3.0", "source": "the-stack-v2" }
<|fim_suffix|># MAIN if __name__ == '__main__': input = sys.argv[1] files = [file for file in listdir(input) if isfile(file)] for file in files: check_duplication(file)<|fim_prefix|># repo: LongTianPy/BioinformaticsSuite path: /check_gene_duplication.py #!/usr/bin/python """ """ # IMPORT from Bio ...
code_fim
hard
{ "lang": "python", "repo": "LongTianPy/BioinformaticsSuite", "path": "/check_gene_duplication.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LongTianPy/BioinformaticsSuite path: /check_gene_duplication.py #!/usr/bin/python """ """ # IMPORT from Bio import SeqIO from collections import OrderedDict import sys from os import listdir from os.path import isfile # FUNCTIONS def check_duplication(file): <|fim_suffix|># MAIN if __name__ == ...
code_fim
hard
{ "lang": "python", "repo": "LongTianPy/BioinformaticsSuite", "path": "/check_gene_duplication.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i = 0 j = 0 while i < m + n: if i - j == m and j < n: nums1[i] = nums2[j] j += 1 elif j < n and nums1[i] > nums2[j]: shift_right(nums1, i) nums1[i] = nums2[j] j += 1 i += 1<|fim_prefix|># repo: saurabh-pandey/A...
code_fim
medium
{ "lang": "python", "repo": "saurabh-pandey/AlgoAndDS", "path": "/leetcode/arrays/merge_sorted_array_a2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: saurabh-pandey/AlgoAndDS path: /leetcode/arrays/merge_sorted_array_a2.py from typing import List def shift_right(nums: List[int], index: int) -> None: <|fim_suffix|> i = 0 j = 0 while i < m + n: if i - j == m and j < n: nums1[i] = nums2[j] j += 1 ...
code_fim
medium
{ "lang": "python", "repo": "saurabh-pandey/AlgoAndDS", "path": "/leetcode/arrays/merge_sorted_array_a2.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>def merge(nums1: List[int], m: int, nums2: List[int], n: int) -> None: i = 0 j = 0 while i < m + n: if i - j == m and j < n: nums1[i] = nums2[j] j += 1 elif j < n and nums1[i] > nums2[j]: shift_right(nums1, i) nums1[i] = nums2[j] ...
code_fim
medium
{ "lang": "python", "repo": "saurabh-pandey/AlgoAndDS", "path": "/leetcode/arrays/merge_sorted_array_a2.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: yamadaderax/endrollsystem-homepage path: /endroll/_html/migrations/0001_initial.py # Generated by Django 2.1.4 on 2019-02-09 15:46 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ] ...
code_fim
hard
{ "lang": "python", "repo": "yamadaderax/endrollsystem-homepage", "path": "/endroll/_html/migrations/0001_initial.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ions.AddField( model_name='disc', name='music30', field=models.ForeignKey(blank=True, on_delete=django.db.models.deletion.PROTECT, related_name='disk30', to='_html.Music', verbose_name='30曲目'), ), migrations.AddField( model_name='disc', ...
code_fim
hard
{ "lang": "python", "repo": "yamadaderax/endrollsystem-homepage", "path": "/endroll/_html/migrations/0001_initial.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> shape = (1, 1, 9, 9) if self.data_format == 'NCHW' else (1, 9, 9, 1) board = np.empty(shape, dtype=np.int32) # ここでは相手の利きがない設定 black_effect_mask = np.zeros(shape, dtype=np.bool) ph = tf.placeholder(tf.int32, shape=shape) short_effect = WhiteShortEffectLayer...
code_fim
hard
{ "lang": "python", "repo": "windfall-shogi/feature-annotation", "path": "/annotation/white_effect/test/effect_ky.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: windfall-shogi/feature-annotation path: /annotation/white_effect/test/effect_ky.py #!/usr/bin/env python # -*- coding: utf-8 -*- import os from itertools import product from pathlib import Path import numpy as np import tensorflow as tf from dotenv import load_dotenv from annotation.direction ...
code_fim
hard
{ "lang": "python", "repo": "windfall-shogi/feature-annotation", "path": "/annotation/white_effect/test/effect_ky.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gmcnutt/stardog path: /ui/runnable.py import pygame import sys class Runnable(object): def __init__(self): self.running = True self.run_result = None <|fim_suffix|> undermouse = None saved_background = self.surf.copy() while self.running: ...
code_fim
hard
{ "lang": "python", "repo": "gmcnutt/stardog", "path": "/ui/runnable.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def run(self): undermouse = None saved_background = self.surf.copy() while self.running: dirtyrect = self.paint(show_boxes=False) pygame.display.update(dirtyrect) event = pygame.event.wait() if event.type == pygame.MOUSEBUTTONDOWN...
code_fim
hard
{ "lang": "python", "repo": "gmcnutt/stardog", "path": "/ui/runnable.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>i] count = 1 return compressed print(StringCompression('aabbcccdeee_'))<|fim_prefix|># repo: anish531213/Interesting-Python-problems path: /String_compression.py def StringCompression(string): start = string[0] count = 1 compressed = '' for i in range(1, len(string)): ...
code_fim
medium
{ "lang": "python", "repo": "anish531213/Interesting-Python-problems", "path": "/String_compression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: anish531213/Interesting-Python-problems path: /String_compression.py def StringCompression(string): start = string[0] count = 1 compressed = '' <|fim_suffix|>1 else: compressed += start + str(count) start = string[i] count = 1 return com...
code_fim
medium
{ "lang": "python", "repo": "anish531213/Interesting-Python-problems", "path": "/String_compression.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>1 else: compressed += start + str(count) start = string[i] count = 1 return compressed print(StringCompression('aabbcccdeee_'))<|fim_prefix|># repo: anish531213/Interesting-Python-problems path: /String_compression.py def StringCompression(string): sta...
code_fim
medium
{ "lang": "python", "repo": "anish531213/Interesting-Python-problems", "path": "/String_compression.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == '__main__': while True: logger.info("Hello !") logger.error("error!") sleep(2)<|fim_prefix|># repo: superman552/-pytest_study path: /app_study/log_conf_read.py import logging.config import os from time import sleep <|fim_middle|>log_path = './logs' if not os.pa...
code_fim
hard
{ "lang": "python", "repo": "superman552/-pytest_study", "path": "/app_study/log_conf_read.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: superman552/-pytest_study path: /app_study/log_conf_read.py import logging.config import os from time import sleep <|fim_suffix|>if __name__ == '__main__': while True: logger.info("Hello !") logger.error("error!") sleep(2)<|fim_middle|>log_path = './logs' if not os.pa...
code_fim
hard
{ "lang": "python", "repo": "superman552/-pytest_study", "path": "/app_study/log_conf_read.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> inputs: list, root: Variable, expr: Variable, ) -> List[Variable]: """ Collect input nodes so that the resulting ``ImplicitComponent`` has access to inputs outside of itself. """ for dependency in expr.dependencies: if dependency.name != root.name: if is...
code_fim
medium
{ "lang": "python", "repo": "LSDOlab/omtools", "path": "/omtools/utils/collect_input_exprs.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: LSDOlab/omtools path: /omtools/utils/collect_input_exprs.py from typing import List from omtools.core.variable import Variable from omtools.core.input import Input <|fim_suffix|> inputs: list, root: Variable, expr: Variable, ) -> List[Variable]: """ Collect input nodes so th...
code_fim
medium
{ "lang": "python", "repo": "LSDOlab/omtools", "path": "/omtools/utils/collect_input_exprs.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>@admin.register(SetCtarl) class SetCtarlAdmin(admin.ModelAdmin): # 设置模型字段,用于Admin后台数据的表头设置 list_display = ['id', 'name', 'is_start'] # 过滤器 list_filter = ['id', 'name', 'is_start'] # 设置可搜索的字段并在Admin后台数据生成搜索框,如有外键应使用双下划线连接两个模型的字段 search_fields = ['id', 'name', 'is_start'] # 设置排序方...
code_fim
hard
{ "lang": "python", "repo": "gdludan/blog", "path": "/blog/tools/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # 设置模型字段,用于Admin后台数据的表头设置 list_display = ['id', 'name', 'is_start'] # 过滤器 list_filter = ['id', 'name', 'is_start'] # 设置可搜索的字段并在Admin后台数据生成搜索框,如有外键应使用双下划线连接两个模型的字段 search_fields = ['id', 'name', 'is_start'] # 设置排序方式 ordering = ['-id'] refresh_times = [5, 2] # 自动刷新后台管理页面...
code_fim
hard
{ "lang": "python", "repo": "gdludan/blog", "path": "/blog/tools/admin.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gdludan/blog path: /blog/tools/admin.py from django.contrib import admin from .models import Access, SetCtarl @admin.register(Access) class AccessAdmin(admin.ModelAdmin): # 设置模型字段,用于Admin后台数据的表头设置 list_display = ['id', 'date', 'num'] # 过滤器 list_filter = ['id', 'date', 'num'] ...
code_fim
medium
{ "lang": "python", "repo": "gdludan/blog", "path": "/blog/tools/admin.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: saber-solooki/Clean-REST-Django path: /main/di/get_users_binder.py from main.data.get_users import GetUsersRepoImpl from main.domain.get_users_repo import GetUsersRepo from main.domain.use_cases.get_users import GetUsersUseCase <|fim_suffix|> def get_users_binder(binder): binder.bind_to_pro...
code_fim
medium
{ "lang": "python", "repo": "saber-solooki/Clean-REST-Django", "path": "/main/di/get_users_binder.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> binder.bind_to_provider(GetUsersUseCase, provide_use_case) binder.bind_to_provider(GetUsersRepo, provide_repo)<|fim_prefix|># repo: saber-solooki/Clean-REST-Django path: /main/di/get_users_binder.py from main.data.get_users import GetUsersRepoImpl from main.domain.get_users_repo import GetUsersRe...
code_fim
medium
{ "lang": "python", "repo": "saber-solooki/Clean-REST-Django", "path": "/main/di/get_users_binder.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return GetUsersRepoImpl() def get_users_binder(binder): binder.bind_to_provider(GetUsersUseCase, provide_use_case) binder.bind_to_provider(GetUsersRepo, provide_repo)<|fim_prefix|># repo: saber-solooki/Clean-REST-Django path: /main/di/get_users_binder.py from main.data.get_users import GetU...
code_fim
medium
{ "lang": "python", "repo": "saber-solooki/Clean-REST-Django", "path": "/main/di/get_users_binder.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AhmedFat7y/compiler-lab path: /lab-5/models.py class Rule: ''' provides interface to query the raw representation of rules returned by the parser ''' def __init__(self, head, body): ''' head: a symbol to represent the head body: list of the body symbols in this format => [[('t...
code_fim
medium
{ "lang": "python", "repo": "AhmedFat7y/compiler-lab", "path": "/lab-5/models.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __repr__(self): out = self.head + '->[' for term in self.terms: for symbol in term: out += symbol if self.terms[-1] != term: out += ', ' return out + ']'<|fim_prefix|># repo: AhmedFat7y/compiler-lab path: /lab-5/models.py class Rule: ''' provides interfac...
code_fim
hard
{ "lang": "python", "repo": "AhmedFat7y/compiler-lab", "path": "/lab-5/models.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: keitasumiya/pythonTest path: /global_ip_checker/_old/subprocess-test.py import subprocess from subprocess import PIPE proc = subprocess.run("date", shell=True,<|fim_suffix|> proc.stdout print('STDOUT: {}'.format(date))<|fim_middle|> stdout=PIPE, stderr=PIPE, text=True) date =
code_fim
easy
{ "lang": "python", "repo": "keitasumiya/pythonTest", "path": "/global_ip_checker/_old/subprocess-test.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stdout=PIPE, stderr=PIPE, text=True) date = proc.stdout print('STDOUT: {}'.format(date))<|fim_prefix|># repo: keitasumiya/pythonTest path: /global_ip_checker/_old/subprocess-test.py import subprocess from subprocess import PIP<|fim_middle|>E proc = subprocess.run("date", shell=True,
code_fim
easy
{ "lang": "python", "repo": "keitasumiya/pythonTest", "path": "/global_ip_checker/_old/subprocess-test.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: VVKot/coding-competitions path: /leetcode/python/1160_find_words_that_can_be_formed_by_characters.py import collections from typing import List class Solution: <|fim_suffix|> good = collections.Counter(chars) result = 0 for word in words: missing = collection...
code_fim
medium
{ "lang": "python", "repo": "VVKot/coding-competitions", "path": "/leetcode/python/1160_find_words_that_can_be_formed_by_characters.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def countCharacters(self, words: List[str], chars: str) -> int: good = collections.Counter(chars) result = 0 for word in words: missing = collections.Counter(word) - good if not missing: result += len(word) return result<|fim_pre...
code_fim
easy
{ "lang": "python", "repo": "VVKot/coding-competitions", "path": "/leetcode/python/1160_find_words_that_can_be_formed_by_characters.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gianlucatruda/entelect2018 path: /main.py from input import input from tools import * from output import output def main(): _input = input("map_2.input") closest_factories = create_closest_dicts( _input.mines, _input.factories, _input.dict_mines_factories ) all_drones =...
code_fim
hard
{ "lang": "python", "repo": "gianlucatruda/entelect2018", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> else: # move to, update dist and index travelled # print ("Drone is ", drone.x, drone.y, " at ", drone.location_obj) close_mine = closestMine(drone, _input.mines, closest_factories) closest_facts = [] if len(drone....
code_fim
hard
{ "lang": "python", "repo": "gianlucatruda/entelect2018", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>kume_dondur("{1, 2, 3, 17}")<|fim_prefix|># repo: hsnylmzz/Python-Learning path: /pyt/set4.py def kume_dondur(str_kume: str): <|fim_middle|> if str_kume.startswith("{") and str_kume.endswith("}"): kume_elemanlari = str_kume[1:len(str_kume) -1] v = kume_elemanlari.split(", ") pr...
code_fim
medium
{ "lang": "python", "repo": "hsnylmzz/Python-Learning", "path": "/pyt/set4.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: hsnylmzz/Python-Learning path: /pyt/set4.py def kume_dondur(str_kume: str): <|fim_suffix|>kume_dondur("{1, 2, 3, 17}")<|fim_middle|> if str_kume.startswith("{") and str_kume.endswith("}"): kume_elemanlari = str_kume[1:len(str_kume) -1] v = kume_elemanlari.split(", ") pr...
code_fim
medium
{ "lang": "python", "repo": "hsnylmzz/Python-Learning", "path": "/pyt/set4.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>BuildPlugin(target, files, libs, defines = ['DLL_CHECKSUMS'])<|fim_prefix|># repo: Prcuvu/unsis path: /Contrib/VPatch/Source/Plugin/SConscript target = 'VPatch' files = Split(""" apply_patch.c checksum.c md5.c vpatchdll.c """) <|fim_middle|>libs = Split(""" kernel32 user32 """) Imp...
code_fim
medium
{ "lang": "python", "repo": "Prcuvu/unsis", "path": "/Contrib/VPatch/Source/Plugin/SConscript", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|># repo: Prcuvu/unsis path: /Contrib/VPatch/Source/Plugin/SConscript target = 'VPatch' files = Split(""" apply_patch.c checksum.c md5.c vpatchdll.c """) <|fim_suffix|>BuildPlugin(target, files, libs, defines = ['DLL_CHECKSUMS'])<|fim_middle|>libs = Split(""" kernel32 user32 """) Imp...
code_fim
medium
{ "lang": "python", "repo": "Prcuvu/unsis", "path": "/Contrib/VPatch/Source/Plugin/SConscript", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> class UserFactory: @staticmethod def create(id, name, last_name) -> User: id = UserId(id) name = UserName(name) last_name = UserLastName(last_name) UserFactory._validate([id, name, last_name]) return User(id.value(), name.value(), last_name.value()) @s...
code_fim
hard
{ "lang": "python", "repo": "jguillermo/python-microservice-seed", "path": "/app/src/users/domain/user.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def create(id, name, last_name) -> User: id = UserId(id) name = UserName(name) last_name = UserLastName(last_name) UserFactory._validate([id, name, last_name]) return User(id.value(), name.value(), last_name.value()) @staticmethod def ...
code_fim
medium
{ "lang": "python", "repo": "jguillermo/python-microservice-seed", "path": "/app/src/users/domain/user.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: jguillermo/python-microservice-seed path: /app/src/users/domain/user.py from sdk.types import TypeUuid, TypeString, TypeBase, TypeInteger class UserId(TypeUuid): pass class UserName(TypeString): def validate(self, value_name=''): super().validate('Nombre de usuario') i...
code_fim
hard
{ "lang": "python", "repo": "jguillermo/python-microservice-seed", "path": "/app/src/users/domain/user.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>from utils import factorize_rec, product def aliquot_sum(n): fzn = factorize_rec(n) return product((sum((p**j for j in xrange(i+1))) for p,i in fzn.items())) - n N = 10000 total = 0 for n in xrange(1,N): dn = aliquot_sum(n) if aliquot_sum(dn) == n and dn != n: tot...
code_fim
medium
{ "lang": "python", "repo": "troyp/project-euler", "path": "/q21.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: troyp/project-euler path: /q21.py # Let d(n) be defined as the sum of proper divisors of n (numbers less than # n which divide evenly into n). # If d(a) = b and d(b) = a, where a b, then a and b are an amicable pair # and each of a and b are called amicable numbers. # For example, the proper d...
code_fim
medium
{ "lang": "python", "repo": "troyp/project-euler", "path": "/q21.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def task_pre_step( self, step_name, task_datastore, metadata, run_id, task_id, flow, graph, retry_count, max_retries, ubf_context, inputs, ): self.metadata = metadata self.task_datastore...
code_fim
hard
{ "lang": "python", "repo": "parampavar/metaflow", "path": "/metaflow/plugins/kubernetes/kubernetes_decorator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def runtime_task_created( self, task_datastore, task_id, split_index, input_paths, is_cloned, ubf_context ): # To execute the Kubernetes job, the job container needs to have # access to the code package. We store the package in the datastore # which the pod is able ...
code_fim
hard
{ "lang": "python", "repo": "parampavar/metaflow", "path": "/metaflow/plugins/kubernetes/kubernetes_decorator.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: parampavar/metaflow path: /metaflow/plugins/kubernetes/kubernetes_decorator.py import os import platform import sys import requests from metaflow import util from metaflow.decorators import StepDecorator from metaflow.exception import MetaflowException from metaflow.metadata import MetaDatum fr...
code_fim
hard
{ "lang": "python", "repo": "parampavar/metaflow", "path": "/metaflow/plugins/kubernetes/kubernetes_decorator.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: konamino/Collaborative path: /money/money.py er.name if await bank.is_global() else _("this server") ) ) @is_owner_if_bank_global() @checks.admin_or_permissions(manage_guild=True) @_bank.group(name="prune") async def _prune(self, ctx): ...
code_fim
hard
{ "lang": "python", "repo": "konamino/Collaborative", "path": "/money/money.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: konamino/Collaborative path: /money/money.py currency = await bank.get_currency_name(ctx.guild) max_bal = await bank.get_max_balance(ctx.guild) if bal > max_bal: bal = max_bal await bank.set_balance(user, bal) await ctx.send( _...
code_fim
hard
{ "lang": "python", "repo": "konamino/Collaborative", "path": "/money/money.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> slot = "~~\n~~" # Mobile friendly for i, row in enumerate(rows): # Let's build the slot to show sign = " " if i == 1: sign = ">" slot += "{}{} {} {}\n".format( sign, *[c.value for c in row] # pylint: disable=no-m...
code_fim
hard
{ "lang": "python", "repo": "konamino/Collaborative", "path": "/money/money.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kimsr96/pygame path: /pygame_project/1_frame_background_stage_character.py import os import pygame pygame.init() #초기화 (반드시 필요) #화면 크기 설정 screen_width = 640 #가로크기 screen_height = 480 #세로 크기 screen = pygame.display.set_mode((screen_width, screen_height)) <|fim_suffix|># 배경 만들기 background = pygam...
code_fim
hard
{ "lang": "python", "repo": "kimsr96/pygame", "path": "/pygame_project/1_frame_background_stage_character.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>current_path = os.path.dirname(__file__) #현재 파일의 위치 반환 image_path = os.path.join(current_path,"image") #images 폴더 위치 반환 # 배경 만들기 background = pygame.image.load(os.path.join(image_path,"background.png")) # 스테이지 만들기 stage = pygame.image.load(os.path.join(image_path,"stage.png")) stage_size = stage.get_rect...
code_fim
medium
{ "lang": "python", "repo": "kimsr96/pygame", "path": "/pygame_project/1_frame_background_stage_character.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|># 배경 만들기 background = pygame.image.load(os.path.join(image_path,"background.png")) # 스테이지 만들기 stage = pygame.image.load(os.path.join(image_path,"stage.png")) stage_size = stage.get_rect().size stage_height = stage_size[1] #스테이지 높이 위에 캐릭터를 두기 위해 사용 character = pygame.image.load(os.path.join(image_path,"ch...
code_fim
medium
{ "lang": "python", "repo": "kimsr96/pygame", "path": "/pygame_project/1_frame_background_stage_character.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '''Calculates entropy values for each substring in the script. ''' strings = strExtractParse(s) l = [] for x in strings: l+=[entropy(x)] return l<|fim_prefix|># repo: shidan1/workshop path: /Project/Entropy.py import math from collections import Counter from Project.StringExtr...
code_fim
medium
{ "lang": "python", "repo": "shidan1/workshop", "path": "/Project/Entropy.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: shidan1/workshop path: /Project/Entropy.py import math from collections import Counter from Project.StringExtractor import strExtractParse def entropy(s): '''Calculates the entropy value for s.''' p,lns = Counter(s), float(len(s)) return -sum( count/lns * math.log(count/lns, 2) for c...
code_fim
easy
{ "lang": "python", "repo": "shidan1/workshop", "path": "/Project/Entropy.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: whaleygeek/pyenergenie path: /src/Logger.py # Logger.py 14/05/2016 D.J.Whale # # A simple logger - logs to file. import os, time try: # Python 3 from .energenie import OpenThings except ImportError: # Python 2 from energenie import OpenThings LOG_FILENAME = "energenie.csv" H...
code_fim
hard
{ "lang": "python", "repo": "whaleygeek/pyenergenie", "path": "/src/Logger.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # get the header header = msg['header'] timestamp = time.time() mfrid = header['mfrid'] productid = header['productid'] sensorid = header['sensorid'] # set defaults for any data that doesn't appear in this message # but build flags so we know which ones this contai...
code_fim
hard
{ "lang": "python", "repo": "whaleygeek/pyenergenie", "path": "/src/Logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # generate a line of CSV flags = "".join([str(a) for a in flags]) csv = "%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s,%s" % (timestamp, mfrid, productid, sensorid, flags, switch, voltage, freq, reactive, real, apparent, current, temperature) log_file.write(csv + '\n') log_file.flush() ##tra...
code_fim
hard
{ "lang": "python", "repo": "whaleygeek/pyenergenie", "path": "/src/Logger.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.train_op(X, Y) def predict(self, X): return self.predict_op(X) # all we do is replace Q Learning as the SGDRegressor with the one we just made if __name__ == '__main__': q_learning.SGDRegressor = SGDRegressor q_learning.main()<|fim_prefix|># repo: josephborrego/Reinforced_Learning ...
code_fim
hard
{ "lang": "python", "repo": "josephborrego/Reinforced_Learning", "path": "/deeplearning/theano_warmup.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: josephborrego/Reinforced_Learning path: /deeplearning/theano_warmup.py from __future__ import print_function, division from builtins import range import numpy as np import theano import theano.tensor as T import q_learning # deep neural networks are easier to write with frameworks like ...
code_fim
hard
{ "lang": "python", "repo": "josephborrego/Reinforced_Learning", "path": "/deeplearning/theano_warmup.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> class ConfigFileSectionNotFoundError(QwcoreError): """Raised when a section is not precent in the config file""" class ConfigFileKeyNotFoundError(QwcoreError): """Raised when a section is not precent in the config file"""<|fim_prefix|># repo: qwcode/qwcore path: /qwcore/exception.py class Qwc...
code_fim
medium
{ "lang": "python", "repo": "qwcode/qwcore", "path": "/qwcore/exception.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: qwcode/qwcore path: /qwcore/exception.py class QwcoreError(Exception): """Qwcore base exception""" class PluginNameNotFoundError(QwcoreError): """Raised when a specific plugin is not found""" class PluginNameMismatchError(QwcoreError): <|fim_suffix|> """Raised when the config file...
code_fim
hard
{ "lang": "python", "repo": "qwcode/qwcore", "path": "/qwcore/exception.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if bool(message_push): conn = httplib.HTTPSConnection("api.pushover.net:443") conn.request("POST", "/1/messages.json", urllib.parse.urlencode({ "token": config["API_TOKEN"], "user": config["USER_KEY"], "message": "Date: "+ date_obj + " \n\n" + (messa...
code_fim
hard
{ "lang": "python", "repo": "satrox28/covid-19-vaccine-appointment", "path": "/main.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: satrox28/covid-19-vaccine-appointment path: /main.py import requests import json import http.client as httplib, urllib.parse import logging import yaml import datetime config = yaml.safe_load(open("config.yaml")) curr_date = datetime.datetime.now() date_Array = [] for i in range(7): curr_da...
code_fim
hard
{ "lang": "python", "repo": "satrox28/covid-19-vaccine-appointment", "path": "/main.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnoopMasterCoder/python-course-docs path: /11. Chapter 11/10_pr04.py class Complex: def __init__(self,a, b) -> None: self.a = a self.b = b <|fim_suffix|>c1 = Complex(1, 4) c2 = Complex(11, 3) c3 = c1+c2 print(c3.a, c3.b)<|fim_middle|> def __add__(self, obj): return...
code_fim
medium
{ "lang": "python", "repo": "AnoopMasterCoder/python-course-docs", "path": "/11. Chapter 11/10_pr04.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __add__(self, obj): return Complex(self.a + obj.a, self.b + obj.b) c1 = Complex(1, 4) c2 = Complex(11, 3) c3 = c1+c2 print(c3.a, c3.b)<|fim_prefix|># repo: AnoopMasterCoder/python-course-docs path: /11. Chapter 11/10_pr04.py class Complex: def __init__(self,a, b) -> None: <|fim_midd...
code_fim
easy
{ "lang": "python", "repo": "AnoopMasterCoder/python-course-docs", "path": "/11. Chapter 11/10_pr04.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>c1 = Complex(1, 4) c2 = Complex(11, 3) c3 = c1+c2 print(c3.a, c3.b)<|fim_prefix|># repo: AnoopMasterCoder/python-course-docs path: /11. Chapter 11/10_pr04.py class Complex: def __init__(self,a, b) -> None: self.a = a self.b = b def __add__(self, obj): <|fim_middle|> return...
code_fim
easy
{ "lang": "python", "repo": "AnoopMasterCoder/python-course-docs", "path": "/11. Chapter 11/10_pr04.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: caniro/algo-note path: /Baekjoon/python/1541.py # 잃어버린 괄호 : https://www.acmicpc.net/problem/1541 <|fim_suffix|>total = numbers[0] for i in range(1, len(numbers)): total -= numbers[i] print(total)<|fim_middle|>numbers_str = input().split('-') numbers = [] for expr in numbers_str: express...
code_fim
hard
{ "lang": "python", "repo": "caniro/algo-note", "path": "/Baekjoon/python/1541.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>total = numbers[0] for i in range(1, len(numbers)): total -= numbers[i] print(total)<|fim_prefix|># repo: caniro/algo-note path: /Baekjoon/python/1541.py # 잃어버린 괄호 : https://www.acmicpc.net/problem/1541 <|fim_middle|>numbers_str = input().split('-') numbers = [] for expr in numbers_str: express...
code_fim
hard
{ "lang": "python", "repo": "caniro/algo-note", "path": "/Baekjoon/python/1541.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: chukt/globalWarmingProject path: /Moving_Snowflakes.py import tkinter import random import time import ISSM_Snowflake CLOUD_COLOR = '#f0f8ff' BACKGROUND = '#b0c4de' FLAKE_COLOR = '#f0ffff' CANVAS_WIDTH = 800 CANVAS_HEIGHT = 600 NUM_BINS = 10 NUM_CLOUDS = 7 BIN_HEIGHT = 0.75 TO_FAL...
code_fim
hard
{ "lang": "python", "repo": "chukt/globalWarmingProject", "path": "/Moving_Snowflakes.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def draw_cloud(self): '''Draws the cloud (made for different sized windows)''' for i in range(NUM_CLOUDS): self.my_canvas.create_arc((i/NUM_CLOUDS)*CANVAS_WIDTH-100, -100, (i/NUM_CLOUDS)*CANVAS_WIDTH+200, 50, start = 189, extent = 190, style = 'chord', fill = CLOUD_COLOR...
code_fim
hard
{ "lang": "python", "repo": "chukt/globalWarmingProject", "path": "/Moving_Snowflakes.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s=2)) t= now-timedelta(weeks=1) print("One week ago",t.strftime("%A %d %B,%Y")) today=date.today() afd=date(today.year,month=4,day=1) if afd<today: print("April fools day went away %d ago" %((today-afd).days)) afd=afd.replace(year=today.year+1) timetoafd=afd-today ...
code_fim
medium
{ "lang": "python", "repo": "Ameyg1/Pythonbasics", "path": "/time and dates/timing3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ameyg1/Pythonbasics path: /time and dates/timing3.py from datetime import time from datetime import date from datetime import datetime from datetime import timedelta #span of time time based maths def main(): print(timedelta(days=365,hours=5<|fim_suffix|>s=2)) t= now-timedelta(weeks=1) ...
code_fim
medium
{ "lang": "python", "repo": "Ameyg1/Pythonbasics", "path": "/time and dates/timing3.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ls day went away %d ago" %((today-afd).days)) afd=afd.replace(year=today.year+1) timetoafd=afd-today print("time to afd:",timetoafd.days) if __name__=="__main__": main()<|fim_prefix|># repo: Ameyg1/Pythonbasics path: /time and dates/timing3.py from datetime import time from datetim...
code_fim
medium
{ "lang": "python", "repo": "Ameyg1/Pythonbasics", "path": "/time and dates/timing3.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>dicionario.update({"1": 55, 2: "olá de novo"}) print(dicionario)<|fim_prefix|># repo: ReisRibeiroRafael/AfroDev path: /directory.py dicionario = dict() dicionario = {1: "oi", 2: "olá", 3: "hello", "C": 9} print(dicionario) print(dicionario.keys()) print(dicionario.values()) dicionario[2] = "oláá" ...
code_fim
medium
{ "lang": "python", "repo": "ReisRibeiroRafael/AfroDev", "path": "/directory.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: ReisRibeiroRafael/AfroDev path: /directory.py dicionario = dict() dicionario = {1: "oi", 2: "olá", 3: "hello", "C": 9} print(dicionario) print(dicionario.keys()) print(dicionario.values()) dicionario[2] = "oláá" print(dicionario) for chave in dicionario: print(dicionario[chave]) ...
code_fim
medium
{ "lang": "python", "repo": "ReisRibeiroRafael/AfroDev", "path": "/directory.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>x.data1="QQ" x.data2=-3 x.display() x.anothername="spam" x.display() print(x.anothername)<|fim_prefix|># repo: dylanhoover/SCU-Coursework path: /COEN140/lab1/class1.py class FirstClass: def setdata(self,value1, value2): <|fim_middle|> self.data1=value1 self.data2=value2 def displa...
code_fim
medium
{ "lang": "python", "repo": "dylanhoover/SCU-Coursework", "path": "/COEN140/lab1/class1.py", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|># repo: dylanhoover/SCU-Coursework path: /COEN140/lab1/class1.py class FirstClass: def setdata(self,value1, value2): self.data1=value1 self.data2=value2 def display(self): print(self.data1, '\n', self.data2, '\n') x = FirstClass() x.setdata("King Arthur", -5) x.display()...
code_fim
easy
{ "lang": "python", "repo": "dylanhoover/SCU-Coursework", "path": "/COEN140/lab1/class1.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> counts = count_vect.transform(text) tfidf = tfidf_transformer.transform(counts) return model.predict(tfidf) def train_model(self, text, labels): """ This is a SVM that uses tfidf vectors as features. In the future, we want to use a more sophisticated mo...
code_fim
hard
{ "lang": "python", "repo": "Reslix/AutoArxiv", "path": "/autoarxiv/warden/scripts/article_sorting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Reslix/AutoArxiv path: /autoarxiv/warden/scripts/article_sorting.py """ For the time being, the most important heuristic for determining article priority will be based on the presence of authors """ from sklearn import svm from sklearn.feature_extraction.text import CountVectorizer, TfidfTransfor...
code_fim
hard
{ "lang": "python", "repo": "Reslix/AutoArxiv", "path": "/autoarxiv/warden/scripts/article_sorting.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> author_rating = {} for label, l_authors in zip(labels, labeled_authors): for author in l_authors: if author in author_rating: author_rating[author] += label else: author_rating[a...
code_fim
hard
{ "lang": "python", "repo": "Reslix/AutoArxiv", "path": "/autoarxiv/warden/scripts/article_sorting.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ssddawei/badminton_shuttle_in_out path: /video2snaps.py import cv2 import numpy as np import sys <|fim_suffix|>cap.release() cv2.destroyAllWindows()<|fim_middle|>file_name = "video.mp4" file_name = sys.argv[1] cap = cv2.VideoCapture(file_name) cnt = 0 while (cap.isOpened()): cnt += 1 r...
code_fim
hard
{ "lang": "python", "repo": "ssddawei/badminton_shuttle_in_out", "path": "/video2snaps.py", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }