text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: bigdae/pangkyogo path: /myapp/migrations/0011_auto_20190724_2331.py # Generated by Django 2.2.3 on 2019-07-24 23:31 from django.db import migrations <|fim_suffix|> operations = [ migrations.RemoveField( model_name='documentconvert', name='place', ), ...
code_fim
medium
{ "lang": "python", "repo": "bigdae/pangkyogo", "path": "/myapp/migrations/0011_auto_20190724_2331.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pygame.init() screen = pygame.display.set_mode(res, DOUBLEBUF | HWSURFACE | FULLSCREEN) pygame.display.set_caption(title) fpsclk = pygame.time.Clock() last = time.time() while True: for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDO...
code_fim
medium
{ "lang": "python", "repo": "199ChenNuo/taichi_three", "path": "/rubbish.bin/pygame_gui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 199ChenNuo/taichi_three path: /rubbish.bin/pygame_gui.py import time import pygame import taichi as ti import numpy as np from pygame.locals import * def mainloop(res, title, img, render): dat = ti.Vector.field(3, ti.u8, res[::-1]) @ti.kernel def export(): for i, j in d...
code_fim
hard
{ "lang": "python", "repo": "199ChenNuo/taichi_three", "path": "/rubbish.bin/pygame_gui.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> render() export() data = dat.to_numpy() data = pygame.image.frombuffer(data.tobytes('C'), res, 'RGB') screen.blit(data, (0, 0)) pygame.display.flip() fpsclk.tick(60) t = time.time() dt = t - last print(f'({1 / dt:.2f} FPS)') ...
code_fim
hard
{ "lang": "python", "repo": "199ChenNuo/taichi_three", "path": "/rubbish.bin/pygame_gui.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # The following methods perform the necessary subset of # functionality from neutron.api.v2.base.Controller. # # REVISIT(rkukura): Can we just use the WSGI Controller? Using # neutronclient is also a possibility, but presents significant # issues to unit testing as well as overhea...
code_fim
hard
{ "lang": "python", "repo": "jiahaoliang/group-based-policy", "path": "/gbpservice/network/neutronv2/local_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jiahaoliang/group-based-policy path: /gbpservice/network/neutronv2/local_api.py pt 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 law or agreed to in writing, software # distributed unde...
code_fim
hard
{ "lang": "python", "repo": "jiahaoliang/group-based-policy", "path": "/gbpservice/network/neutronv2/local_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _create_sg(self, plugin_context, attrs): return self._create_resource(self._core_plugin, plugin_context, 'security_group', attrs) def _update_sg(self, plugin_context, sg_id, attrs): return self._update_resource(self._core_plugin, plugin_con...
code_fim
hard
{ "lang": "python", "repo": "jiahaoliang/group-based-policy", "path": "/gbpservice/network/neutronv2/local_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: kungfuai/kaishi path: /kaishi/image/transforms/fix_rotation.py """Class definition for fixing image rotation.""" from kaishi.core.pipeline_component import PipelineComponent from kaishi.image.labelers.generic_convnet import LabelerGenericConvnet <|fim_suffix|> def __init__(self): """...
code_fim
hard
{ "lang": "python", "repo": "kungfuai/kaishi", "path": "/kaishi/image/transforms/fix_rotation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param dataset: image dataset to perform operation on :type dataset: :class:`kaishi.image.dataset.ImageDataset` """ if not dataset.labeled: LabelerGenericConvnet()(dataset) dataset.labeled = True for fobj in dataset.files: if fob...
code_fim
hard
{ "lang": "python", "repo": "kungfuai/kaishi", "path": "/kaishi/image/transforms/fix_rotation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for fobj in dataset.files: if fobj.image is None or fobj.has_label("RECTIFIED"): continue if fobj.has_label("ROTATED_RIGHT"): fobj.rotate(90) fobj.remove_label("ROTATED_RIGHT") elif fobj.has_label("ROTATED_LEFT"): ...
code_fim
hard
{ "lang": "python", "repo": "kungfuai/kaishi", "path": "/kaishi/image/transforms/fix_rotation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> initialize() if len(sys.argv) == 1: led(0) else: led(int(sys.argv[1])) if __name__ == "__main__": main()<|fim_prefix|># repo: squareturn/hwsup path: /leds.py #!/usr/bin/python import RPi.GPIO as GPIO import sys LED_RED = 7 # 3 color led on POE HAT LED_GREEN = 22 # 3 color led on POE HAT LE...
code_fim
medium
{ "lang": "python", "repo": "squareturn/hwsup", "path": "/leds.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def led(value): GPIO.output(LED_RJ45, value & 8 != 0) GPIO.output(LED_RED, value & 4 != 0) GPIO.output(LED_GREEN, value & 2 != 0) GPIO.output(LED_BLUE, value & 1 != 0) def main(): initialize() if len(sys.argv) == 1: led(0) else: led(int(sys.argv[1])) if __name__ == "__main__": main()<|fim_pr...
code_fim
medium
{ "lang": "python", "repo": "squareturn/hwsup", "path": "/leds.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: squareturn/hwsup path: /leds.py #!/usr/bin/python import RPi.GPIO as GPIO import sys LED_RED = 7 # 3 color led on POE HAT LED_GREEN = 22 # 3 color led on POE HAT LED_BLUE = 9 # 3 color led on POE HAT LED_RJ45 = 25 # second green led on rj45 connector <|fim_suffix|>def main(): initiali...
code_fim
hard
{ "lang": "python", "repo": "squareturn/hwsup", "path": "/leds.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> jadwalb = JadwalBelajarBareng.objects.all() context = { 'jadwalb' : jadwalb } return render(request, 'prioritas_tinggi.html', context) def prioritas_sedang(request): jadwalb = JadwalBelajarBareng.objects.all() context = { 'jadwalb' : jadwalb } return render(request, 'prioritas_sedang.h...
code_fim
hard
{ "lang": "python", "repo": "dindadiorra/stu-do-list", "path": "/jadwal_belajar_bareng/views.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: dindadiorra/stu-do-list path: /jadwal_belajar_bareng/views.py from django.shortcuts import render, redirect from django.http.response import HttpResponseRedirect from .models import JadwalBelajarBareng from .forms import JadwalForm from django.core import serializers from django.http.respons...
code_fim
medium
{ "lang": "python", "repo": "dindadiorra/stu-do-list", "path": "/jadwal_belajar_bareng/views.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: NSYT0607/DONGKEY path: /recruiting/migrations/0004_auto_20180221_0059.py # Generated by Django 2.0.1 on 2018-02-20 15:59 from django.db import migrations, models class Migration(migrations.Migration): <|fim_suffix|> operations = [ migrations.AlterField( model_name='answe...
code_fim
medium
{ "lang": "python", "repo": "NSYT0607/DONGKEY", "path": "/recruiting/migrations/0004_auto_20180221_0059.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterField( model_name='answer', name='long_answer', field=models.TextField(blank=True, null=True, verbose_name='항목 답변 내용'), ), migrations.AlterField( model_name='answer', name='short_answer',...
code_fim
medium
{ "lang": "python", "repo": "NSYT0607/DONGKEY", "path": "/recruiting/migrations/0004_auto_20180221_0059.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thanosvlo/Twin_Causal_Nets path: /Kenyan_train/calc_prob_twin_kenyan.py preds = model.predict([treatment_factual, treatment_counter, uy_to_input, conf_to_input], args.batch_size, 1) pred_factual = preds[0] pred_counter = preds[1] ...
code_fim
hard
{ "lang": "python", "repo": "thanosvlo/Twin_Causal_Nets", "path": "/Kenyan_train/calc_prob_twin_kenyan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thanosvlo/Twin_Causal_Nets path: /Kenyan_train/calc_prob_twin_kenyan.py .metrics import f1_score import copy def get_test_confs(dataset, args, treatment_factual=None, mode='test'): if mode == 'test': if args.multiple_confounders: conf_to_input = [dataset.test[i].values.a...
code_fim
hard
{ "lang": "python", "repo": "thanosvlo/Twin_Causal_Nets", "path": "/Kenyan_train/calc_prob_twin_kenyan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> N = 10000 uy_samples = dataset.get_uy_samples(N) uy_to_input = uy_samples treatment_factual = np.zeros(N) treatment_counter = np.ones(N) conf_to_input = get_test_confs(dataset, args, treatment_factual=treatment_factual, mode='paper_median') prob_nec_suf_2 = prob_nec_and_suf(...
code_fim
hard
{ "lang": "python", "repo": "thanosvlo/Twin_Causal_Nets", "path": "/Kenyan_train/calc_prob_twin_kenyan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: JPETTomography/j-pet-multiphoton-classification path: /RepairingData/repairingData.py #!/usr/bin/env python3.6 import sys import math import random import pandas as pd def dataFrameNames(): return [ "x1", # 1 gamma detected x position [cm] "y1", # 1 gamma detected y positio...
code_fim
hard
{ "lang": "python", "repo": "JPETTomography/j-pet-multiphoton-classification", "path": "/RepairingData/repairingData.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return rowCopy def main(argv): pathToDataLoad = '/mnt/opt/groups/jpet/NEMA_Image_Quality/3000s/' # pathToDataLoad = '/home/krzemien/workdir/pet/classification/data/' pathToDataSave = argv[1] fileName = 'NEMA_IQ_384str_N0_1000_COINCIDENCES_' part = argv[2] print("Processing f...
code_fim
hard
{ "lang": "python", "repo": "JPETTomography/j-pet-multiphoton-classification", "path": "/RepairingData/repairingData.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Edinburgh-Genome-Foundry/DnaCauldron path: /examples/lcr_assembly/example_with_assembly_plan.py import os import dnacauldron as dc repo = dc.SequenceRepository() files = ["RFP_GFP_plasmid_par<|fim_suffix|>preadsheet(path="assembly_plan.csv") simulation = plan.simulate(repo) stats = simulation.co...
code_fim
medium
{ "lang": "python", "repo": "Edinburgh-Genome-Foundry/DnaCauldron", "path": "/examples/lcr_assembly/example_with_assembly_plan.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>preadsheet(path="assembly_plan.csv") simulation = plan.simulate(repo) stats = simulation.compute_stats() simulation.write_report("output/") print ("Done! see output/ folder for the results.")<|fim_prefix|># repo: Edinburgh-Genome-Foundry/DnaCauldron path: /examples/lcr_assembly/example_with_assembly_pla...
code_fim
medium
{ "lang": "python", "repo": "Edinburgh-Genome-Foundry/DnaCauldron", "path": "/examples/lcr_assembly/example_with_assembly_plan.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Julzpeter/Password-Locker path: /run.py #!/usr/bin/env python3.7 from user import User,Credentials def create_user(uname,password): """ Function to create a bew user """ new_user = User(uname,password) return new_user def save_users(user): """ Fuction to save user ...
code_fim
hard
{ "lang": "python", "repo": "Julzpeter/Password-Locker", "path": "/run.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(): print("Hello Welcome to Password Locker. What is your name?") user_name = input() print(f"Hello {user_name}.") print('\n') while True: print('\n') print("Use these short codes : cc - create a new user, li -to login ") short_code = input().lower()...
code_fim
hard
{ "lang": "python", "repo": "Julzpeter/Password-Locker", "path": "/run.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> function.satTableDynamicValid = True function.ui.satTabWidget.setCurrentIndex(0) function.ui.mainTabWidget.setCurrentIndex(6) function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(2) function.ui.listSatelliteNames.insertRow(0) entry = QTabl...
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/tests/unit_tests/gui/mainWmixin2/test_tabSat_Search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> function.ui.listSatelliteNames.setRowCount(0) function.ui.listSatelliteNames.setColumnCount(9) function.ui.listSatelliteNames.insertRow(0) entry = QTableWidgetItem('sat1') function.ui.listSatelliteNames.setItem(0, 1, entry) function.satTableBaseValid = False function.satTableD...
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/tests/unit_tests/gui/mainWmixin2/test_tabSat_Search.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: mworion/MountWizzard4 path: /tests/unit_tests/gui/mainWmixin2/test_tabSat_Search.py m('test') function.ui.listSatelliteNames.setItem(0, 0, entry) with mock.patch.object(QRect, 'intersects', return_value=False): with mock.patch....
code_fim
hard
{ "lang": "python", "repo": "mworion/MountWizzard4", "path": "/tests/unit_tests/gui/mainWmixin2/test_tabSat_Search.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: nextstrain/ncov path: /scripts/assign_clades.py #!/usr/bin/env python3 """ Obsolete: script that assigns clades to sequences based on clade designations in `defaults/clades.tsv` """ import numpy as np import argparse, sys, os from Bio import AlignIO, SeqIO, Seq, SeqRecord from Bio.AlignIO import ...
code_fim
hard
{ "lang": "python", "repo": "nextstrain/ncov", "path": "/scripts/assign_clades.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> augur_align(aln_args) alignment = AlignIO.read(out_fname, 'fasta') else: done = True for seq in alignment: if seq.id==ref.id: continue if len(seq.seq)!=len(ref.seq): import ipdb; ipdb.set_trace() ...
code_fim
hard
{ "lang": "python", "repo": "nextstrain/ncov", "path": "/scripts/assign_clades.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ref = SeqIO.read(refname, 'genbank') clade_designations = read_in_clade_definitions(f"defaults/clades.tsv") log_fname = "clade_assignment.log" in_fname = "clade_assignment_tmp.fasta" out_fname = "clade_assignment_tmp_alignment.fasta" output = open(args.output, 'w') print('na...
code_fim
hard
{ "lang": "python", "repo": "nextstrain/ncov", "path": "/scripts/assign_clades.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> opts, args = parser.parse_args() BYTES = opts.bytes SIZE = opts.size CONCURRENCY = opts.concurrency funcs = [launch_green_threads] if opts.threading: funcs.append(launch_heavy_threads) print print "measuring results for %d iterations..." % opts.tries print ...
code_fim
hard
{ "lang": "python", "repo": "inercia/evy", "path": "/benchmarks/localhost_socket.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: inercia/evy path: /benchmarks/localhost_socket.py """ Benchmark evaluating evy's performance at speaking to itself over a localhost socket. Profiling and graphs ==================== You can profile this program and obtain a call graph with `gprof2dot` and `graphviz`: ``` python -m cProfile -o ...
code_fim
hard
{ "lang": "python", "repo": "inercia/evy", "path": "/benchmarks/localhost_socket.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def heavy_accepter (server_sock, pool): import threading for i in xrange(CONCURRENCY): sock, addr = server_sock.accept() t = threading.Thread(None, reader, "reader thread", (sock,)) t.start() pool.append(t) threads = [] server_so...
code_fim
hard
{ "lang": "python", "repo": "inercia/evy", "path": "/benchmarks/localhost_socket.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>SQLALCHEMY_TRACK_MODIFICATIONS = False print("here is : ", APP_DIR, DATABASE_PATH, SQLALCHEMY_DATABASE_URI) RESET_API_TOKEN = os.path.exists(os.path.join(APP_DIR, 'reset_api_token'))<|fim_prefix|># repo: light-bringer/PatchServer path: /patchserver/config.py import os SECRET_KEY = os.urandom(32) APP_DI...
code_fim
hard
{ "lang": "python", "repo": "light-bringer/PatchServer", "path": "/patchserver/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>DATABASE_PATH = os.path.join( os.environ.get('DATABASE_DIR', APP_DIR), 'patch_server.db') if os.name == 'nt': SQLALCHEMY_DATABASE_URI = r'sqlite:///{}' .format(DATABASE_PATH) APP_DIR = APP_DIR.replace("\\", "\\\\") SQLALCHEMY_DATABASE_URI = SQLALCHEMY_DATABASE_URI.replace("\\", "\\\\") el...
code_fim
medium
{ "lang": "python", "repo": "light-bringer/PatchServer", "path": "/patchserver/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: light-bringer/PatchServer path: /patchserver/config.py import os SECRET_KEY = os.urandom(32) APP_DIR = os.path.dirname(os.path.realpath(__file__)) <|fim_suffix|>if os.name == 'nt': SQLALCHEMY_DATABASE_URI = r'sqlite:///{}' .format(DATABASE_PATH) APP_DIR = APP_DIR.replace("\\", "\\\\") ...
code_fim
medium
{ "lang": "python", "repo": "light-bringer/PatchServer", "path": "/patchserver/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @source_id.setter def source_id(self, value): self._source_id = value def to_alipay_dict(self): params = dict() if self.apply_note_info: if hasattr(self.apply_note_info, 'to_alipay_dict'): params['apply_note_info'] = self.apply_note_info.to...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/AlipayCommerceEducateInfoParticipantCertifyModel.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: alipay/alipay-sdk-python-all path: /alipay/aop/api/domain/AlipayCommerceEducateInfoParticipantCertifyModel.py #!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.constant.ParamConstants import * from alipay.aop.api.domain.ParticipantInfo import ParticipantInfo class A...
code_fim
hard
{ "lang": "python", "repo": "alipay/alipay-sdk-python-all", "path": "/alipay/aop/api/domain/AlipayCommerceEducateInfoParticipantCertifyModel.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: compserv/hknweb path: /hknweb/candidate/migrations/0005_auto_20220421_0027.py # Generated by Django 2.2.8 on 2022-04-21 07:27 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('events', '0008_attendan...
code_fim
hard
{ "lang": "python", "repo": "compserv/hknweb", "path": "/hknweb/candidate/migrations/0005_auto_20220421_0027.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> migrations.AlterField( model_name='requirementmergerequirement', name='grandTotal', field=models.FloatField(default=0.0, help_text='The grand total points needed from the weighted sum of connected events (only needed for the first node)'), ), migrations...
code_fim
hard
{ "lang": "python", "repo": "compserv/hknweb", "path": "/hknweb/candidate/migrations/0005_auto_20220421_0027.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>erbose_name='ID')), ('enable', models.BooleanField(default=False, help_text='Toggle this entry')), ('multiplier', models.FloatField(default=1)), ('eventType', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='events.EventType')), ...
code_fim
hard
{ "lang": "python", "repo": "compserv/hknweb", "path": "/hknweb/candidate/migrations/0005_auto_20220421_0027.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simuty/python path: /session1/day03/string.py # encoding=utf8 var1 = 'Hello World!' var1 = "Python" # 在 python 中赋值语句总是建立对象的引用值,而不是复制对象。因此,python 变量更像是指针,而不是数据存储区域, print(var1) # 三括号注释 var2 = """ >>> a = "asd" >>> id(a) 4431000496 >>> a = "122" >>> id(a) 4431000552 """ print(var2) <|fim_suffix|>...
code_fim
hard
{ "lang": "python", "repo": "simuty/python", "path": "/session1/day03/string.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># 替换 var11 = "aaaa111222hhhjjjkkk" print(var11.replace("a", "b", 2)) # print(var11.translate()) # translate(table[,deletechars]) # 编码解码 # 编码就是将字符串转换成字节码,涉及到字符串的内部表示。 # 解码就是将字节码转换为字符串,将比特位显示成字符。 var12 = "什么鬼" print(var12.encode()) print(var12.encode().decode()) ''' b'\xe4\xbb\x80\xe4\xb9\x88\xe9\xac\xb...
code_fim
hard
{ "lang": "python", "repo": "simuty/python", "path": "/session1/day03/string.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vipul-Bajaj/jenkins-tui path: /src/jenkins_tui/views/window_view.py from __future__ import annotations from typing import List from textual import events from textual import messages from textual.geometry import Size, SpacingDimensions from textual.widget import Widget from textual.view import ...
code_fim
hard
{ "lang": "python", "repo": "Vipul-Bajaj/jenkins-tui", "path": "/src/jenkins_tui/views/window_view.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def watch_scroll_x(self, value: int) -> None: self.layout.require_update() self.refresh() async def watch_scroll_y(self, value: int) -> None: self.layout.require_update() self.refresh() async def on_resize(self, event: events.Resize) -> None: awa...
code_fim
hard
{ "lang": "python", "repo": "Vipul-Bajaj/jenkins-tui", "path": "/src/jenkins_tui/views/window_view.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RIAPS/riaps-pycom path: /src/riaps/logger/riaps_log_config_test.py #!/usr/bin/python3 ''' Script to test app log config file Created on Oct 20, 2022 Arguments -f (or --file) FILE : Path to the file that will be used to construct the loggers @author: riaps ''' <|fim_suffix|>if __name__ == '__ma...
code_fim
hard
{ "lang": "python", "repo": "RIAPS/riaps-pycom", "path": "/src/riaps/logger/riaps_log_config_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if args.spd: loggers = spdlog_setup.from_file(args.file) else: logging.config.fileConfig(args.file) loggers = logging.root.manager.loggerDict root_logger = logging.getLogger() # get the root logger for logger in loggers: loggers[logger] = loggin...
code_fim
hard
{ "lang": "python", "repo": "RIAPS/riaps-pycom", "path": "/src/riaps/logger/riaps_log_config_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: surgical-vision/servcttk path: /servcttk/iotools.py from pathlib import Path import numpy as np import cv2 import os import errno import json def load_subpix_png(path, scale_factor=256.0): """load one channel images holding decimal information and stored as 16-bit pngs and normalize ...
code_fim
hard
{ "lang": "python", "repo": "surgical-vision/servcttk", "path": "/servcttk/iotools.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: dataset_root_dir ([pathlib.Path, str]): path to datasets's root directory """ root_dir_p = Path(dataset_root_dir) experiment_dirs = sorted([e for e in root_dir_p.iterdir()]) left_paths=[] right_paths=[] occl_paths=[] disparity_paths=[] depth_paths=[] ...
code_fim
hard
{ "lang": "python", "repo": "surgical-vision/servcttk", "path": "/servcttk/iotools.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: artur-varosyan/crossword-generator path: /src/definition_finder.py import requests def find_definition(word): url = f"https://api.dictionaryapi.dev/api/v2/entries/en_GB/{word}" response = requests.get(url) if response.status_code == 404: # if <|fim_suffix|>de == 200: # success ...
code_fim
medium
{ "lang": "python", "repo": "artur-varosyan/crossword-generator", "path": "/src/definition_finder.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>definition = definitions[0]["definition"] return definition else: # Definition could not be found for the given word return f"Definition not found, answer: {word}"<|fim_prefix|># repo: artur-varosyan/crossword-generator path: /src/definition_finder.py import requests def fin...
code_fim
hard
{ "lang": "python", "repo": "artur-varosyan/crossword-generator", "path": "/src/definition_finder.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: 498143049/FlexFlow path: /python/flexflow/torch/model.py # Copyright 2020 Stanford University, Los Alamos National Laboratory # # 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 Licen...
code_fim
hard
{ "lang": "python", "repo": "498143049/FlexFlow", "path": "/python/flexflow/torch/model.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if op_type == OpType.INPUT: assert len(prev_ops_list) == 0, "wrong format" self.tensor_dict[op_name] = input_tensors[input_idx] input_idx += 1 elif op_type == OpType.LINEAR: assert len(items) == 6, "wrong format" assert len(prev_ops_list) == 1, "wrong f...
code_fim
hard
{ "lang": "python", "repo": "498143049/FlexFlow", "path": "/python/flexflow/torch/model.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lhqing/ALLCools path: /ALLCools/motif/dem.py import numpy as np import pandas as pd from scipy.stats import ranksums from sklearn.metrics import roc_curve from statsmodels.stats.multitest import multipletests def _get_optimal_threshold(scores, labels): pos_scores = scores > 0 _labels = ...
code_fim
hard
{ "lang": "python", "repo": "lhqing/ALLCools", "path": "/ALLCools/motif/dem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # P-value correction # noinspection PyUnresolvedReferences p_value = [w.pvalue for w in wilcox_test] judge, q_value, *_ = multipletests(p_value, alpha=alpha) # Motif df motif_df = pd.DataFrame( {"log2_fc": log_fc, "q_value": q_value, "mean_fg": mean_fg, "mean_bg": mean_bg...
code_fim
hard
{ "lang": "python", "repo": "lhqing/ALLCools", "path": "/ALLCools/motif/dem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hypo_motif_hits = pd.DataFrame( fg_mat[keep_motifs_bool] > motif_hit_thresholds[:, None], index=keep_motifs, columns=hypo_score_df.columns ) hyper_motif_hits = pd.DataFrame( bg_mat[keep_motifs_bool] > motif_hit_thresholds[:, None], index=keep_motifs, columns=hyper_score_df.colu...
code_fim
hard
{ "lang": "python", "repo": "lhqing/ALLCools", "path": "/ALLCools/motif/dem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Class describing mikrotik entities.""" icon_enabled: str = "" icon_disabled: str = "" ha_group: str = "" ha_connection: str = "" ha_connection_value: str = "" data_path: str = "" data_attribute: str = "available" data_name: str = "" data_name_comment: bool = Fal...
code_fim
hard
{ "lang": "python", "repo": "tomaae/homeassistant-mikrotik_router", "path": "/custom_components/mikrotik_router/binary_sensor_types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> SENSOR_TYPES = { "system_ups": MikrotikBinarySensorEntityDescription( key="system_ups", name="UPS", icon_enabled="", icon_disabled="", device_class=BinarySensorDeviceClass.POWER, entity_category=EntityCategory.DIAGNOSTIC, ha_group="System", ...
code_fim
hard
{ "lang": "python", "repo": "tomaae/homeassistant-mikrotik_router", "path": "/custom_components/mikrotik_router/binary_sensor_types.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: tomaae/homeassistant-mikrotik_router path: /custom_components/mikrotik_router/binary_sensor_types.py """Definitions for Mikrotik Router binary sensor entities.""" from dataclasses import dataclass, field from typing import List from homeassistant.helpers.device_registry import CONNECTION_NETWORK_...
code_fim
hard
{ "lang": "python", "repo": "tomaae/homeassistant-mikrotik_router", "path": "/custom_components/mikrotik_router/binary_sensor_types.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Red-Teapot/mc-commandblock-1.13-update path: /commands/upgrader/commands/gc.py from commands.pre_1_13.cmdex import CMDEx from commands.upgrader.utils import command_upgrader_base from ..utils import selector CMDEXS = [ CMDEx('gc help'), CMDEx('gc reload'), CMDEx('gc fulllevelup {se...
code_fim
hard
{ "lang": "python", "repo": "Red-Teapot/mc-commandblock-1.13-update", "path": "/commands/upgrader/commands/gc.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> CMDEx('gc fulllevelup {selector:player}'), CMDEx('gc resetinfo {selector:player}'), CMDEx('gc getclan {selector:player}'), CMDEx('gc getguild {selector:player}'), CMDEx('gc getlevel {selector:player}'), CMDEx('gc gotoguild {selector:player} {str:guild}'), CMDEx('gc setclan {s...
code_fim
medium
{ "lang": "python", "repo": "Red-Teapot/mc-commandblock-1.13-update", "path": "/commands/upgrader/commands/gc.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ """ pass class TestGenData(unittest.TestCase): """Tests for data generation script.""" def test_run_grid(self): """ """ pass def test_run_merge(self): """ """ pass def test_run_ring(self): """ ...
code_fim
hard
{ "lang": "python", "repo": "AboudyKreidieh/traffic-autocalibration", "path": "/tests/fast_tests/test_data_collection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AboudyKreidieh/traffic-autocalibration path: /tests/fast_tests/test_data_collection.py import unittest class TestEnvs(unittest.TestCase): """Tests for the environment generation methods.""" def test_grid_env(self): """ """ pass def test_merge_env(self): ...
code_fim
hard
{ "lang": "python", "repo": "AboudyKreidieh/traffic-autocalibration", "path": "/tests/fast_tests/test_data_collection.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_run_ring(self): """ """ pass if __name__ == '__main__': unittest.main()<|fim_prefix|># repo: AboudyKreidieh/traffic-autocalibration path: /tests/fast_tests/test_data_collection.py import unittest class TestEnvs(unittest.TestCase): """Tests for the environm...
code_fim
hard
{ "lang": "python", "repo": "AboudyKreidieh/traffic-autocalibration", "path": "/tests/fast_tests/test_data_collection.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def psd(x: np.ndarray, fs: int, zeropadfact: float = 1, wintype=np.hanning): """ https://www.mathworks.com/help/signal/ug/psd-estimate-using-fft.html take 10*log10(Pxx) for [dB/Hz] """ nt = x.size win = wintype(nt) nfft = int(zeropadfact * nt) X = np.fft.fft(win * x, nf...
code_fim
hard
{ "lang": "python", "repo": "scivision/tincanradar", "path": "/tincanradar/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: scivision/tincanradar path: /tincanradar/__init__.py #!/usr/bin/env python """ Computes the min/max FMCW beat frequency expected for a given range vs. sweep time and RF bandwidth You might consider planning your sweep frequency and beat frequencies to land within the range of a PC sound card, sa...
code_fim
hard
{ "lang": "python", "repo": "scivision/tincanradar", "path": "/tincanradar/__init__.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def ssq(x: np.ndarray, axis=None): """ sum-of-squares this method is ~10% faster than (abs(x)**2).sum() """ x = np.asarray(x) return (x * x.conj()).real.sum(axis) def snrest(noisy: np.ndarray, noise: np.ndarray, axis=None): """ Computes SNR [in dB] when you have: ...
code_fim
hard
{ "lang": "python", "repo": "scivision/tincanradar", "path": "/tincanradar/__init__.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brendan-rius/simplefsabstraction path: /tests/test_simpleFS.py from unittest import TestCase from simplefsabstraction import SimpleFS <|fim_suffix|> def test_allowed_extension_fails(self): self.assertFalse(SimpleFS._check_extension('abc.png', ['jpg'])) def test_allowed_extension...
code_fim
easy
{ "lang": "python", "repo": "brendan-rius/simplefsabstraction", "path": "/tests/test_simpleFS.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_allowed_extension_fails(self): self.assertFalse(SimpleFS._check_extension('abc.png', ['jpg'])) def test_allowed_extension_succeed(self): self.assertTrue(SimpleFS._check_extension('abc.png', ['png']))<|fim_prefix|># repo: brendan-rius/simplefsabstraction path: /tests/test...
code_fim
easy
{ "lang": "python", "repo": "brendan-rius/simplefsabstraction", "path": "/tests/test_simpleFS.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Azure-Samples/ms-identity-python-webapp path: /app_config_b2c.py import os b2c_tenant = os.getenv('TENANT_NAME') signupsignin_user_flow = os.getenv('SIGNUPSIGNIN_USER_FLOW') editprofile_user_flow = os.getenv('EDITPROFILE_USER_FLOW') resetpassword_user_flow = os.getenv('RESETPASSWORD_USER_FLOW')...
code_fim
hard
{ "lang": "python", "repo": "Azure-Samples/ms-identity-python-webapp", "path": "/app_config_b2c.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Application (client) ID of app registration CLIENT_ID = os.getenv("CLIENT_ID") # Application's generated client secret: never check this into source control! CLIENT_SECRET = os.getenv("CLIENT_SECRET") AUTHORITY = authority_template.format(tenant=b2c_tenant, user_flow=signupsignin_user_flow) B2C_PROFILE...
code_fim
medium
{ "lang": "python", "repo": "Azure-Samples/ms-identity-python-webapp", "path": "/app_config_b2c.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print("pred") all_dir = os.path.join(predicted_path, "all") Path(all_dir).mkdir(parents=True, exist_ok=True) sub = all_pred[name] print(sub.shape[0]) if name == "train" or name == "valid": sub = sub[~sub.iloc[:, 0].isin(test_sentences)] print(sub.shape[0]) path = os...
code_fim
hard
{ "lang": "python", "repo": "Karexar/gsw_language_model", "path": "/preprocessing/dialect_lm/split_dialects.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Karexar/gsw_language_model path: /preprocessing/dialect_lm/split_dialects.py # This scripts performs two split # The first group the labelled dataset per dialect and split into train, valid, # and test set. # The second does the same, but on the predictions from the entire twitter # module. ### ...
code_fim
hard
{ "lang": "python", "repo": "Karexar/gsw_language_model", "path": "/preprocessing/dialect_lm/split_dialects.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kudeh/automate-the-boring-stuff-projects path: /excel-to-csv-converter/excelToCsv.py #! python3 # excelToCsv.py # Author: Kene Udeh # Source: Automate the Boring stuff with python Ch. 14 Project import os import csv import openpyxl def excelToCsv(folder): <|fim_suffix|> # Loop thr...
code_fim
hard
{ "lang": "python", "repo": "kudeh/automate-the-boring-stuff-projects", "path": "/excel-to-csv-converter/excelToCsv.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for sheetName in wb.get_sheet_names(): # Loop through every sheet in the workbook. sheet = wb.get_sheet_by_name(sheetName) # Create the CSV filename from the Excel filename and sheet title. csvFilename = excelFile.split('.')[0]+'_'+sheet.title+'.csv...
code_fim
hard
{ "lang": "python", "repo": "kudeh/automate-the-boring-stuff-projects", "path": "/excel-to-csv-converter/excelToCsv.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>[1] == maior: print(f'{contador[0]} ',end=' ') print(f'O menor peso é {menor}, essas pessoas são ',end='') for contador in lista: if contador[1] == menor: print(f'{contador[0]} ',end=' ')<|fim_prefix|># repo: kaio358/Python path: /Mundo3/Lista/Desafio#84.py pessoa =[] lista = [] maior...
code_fim
hard
{ "lang": "python", "repo": "kaio358/Python", "path": "/Mundo3/Lista/Desafio#84.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kaio358/Python path: /Mundo3/Lista/Desafio#84.py pessoa =[] lista = [] maior = menor = 0 continuar = 's' while continuar not in 'Nn': pessoa.append(str(input('Informe o nome : '))) pessoa.append(float(input('Informe o peso : '))) if maior == <|fim_suffix|>[1] == maior: print(...
code_fim
hard
{ "lang": "python", "repo": "kaio358/Python", "path": "/Mundo3/Lista/Desafio#84.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Python3pkg/Astrodb path: /astrodb/queries.py # -*- coding: utf-8 -*- """ Some stuff to query and populate the database """ # python imports # import decimal # Scientific imports import numpy as np import pandas as pd from decimal import Decimal from decimal import getcontext # Astronomical imp...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/Astrodb", "path": "/astrodb/queries.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def extractdata(id): temp = {} # Getting the parameters from the tables. for key in list(Database.keys()): val = {} for attr in Database[key]: params = [] if attr == 'starid' or attr == 'idstar': continue if key == 'Star': ...
code_fim
hard
{ "lang": "python", "repo": "Python3pkg/Astrodb", "path": "/astrodb/queries.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: RxJellyBot/Jelly-Bot path: /tests/integration/mongodb/results/exctnt.py from datetime import datetime from typing import Type from bson import ObjectId from django.urls import reverse from JellyBot.systemconfig import HostUrl from models import Model, ExtraContentModel from mongodb.factory.resu...
code_fim
hard
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/tests/integration/mongodb/results/exctnt.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_url(self): oid = ObjectId() mdl = ExtraContentModel(Content="AAAAA", Timestamp=TestRecordExtraContentResult.TS, ChannelOid=ObjectId()) mdl.set_oid(oid) r = RecordExtraContentResult(WriteOutcome.O_INSERTED, model=mdl) self.assertEqual(r.url, f'{HostU...
code_fim
hard
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/tests/integration/mongodb/results/exctnt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_model_id(self): oid = ObjectId() mdl = ExtraContentModel(Content="AAAAA", Timestamp=TestRecordExtraContentResult.TS, ChannelOid=ObjectId()) mdl.set_oid(oid) r = RecordExtraContentResult(WriteOutcome.O_INSERTED, model=mdl) self.assertEqual(r.model_id...
code_fim
hard
{ "lang": "python", "repo": "RxJellyBot/Jelly-Bot", "path": "/tests/integration/mongodb/results/exctnt.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Fetches the dependency if necessary. :return: The path to the resolved dependency as a string. """ # Store the current source in the dependency object self.dependency.current_source = self.source # Use the first 6 characters of the SHA1 hash of...
code_fim
medium
{ "lang": "python", "repo": "steinwurf/waf", "path": "/src/wurf/http_resolver.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if self.dependency.filename: filename = self.dependency.filename else: filename = None file_path = self.url_download.download( cwd=folder_path, source=self.source, filename=filename ) assert os.path.isfile(file_path), "We should...
code_fim
hard
{ "lang": "python", "repo": "steinwurf/waf", "path": "/src/wurf/http_resolver.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: steinwurf/waf path: /src/wurf/http_resolver.py #! /usr/bin/env python # encoding: utf-8 import os import hashlib class HttpResolver(object): """ Http Resolver functionality. Downloads a file. """ def __init__(self, url_download, dependency, source, cwd): """Construct ...
code_fim
medium
{ "lang": "python", "repo": "steinwurf/waf", "path": "/src/wurf/http_resolver.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MLEveryday/100-Days-Of-ML-Code path: /Code/TestKafka.py #!/usr/bin/python from kafka import KafkaConsumer; kafkaHosts=["kafka01.paas.longfor.sit:9092" ,"kafka02.paas.longfor.sit:9092" ,"kafka03.paas.longfor.sit:9092"] <|fim_suffix|>consumer.subscribe("testapplog_plm-pr...
code_fim
hard
{ "lang": "python", "repo": "MLEveryday/100-Days-Of-ML-Code", "path": "/Code/TestKafka.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>consumer.subscribe("testapplog_plm-prototype"); for msg in consumer: print(msg.value)<|fim_prefix|># repo: MLEveryday/100-Days-Of-ML-Code path: /Code/TestKafka.py #!/usr/bin/python from kafka import KafkaConsumer; kafkaHosts=["kafka01.paas.longfor.sit:9092" ,"kafka02.paas.longfor.sit:...
code_fim
hard
{ "lang": "python", "repo": "MLEveryday/100-Days-Of-ML-Code", "path": "/Code/TestKafka.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0202-Happy-Number/soln.py class Solution: def isHappy(self, n: int) -> bool: <|fim_suffix|> slow = func(n); fast = func(func(n)); while slow != fast: slow = func(slow) fast = func(func(fast)) if...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/0202-Happy-Number/soln.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> slow = func(n); fast = func(func(n)); while slow != fast: slow = func(slow) fast = func(func(fast)) if slow == 1: return True else: return False<|fim_prefix|># repo: wyaadarsh/LeetCode-Solutions path: /Python3/0202-Ha...
code_fim
hard
{ "lang": "python", "repo": "wyaadarsh/LeetCode-Solutions", "path": "/Python3/0202-Happy-Number/soln.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geiyer/python path: /Module03/environment-model.py from diagrams import Cluster, Diagram, Edge from diagrams.aws.compute import EC2, ECS from diagrams.aws.network import ELB, Route53 from diagrams.aws.database import RDS <|fim_suffix|> with Diagram("Environment-Model", show = False, graph_attr= ...
code_fim
medium
{ "lang": "python", "repo": "geiyer/python", "path": "/Module03/environment-model.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with Cluster("Beta Testing"): dns = Route53("DNS") lb = ELB("Load Balancer") with Cluster("Web Cluster"): web1 = EC2("Server 1") web2 = EC2("Server 2") with Cluster("Database Cluster"): db_master = RDS("Master") db_master ...
code_fim
hard
{ "lang": "python", "repo": "geiyer/python", "path": "/Module03/environment-model.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tekknolagi/pyc-1 path: /lib/bisect.py def insort_right(a, x, lo=0, hi=0): a.append(x) def insort_left(a, x, lo=0, hi=0): a.append(x) def insort(a, x, lo=0, hi=0): a.append(x) def bisect_right(a, x, lo=0, hi=0): <|fim_suffix|> return 1 def bisect(a, x, lo=0, hi=0): return 1<|fi...
code_fim
easy
{ "lang": "python", "repo": "tekknolagi/pyc-1", "path": "/lib/bisect.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> a.append(x) def insort(a, x, lo=0, hi=0): a.append(x) def bisect_right(a, x, lo=0, hi=0): return 1 def bisect_left(a, x, lo=0, hi=0): return 1 def bisect(a, x, lo=0, hi=0): return 1<|fim_prefix|># repo: tekknolagi/pyc-1 path: /lib/bisect.py def insort_right(a, x, lo=0, hi=0): <|fim_m...
code_fim
easy
{ "lang": "python", "repo": "tekknolagi/pyc-1", "path": "/lib/bisect.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tekknolagi/pyc-1 path: /lib/bisect.py def insort_right(a, x, lo=0, hi=0): <|fim_suffix|>def bisect_right(a, x, lo=0, hi=0): return 1 def bisect_left(a, x, lo=0, hi=0): return 1 def bisect(a, x, lo=0, hi=0): return 1<|fim_middle|> a.append(x) def insort_left(a, x, lo=0, hi=0): a...
code_fim
medium
{ "lang": "python", "repo": "tekknolagi/pyc-1", "path": "/lib/bisect.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: nstockton/mume-emu path: /terminalsize.py #!/usr/bin/env python # This module adapted from: # https://gist.github.com/1108174.git import os import platform import shlex import struct import subprocess OS_NAME = platform.system() if OS_NAME == "Windows": import ctypes else: ...
code_fim
hard
{ "lang": "python", "repo": "nstockton/mume-emu", "path": "/terminalsize.py", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>def _get_terminal_size_tput(): """get terminal width src: http://stackoverflow.com/questions/263890/how-do-i-find-the-width-height-of-a-terminal-window """ try: cols = int(subprocess.check_call(shlex.split('tput cols'))) rows = int(subprocess.check_call(shlex.split('tput lines'))) return...
code_fim
hard
{ "lang": "python", "repo": "nstockton/mume-emu", "path": "/terminalsize.py", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|># repo: wuyadie/envpool path: /envpool/atari/atari_envpool_test.py # Copyright 2021 Garena Online Private Limited # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http:...
code_fim
hard
{ "lang": "python", "repo": "wuyadie/envpool", "path": "/envpool/atari/atari_envpool_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_raw_envpool(self) -> None: conf = dict( zip(_AtariEnvSpec._config_keys, _AtariEnvSpec._default_config_values) ) conf["task"] = b"pong" conf["num_envs"] = num_envs = 3 conf["batch_size"] = batch = 3 conf["num_threads"] = 3 # os.cpu_count() # conf["episodic_lif...
code_fim
hard
{ "lang": "python", "repo": "wuyadie/envpool", "path": "/envpool/atari/atari_envpool_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }