text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>@click.command() @click.option('-v', '--version', is_flag=True, callback=print_version, expose_value=False, is_eager=True, help='本软件版本') @click.option('-V', '--verbose', is_flag=True, is_eager=True, callback=enable_debug, expose_value=False, help='打印输出冗余信息') def main(): ...
code_fim
hard
{ "lang": "python", "repo": "a358003542/yaogua", "path": "/yaogua/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> logging.basicConfig(level=logging.DEBUG) @click.command() @click.option('-v', '--version', is_flag=True, callback=print_version, expose_value=False, is_eager=True, help='本软件版本') @click.option('-V', '--verbose', is_flag=True, is_eager=True, callback=enable_debug, ex...
code_fim
medium
{ "lang": "python", "repo": "a358003542/yaogua", "path": "/yaogua/__main__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/qpid-cpp path: /src/tests/linearstore/python_tests/store_test.py "" amqp_session = self.__broker.getAmqpSession() amqp_session.queue_delete(queue_name) def _query(self, name, _class, package, alt_exchange_name=None): """Qmf query function which can optionally l...
code_fim
hard
{ "lang": "python", "repo": "apache/qpid-cpp", "path": "/src/tests/linearstore/python_tests/store_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: apache/qpid-cpp path: /src/tests/linearstore/python_tests/store_test.py r of messages on a queue""" queue_list = self.__session.getObjects(_class="queue", _name=queue_name) if len(queue_list): return queue_list[0].msgDepth def queue_empty(self, queue_name): ...
code_fim
hard
{ "lang": "python", "repo": "apache/qpid-cpp", "path": "/src/tests/linearstore/python_tests/store_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @staticmethod def _fmt_csv(string_list, list_braces = None): """Format a list using comma-separation. Braces are optionally added.""" if len(string_list) == 0: return "" first = True str_ = "" if list_braces != None: str_ += list_brac...
code_fim
hard
{ "lang": "python", "repo": "apache/qpid-cpp", "path": "/src/tests/linearstore/python_tests/store_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return False class CipherV1(Cipher): def gen_iv(self, size=AES.block_size): return super(CipherV1, self).gen_iv(size) def _pad(self, data): if type(data) is bytes: data = data.decode() pad_length = AES.block_size - len(data) % AES.block_size r...
code_fim
hard
{ "lang": "python", "repo": "thetimpanist/pychef", "path": "/chef/encrypted_data_bag.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: thetimpanist/pychef path: /chef/encrypted_data_bag.py from chef.data_bag import DataBag, DataBagItem from chef.exceptions import ChefError, ChefServerNotFoundError from chef.utils import json from chef.api import ChefAPI from base64 import b64encode, b64decode from Crypto.Cipher import AES from ...
code_fim
hard
{ "lang": "python", "repo": "thetimpanist/pychef", "path": "/chef/encrypted_data_bag.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>print("String : [][]]] Balanced or not?") print(balanced_paren("[][]]]")) print("String : [][] Balanced or not?") print(balanced_paren("[][]"))<|fim_prefix|># repo: Ikshitkate/java-html-5-new-project path: /python/Stack/stack_blncd_paranthesis.py # building Stack class Stack: def __init__(self): ...
code_fim
hard
{ "lang": "python", "repo": "Ikshitkate/java-html-5-new-project", "path": "/python/Stack/stack_blncd_paranthesis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ikshitkate/java-html-5-new-project path: /python/Stack/stack_blncd_paranthesis.py # building Stack class Stack: def __init__(self): self.items = [] def push(self, item): self.items.append(item) def is_empty(self): return self.items == [] def pop...
code_fim
hard
{ "lang": "python", "repo": "Ikshitkate/java-html-5-new-project", "path": "/python/Stack/stack_blncd_paranthesis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: henribru/google-ads-stubs path: /google-stubs/ads/googleads/v13/enums/types/change_status_resource_type.pyi from typing import Any import proto class ChangeStatusResourceTypeEnum(proto.Message): <|fim_suffix|> self, mapping: Any | None = ..., *, ignore_unknown_fie...
code_fim
hard
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v13/enums/types/change_status_resource_type.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> UNSPECIFIED = 0 UNKNOWN = 1 AD_GROUP = 3 AD_GROUP_AD = 4 AD_GROUP_CRITERION = 5 CAMPAIGN = 6 CAMPAIGN_CRITERION = 7 FEED = 9 FEED_ITEM = 10 AD_GROUP_FEED = 11 CAMPAIGN_FEED = 12 AD_GROUP_BID_MODIFIER = 13 ...
code_fim
medium
{ "lang": "python", "repo": "henribru/google-ads-stubs", "path": "/google-stubs/ads/googleads/v13/enums/types/change_status_resource_type.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class CNNSpider(BaseSpider): def __init__(self, url_manager: BaseURLManager, maximum=-1): super().__init__(url_manager, maximum) def parse(self, url) -> Article: html = get_html(url) # 构造解析器 soup = BeautifulSoup(html, features="html.parser") # 获取内容 ...
code_fim
hard
{ "lang": "python", "repo": "POA-WHU/POA-spiders", "path": "/src/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return urls class CNNSpider(BaseSpider): def __init__(self, url_manager: BaseURLManager, maximum=-1): super().__init__(url_manager, maximum) def parse(self, url) -> Article: html = get_html(url) # 构造解析器 soup = BeautifulSoup(html, features="html.parser") ...
code_fim
hard
{ "lang": "python", "repo": "POA-WHU/POA-spiders", "path": "/src/CNN.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: POA-WHU/POA-spiders path: /src/CNN.py from json import loads from bs4 import BeautifulSoup from base import * # 构建映射url->article _url2atc = dict() class CNNURLManager(BaseURLManager): def __init__(self, start_page=1, end_page=-1): super().__init__(start_page, end_page) def ...
code_fim
hard
{ "lang": "python", "repo": "POA-WHU/POA-spiders", "path": "/src/CNN.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BingAds/BingAds-Python-SDK path: /bingads/v13/bulk/entities/bulk_ad_customizer_attribute_entity_base.py from bingads.service_client import _CAMPAIGN_OBJECT_FACTORY_V13 from bingads.v13.internal.bulk.string_table import _StringTable from bingads.v13.internal.bulk.entities.single_record_bulk_entity...
code_fim
hard
{ "lang": "python", "repo": "BingAds/BingAds-Python-SDK", "path": "/bingads/v13/bulk/entities/bulk_ad_customizer_attribute_entity_base.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @name.setter def name(self, value): self._name = value @property def attribute_value(self): """ the value of ad customizer attribute Corresponds to the 'AdCustomizer AttributeValue' field in the bulk file. :rtype: str """ return s...
code_fim
hard
{ "lang": "python", "repo": "BingAds/BingAds-Python-SDK", "path": "/bingads/v13/bulk/entities/bulk_ad_customizer_attribute_entity_base.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # areas of interest within model to break out as separate observation groups geographic_groups = [test_data_path / 'extents/CompositeHydrographArea.shp', test_data_path / 'extents/MAP_generalized_regions.shp' ] # read the data data_orig, m...
code_fim
hard
{ "lang": "python", "repo": "hulaba/usgs-map-gwmodels", "path": "/mapgwm/tests/test_headobs.py", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hulaba/usgs-map-gwmodels path: /mapgwm/tests/test_headobs.py import os import numpy as np from mapgwm.headobs import preprocess_headobs, get_data def test_preprocess_headobs(test_output_folder, test_data_path): # input files #data_file = os.path.join(test_data_path, 'headobs', 'GW_month...
code_fim
hard
{ "lang": "python", "repo": "hulaba/usgs-map-gwmodels", "path": "/mapgwm/tests/test_headobs.py", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> # Es wird eine Schleife ausgeführt, welche dafür sorgt das permant ein neuer Block entsteht while not self.shutdown: # Es wird eine liste offener Transaktionen aus dem Memorypool extrahiert cur_transactions = getTxnsFromPool(self.cha...
code_fim
hard
{ "lang": "python", "repo": "ApollonChain/ApollonCore", "path": "/apollon/miner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ApollonChain/ApollonCore path: /apollon/miner.py # Extrahiert die Transaktionen aus dem Mempool def getTxnsFromPool(MasterObj): rwo = list() for i in MasterObj.mempool: rwo.append(i); MasterObj.mempool.remove(i); print('Transaction {} selected'.format(i.getTxHash())) return rwo ...
code_fim
hard
{ "lang": "python", "repo": "ApollonChain/ApollonCore", "path": "/apollon/miner.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # Es wird geprüft ob der Block laut der Blockchain Regeln Valide ist assert constructed_block.isValidateObject() == True # Es wird geprüft ob alle Transaktionen zulässig sind assert constructed_block.validateBlockTransactions() == True # Der Mining Prozess w...
code_fim
hard
{ "lang": "python", "repo": "ApollonChain/ApollonCore", "path": "/apollon/miner.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # generated_urls = {"default" : "https://image.ibb.co/d01nFy/front.png", # "back" : "https://image.ibb.co/eTxr8J/back.png", # "sleeve_left" : "https://image.ibb.co/mMM18J/left.png", # "sleeve_right" : "https://image.ibb.co/hYeooJ/right.png"} generated_urls = {"default" : DMN + "f...
code_fim
hard
{ "lang": "python", "repo": "sshnaidm/hackextend", "path": "/draw.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: sshnaidm/hackextend path: /draw.py #!/usr/bin/python3 import json import os import random import requests from time import sleep from PIL import Image, ImageDraw PICS = 'static/pics/' DMN = 'https://techshirt-sergeysh.c9users.io/pics/' #logos = ["red", "green", "blue", "orange", "pink", "purpl...
code_fim
hard
{ "lang": "python", "repo": "sshnaidm/hackextend", "path": "/draw.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> queryset = ProductSize.objects.all() pagination_class = StandardResultsSetPagination serializer_class = ProductSizeSerializer search_fields = ( 'product__id', )<|fim_prefix|># repo: reimibeta/django-product-models path: /product_models/class_views/product_size_view_set.py from...
code_fim
medium
{ "lang": "python", "repo": "reimibeta/django-product-models", "path": "/product_models/class_views/product_size_view_set.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class ProductSizeViewSet(viewsets.ModelViewSet): queryset = ProductSize.objects.all() pagination_class = StandardResultsSetPagination serializer_class = ProductSizeSerializer search_fields = ( 'product__id', )<|fim_prefix|># repo: reimibeta/django-product-models path: /produc...
code_fim
medium
{ "lang": "python", "repo": "reimibeta/django-product-models", "path": "/product_models/class_views/product_size_view_set.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: reimibeta/django-product-models path: /product_models/class_views/product_size_view_set.py from django_rest_framework.pagination import StandardResultsSetPagination from rest_framework import viewsets from product_models.class_models.product_size import ProductSize from product_models.class_seri...
code_fim
medium
{ "lang": "python", "repo": "reimibeta/django-product-models", "path": "/product_models/class_views/product_size_view_set.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> elif isinstance(error, commands.NotOwner): embed = discord.Embed(title=f"You are not the owner of this bot!", color=self.bot.embed_error_color) await ctx.send(embed=embed) elif isinstance(error, commands.CommandOnCooldown): ...
code_fim
hard
{ "lang": "python", "repo": "awasedo/krumelur", "path": "/cogs/errors.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: awasedo/krumelur path: /cogs/errors.py import discord import sys from discord.ext import commands class Errors(commands.Cog): def __init__(self, bot): self.bot = bot @commands.Cog.listener() async def on_command_error(self, ctx, error): if hasattr(ctx.command, "on_e...
code_fim
hard
{ "lang": "python", "repo": "awasedo/krumelur", "path": "/cogs/errors.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>apacheMIBObjects = MibIdentifier((1, 3, 6, 1, 4, 1, 4, 1)) apScoreBoardTable = MibTable((1, 3, 6, 1, 4, 1, 4, 1, 1), ) if mibBuilder.loadTexts: apScoreBoardTable.setStatus('current') apScoreBoardEntry = MibTableRow((1, 3, 6, 1, 4, 1, 4, 1, 1, 1), ).setIndexNames((0, "APACHE-MIB", "apScoreBoardIndex")) if ...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/APACHE-MIB.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: agustinhenze/mibs.snmplabs.com path: /pysnmp/APACHE-MIB.py # # PySNMP MIB module APACHE-MIB (http://snmplabs.com/pysmi) # ASN.1 source file:///Users/davwang4/Dev/mibs.snmplabs.com/asn1/APACHE-MIB # Produced by pysmi-0.3.4 at Mon Apr 29 17:07:13 2019 # On host DAVWANG4-M-1475 platform Darwin versi...
code_fim
hard
{ "lang": "python", "repo": "agustinhenze/mibs.snmplabs.com", "path": "/pysnmp/APACHE-MIB.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: shazz/micropython path: /examples/meowbit/test_bmp.py import pyb import framebuf import image <|fim_suffix|>img = image.Image(fb) img.loadbmp("images/test24.bmp") tft.show(fb)<|fim_middle|>fbuf = bytearray(160*128*2) tft = pyb.SCREEN() fb = framebuf.FrameBuffer(fbuf, 160, 128, framebuf.RGB565, 1...
code_fim
medium
{ "lang": "python", "repo": "shazz/micropython", "path": "/examples/meowbit/test_bmp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>img = image.Image(fb) img.loadbmp("images/test24.bmp") tft.show(fb)<|fim_prefix|># repo: shazz/micropython path: /examples/meowbit/test_bmp.py import pyb import framebuf import image <|fim_middle|>fbuf = bytearray(160*128*2) tft = pyb.SCREEN() fb = framebuf.FrameBuffer(fbuf, 160, 128, framebuf.RGB565, 1...
code_fim
medium
{ "lang": "python", "repo": "shazz/micropython", "path": "/examples/meowbit/test_bmp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Run interface scripts. Context: all devices mounted. run_script('01_inventory_dismount_atomic') while EX_OK == run_script('01_device_connect'): continue run_script('03_interface_names') run_script('03_management_interface') run_script('03_interface_configuration') run_script('03_interface_configurat...
code_fim
hard
{ "lang": "python", "repo": "djordjevulovic/cosc-learning-labs", "path": "/src/learning_lab/03_interface_suite.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: djordjevulovic/cosc-learning-labs path: /src/learning_lab/03_interface_suite.py #!/usr/bin/env python2.7 # Copyright 2015 Cisco Systems, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with # the License. You may obtain a c...
code_fim
medium
{ "lang": "python", "repo": "djordjevulovic/cosc-learning-labs", "path": "/src/learning_lab/03_interface_suite.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eric-Hsieh97/2019ChallengeEntries path: /ywangda/sepsis_challenge/architect.py import keras from keras.models import Model from keras.layers import Dense, Conv2D, BatchNormalization, Activation from keras.layers import Input, MaxPooling2D, Dropout, Flatten from keras import regularizers from met...
code_fim
hard
{ "lang": "python", "repo": "Eric-Hsieh97/2019ChallengeEntries", "path": "/ywangda/sepsis_challenge/architect.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> x = BatchNormalization()(x) x = Dropout(0.5)(x) x = Flatten()(x) x = Dense(args.num_features, kernel_initializer='he_normal', kernel_regularizer=regularizers.l2(weight_decay))(x) x = BatchNormalization()(x) output = SphereFace(10, regularizer=regularizers.l2(weight_...
code_fim
hard
{ "lang": "python", "repo": "Eric-Hsieh97/2019ChallengeEntries", "path": "/ywangda/sepsis_challenge/architect.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: AnnaLamadua/dynwebsite_withDjango path: /simplesite/views.py # -*- coding:utf8 -*- from django.http import Http404 from django.views.generic import DetailView from simplesite.models import Page class PageBaseDetailView(DetailView): """ Base View model specification. The remain views, w...
code_fim
hard
{ "lang": "python", "repo": "AnnaLamadua/dynwebsite_withDjango", "path": "/simplesite/views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_template_names(self): return [ "simplesite/page_{0}.html".format(self.kwargs.get('slug')), "simplesite/{0}_page.html".format(self.kwargs.get('slug')), "simplesite/page_detail.html", ]<|fim_prefix|># repo: AnnaLamadua/dynwebsite_withDjango pa...
code_fim
hard
{ "lang": "python", "repo": "AnnaLamadua/dynwebsite_withDjango", "path": "/simplesite/views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wagtailcommerce/wagtailcommerce path: /wagtailcommerce/promotions/migrations/0006_auto_20180317_1509.py # -*- coding: utf-8 -*- # Generated by Django 1.11.4 on 2018-03-17 18:09 from __future__ import unicode_literals <|fim_suffix|> class Migration(migrations.Migration): dependencies = [ ...
code_fim
medium
{ "lang": "python", "repo": "wagtailcommerce/wagtailcommerce", "path": "/wagtailcommerce/promotions/migrations/0006_auto_20180317_1509.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='coupon', name='added_to_cart', field=models.PositiveIntegerField(default=0, editable=False), ), migrations.AlterField( model_name='coupon', name='coupon_mode', ...
code_fim
medium
{ "lang": "python", "repo": "wagtailcommerce/wagtailcommerce", "path": "/wagtailcommerce/promotions/migrations/0006_auto_20180317_1509.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: herberthamaral/scrapy path: /scrapy/tests/test_contrib_exp_crawlspider_reqgen.py from twisted.internet import defer from twisted.trial import unittest from scrapy.http import Request from scrapy.http import HtmlResponse from scrapy.utils.python import equal_attributes from scrapy.contrib_exp.cr...
code_fim
hard
{ "lang": "python", "repo": "herberthamaral/scrapy", "path": "/scrapy/tests/test_contrib_exp_crawlspider_reqgen.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # extract all requests reqgen = RequestGenerator(extractors, [], callback=self.deferred) requests = reqgen.generate_requests(self.response) self.failUnless(self._equal_requests_list(requests, self.requests)) def test_request_processor(self): extractors = [ ...
code_fim
hard
{ "lang": "python", "repo": "herberthamaral/scrapy", "path": "/scrapy/tests/test_contrib_exp_crawlspider_reqgen.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pv_data = pd.read_csv( '{}/temporal_granularity/data/processed/resources/pv_processed.csv'.format(project_dir)) onshore_data = pd.read_csv( '{}/temporal_granularity/data/processed/resources/onshore_processed.csv'.format(project_dir)) load_data = pd.read_csv( "{}/tempora...
code_fim
medium
{ "lang": "python", "repo": "alexanderkell/temporal_granularity", "path": "/src/models/optimisation_algorithms/linear_optimisation/linear_optimisation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: alexanderkell/temporal_granularity path: /src/models/optimisation_algorithms/linear_optimisation/linear_optimisation.py import pandas as pd from pathlib import Path import numpy as np <|fim_suffix|> project_dir = Path("__file__").resolve().parents[1] project_dir pv_data = pd.read_csv...
code_fim
medium
{ "lang": "python", "repo": "alexanderkell/temporal_granularity", "path": "/src/models/optimisation_algorithms/linear_optimisation/linear_optimisation.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> project_dir = Path("__file__").resolve().parents[1] project_dir pv_data = pd.read_csv( '{}/temporal_granularity/data/processed/resources/pv_processed.csv'.format(project_dir)) onshore_data = pd.read_csv( '{}/temporal_granularity/data/processed/resources/onshore_processed.c...
code_fim
medium
{ "lang": "python", "repo": "alexanderkell/temporal_granularity", "path": "/src/models/optimisation_algorithms/linear_optimisation/linear_optimisation.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ASFHyP3/hyp3-gamma path: /tests/rtc/test_coregistration.py import pytest from hyp3_gamma.rtc import coregistration def test_get_offset(tmp_path): diff_par = tmp_path / 'diff_par' with open(diff_par, 'w') as f: f.write('range_offset_polynomial: -3.00000 0.0000e+00 0.0000e+...
code_fim
hard
{ "lang": "python", "repo": "ASFHyP3/hyp3-gamma", "path": "/tests/rtc/test_coregistration.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> coregistration.check_coregistration(log, diff_par, max_stddev=5.0, max_offset=26.0, pixel_size=2.0) with pytest.raises(coregistration.CoregistrationError): coregistration.check_coregistration(log, diff_par, max_stddev=5.0, max_offset=25.99, pixel_size=2.0)<|fim_prefix|># repo: ASFHyP3/hyp3...
code_fim
hard
{ "lang": "python", "repo": "ASFHyP3/hyp3-gamma", "path": "/tests/rtc/test_coregistration.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|># see https://stackoverflow.blog/2014/09/16/introducing-runnable-javascript-css-and-html-code-snippets/ stack_snippet_begin_regex = re.compile(r"<!--\s+begin\s+snippet[^>]+>", re.IGNORECASE) stack_snippet_end_regex = re.compile(r"<!--\s+end\s+snippet\s+-->", re.IGNORECASE) # see, e.g., source of question...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/preprocessing-pipeline", "path": "/preprocessing_pipeline/so/util/regex.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pombredanne/preprocessing-pipeline path: /preprocessing_pipeline/so/util/regex.py """ Regular expressions for post block extraction """ import re # regex for escaped newline characters newline_regex = re.compile(r"[\r\n]?\n") # a code block is indented by four spaces or a tab (which can be prec...
code_fim
hard
{ "lang": "python", "repo": "pombredanne/preprocessing-pipeline", "path": "/preprocessing_pipeline/so/util/regex.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vini84200/medusa2 path: /escola/misaka.py from misaka import html from django.utils.safestring import mark_safe from MedusaII.settings import MARKDOWNX_MARKDOWN_EXTENSIONS <|fim_suffix|> return mark_safe('<br>' + to_html(content))<|fim_middle|> def to_html(content): md = html( tex...
code_fim
hard
{ "lang": "python", "repo": "vini84200/medusa2", "path": "/escola/misaka.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def to_space_safe_html(content): return mark_safe('<br>' + to_html(content))<|fim_prefix|># repo: vini84200/medusa2 path: /escola/misaka.py from misaka import html from django.utils.safestring import mark_safe from MedusaII.settings import MARKDOWNX_MARKDOWN_EXTENSIONS <|fim_middle|>def to_html(co...
code_fim
hard
{ "lang": "python", "repo": "vini84200/medusa2", "path": "/escola/misaka.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def to_space_safe_html(content): return mark_safe('<br>' + to_html(content))<|fim_prefix|># repo: vini84200/medusa2 path: /escola/misaka.py from misaka import html from django.utils.safestring import mark_safe from MedusaII.settings import MARKDOWNX_MARKDOWN_EXTENSIONS def to_html(content): <|fim_m...
code_fim
hard
{ "lang": "python", "repo": "vini84200/medusa2", "path": "/escola/misaka.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # FIFO assert q.get() == "foo" assert q.get() == "bar" # self.assertEqual(q.alive, False) XXX queue don't know it's dead yet, but it is ... # Async get raises Empty (End is not returned) with pytest.raises(Empty): q.get(block=False) assert q.alive # Before killing...
code_fim
hard
{ "lang": "python", "repo": "python-bonobo/bonobo", "path": "/tests/structs/test_inputs.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: python-bonobo/bonobo path: /tests/structs/test_inputs.py # -*- coding: utf-8 -*- # # Copyright 2012-2014 Romain Dorgueil # # 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...
code_fim
medium
{ "lang": "python", "repo": "python-bonobo/bonobo", "path": "/tests/structs/test_inputs.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ambitioninc/django-smart-manager path: /smart_manager/tests/admin_tests.py from django.test import TestCase <|fim_suffix|>class AdminTest(TestCase): def test_admin(self): """ Verify the admin is registered properly. """ assert(admin)<|fim_middle|>from smart_ma...
code_fim
easy
{ "lang": "python", "repo": "ambitioninc/django-smart-manager", "path": "/smart_manager/tests/admin_tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Verify the admin is registered properly. """ assert(admin)<|fim_prefix|># repo: ambitioninc/django-smart-manager path: /smart_manager/tests/admin_tests.py from django.test import TestCase from smart_manager import admin class AdminTest(TestCase): <|fim_middle|> d...
code_fim
easy
{ "lang": "python", "repo": "ambitioninc/django-smart-manager", "path": "/smart_manager/tests/admin_tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> model = Avatar fields = "__all__"<|fim_prefix|># repo: hashqueue/drf_vue_blog path: /apps/avatar/serializers.py """w created serializers.py at 2021/9/3 下午12:12""" from utils.drf_utils.base_model_serializer import BaseModelSerializer from .models import Avatar class AvatarsSerializer(Bas...
code_fim
easy
{ "lang": "python", "repo": "hashqueue/drf_vue_blog", "path": "/apps/avatar/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hashqueue/drf_vue_blog path: /apps/avatar/serializers.py """w created serializers.py at 2021/9/3 下午12:12""" from utils.drf_utils.base_model_serializer import BaseModelSerializer from .models import Avatar <|fim_suffix|> model = Avatar fields = "__all__"<|fim_middle|> class Avatars...
code_fim
medium
{ "lang": "python", "repo": "hashqueue/drf_vue_blog", "path": "/apps/avatar/serializers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class Meta: model = Avatar fields = "__all__"<|fim_prefix|># repo: hashqueue/drf_vue_blog path: /apps/avatar/serializers.py """w created serializers.py at 2021/9/3 下午12:12""" from utils.drf_utils.base_model_serializer import BaseModelSerializer from .models import Avatar <|fim_middle...
code_fim
easy
{ "lang": "python", "repo": "hashqueue/drf_vue_blog", "path": "/apps/avatar/serializers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return _coconut.reversed(self._xrange) def __len__(self): return _coconut.len(self._xrange) def __contains__(self, elem): return elem in self._xrange def __getitem__(self, index): if _coconut.isinstance(index, _coconut.slice): start, stop, step = ind...
code_fim
hard
{ "lang": "python", "repo": "Cortlandd/coconut", "path": "/coconut/root.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return _coconut.isinstance(inst, _coconut_str) def __new__(cls, *args, **kwargs): return _coconut_str.__new__(cls, _coconut.bytearray(*args, **kwargs)) def print(*args, **kwargs): if _coconut.hasattr(_coconut_sys.stdout, "encoding") and _coconut_sys.stdout.encoding is not None:...
code_fim
hard
{ "lang": "python", "repo": "Cortlandd/coconut", "path": "/coconut/root.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cortlandd/coconut path: /coconut/root.py #!/usr/bin/env python #----------------------------------------------------------------------------------------------------------------------- # INFO: #-------------------------------------------------------------------------------------------------------...
code_fim
hard
{ "lang": "python", "repo": "Cortlandd/coconut", "path": "/coconut/root.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jarret/bitcoin_helpers path: /framework/test/cmd.py #!/usr/bin/env python3 # Copyright (c) 2017 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. import sys import time import json ...
code_fim
hard
{ "lang": "python", "repo": "jarret/bitcoin_helpers", "path": "/framework/test/cmd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _output(self, results): b = PrintBuffer() b.separator() b.add_green("%s passed!\n" % self.title) b.add("Elapsed time: %.2fs\n" % results['elapsed_time']) b.separator() return str(b)<|fim_prefix|># repo: jarret/bitcoin_helpers path: /framework/test/c...
code_fim
hard
{ "lang": "python", "repo": "jarret/bitcoin_helpers", "path": "/framework/test/cmd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ogrisel/probability path: /tensorflow_probability/python/math/special_test.py License for the specific language governing permissions and # limitations under the License. # ============================================================================ """Tests for special.""" from __future__ impor...
code_fim
hard
{ "lang": "python", "repo": "ogrisel/probability", "path": "/tensorflow_probability/python/math/special_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @test_util.numpy_disable_gradient_test def testLogGammaDifferenceGradient(self): def simple_difference(x, y): return tf.math.lgamma(y) - tf.math.lgamma(x + y) y = tfp.distributions.HalfCauchy(loc=8., scale=10.).sample( 10000, test_util.test_seed()) x = tfp.distributions.Unifo...
code_fim
hard
{ "lang": "python", "repo": "ogrisel/probability", "path": "/tensorflow_probability/python/math/special_test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ogrisel/probability path: /tensorflow_probability/python/math/special_test.py ipy_special import tensorflow.compat.v2 as tf import tensorflow_probability as tfp from tensorflow_probability.python import math as tfp_math from tensorflow_probability.python.internal import test_util from tensorflow...
code_fim
hard
{ "lang": "python", "repo": "ogrisel/probability", "path": "/tensorflow_probability/python/math/special_test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#cmap = get_cmap(3, name='tab10') # for male, female and others #colors = [cmap(i) for i in range(nspk)] #colors = ['b'] * nspk #smark = ['s'] * nspk for i, spkid in enumerate(spks): # Check gender scolor = 'b' #if spkid in spk2gender: # if spk2gender[spkid] == 'm': # scolor ...
code_fim
hard
{ "lang": "python", "repo": "brijmohan/kaldi", "path": "/egs/voice_privacy/v1/local/plot/plot_spk_xvectors_voxceleb.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: brijmohan/kaldi path: /egs/voice_privacy/v1/local/plot/plot_spk_xvectors_voxceleb.py import matplotlib as mpl mpl.use('Agg') import matplotlib.pyplot as plt import matplotlib.lines as mlines import numpy as np from sklearn.manifold import TSNE import kaldi_io spk_xvector_file = 'exp/xvector_n...
code_fim
hard
{ "lang": "python", "repo": "brijmohan/kaldi", "path": "/egs/voice_privacy/v1/local/plot/plot_spk_xvectors_voxceleb.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # get mode mode = params["mode"] runner = modes[mode] gamemode = params["gamemode"] logging.info( f"Running fairfruit-bot in {mode} mode. Gamemode is {gamemode}.") # prepare bot bot = Bot(gamemode) # launch bizhawk ip = os.getenv("HOST") ports = [os.getenv...
code_fim
hard
{ "lang": "python", "repo": "mp-pinheiro/FairFruit-Bot", "path": "/fairfruitbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mp-pinheiro/FairFruit-Bot path: /fairfruitbot.py import argparse import asyncio import logging import os import subprocess import sys from dotenv import load_dotenv from bot import Bot def setup_logger(): logging.getLogger('twitchio.websocket').disabled = 1 logging.basicConfig(stream=...
code_fim
hard
{ "lang": "python", "repo": "mp-pinheiro/FairFruit-Bot", "path": "/fairfruitbot.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # prepare bot bot = Bot(gamemode) # launch bizhawk ip = os.getenv("HOST") ports = [os.getenv("PORT")] bizhawk_path = os.getenv("BIZZHAWK_PATH") DETACHED_PROCESS = 0x00000008 if bizhawk_path: if gamemode == "double": ports.append(int(os.getenv("PORT")) +...
code_fim
hard
{ "lang": "python", "repo": "mp-pinheiro/FairFruit-Bot", "path": "/fairfruitbot.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>json0 = JsonData() txt0 = TxtData() def main(): if file_type == "txt": print('Output file type = {}, interval = {} seconds'.format(file_type, period)) txt0.txt_to_file() elif file_type == "json": print('Output file type = {}, interval = {} seconds'.format(file_type, perio...
code_fim
hard
{ "lang": "python", "repo": "VladCharches/hometasks", "path": "/Task4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: VladCharches/hometasks path: /Task4.py import json import psutil import datetime import configparser import time import schedule config = json.loads(open("cfg.ini").read()) file_type = config['common']['output'] period = config['common']['interval'] counter = 1 class ConvertToDict(object): ...
code_fim
hard
{ "lang": "python", "repo": "VladCharches/hometasks", "path": "/Task4.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): if file_type == "txt": print('Output file type = {}, interval = {} seconds'.format(file_type, period)) txt0.txt_to_file() elif file_type == "json": print('Output file type = {}, interval = {} seconds'.format(file_type, period)) json0.json_to_file() e...
code_fim
hard
{ "lang": "python", "repo": "VladCharches/hometasks", "path": "/Task4.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> form_model = 'player' @staticmethod def vars_for_template(player: Player): session = player.session from otree.settings import POINTS_CUSTOM_NAME from otree.settings import REAL_WORLD_CURRENCY_CODE from otree.currency import RealWorldCurrency units = POI...
code_fim
hard
{ "lang": "python", "repo": "peterjc/MDT-INTR-EXP-MET", "path": "/risk_attitude/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: peterjc/MDT-INTR-EXP-MET path: /risk_attitude/__init__.py from otree.api import * c = cu doc = 'Introduction and risk attitude lottery game based on Holt and Laury (2002).' class C(BaseConstants): NAME_IN_URL = 'risk_attitude' PLAYERS_PER_GROUP = None NUM_ROUNDS = 1 PAYOFF_RED_A...
code_fim
hard
{ "lang": "python", "repo": "peterjc/MDT-INTR-EXP-MET", "path": "/risk_attitude/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Finally, record message for the final app report participant.risk_attitude_msg = ( f"In the lottery game, the computer picked decision {lottery_selected}. " f"In this decision, you selected lottery {'A' if lottery_choice else 'B'}, " f"meaning that you...
code_fim
hard
{ "lang": "python", "repo": "peterjc/MDT-INTR-EXP-MET", "path": "/risk_attitude/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Adjust 'gain' gain = 1 k0 = popt[1] * gain P = popt[2] # Extrapolate x = list(range(0, estdays)) y = Covid19Estimator(x, x0, k0, P) # Find x1 for Covid19EstimatorFull # x1 > x0 # ...
code_fim
hard
{ "lang": "python", "repo": "sunnymax2002/ml-learn", "path": "/source/basic/covid-19-analysis.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: sunnymax2002/ml-learn path: /source/basic/covid-19-analysis.py #!/usr/bin/python import pandas as pd import numpy as np from datetime import datetime, timedelta import matplotlib.pyplot as plt import matplotlib.cm as cm import helper_functions as hf from scipy.optimize import curve_fit from sci...
code_fim
hard
{ "lang": "python", "repo": "sunnymax2002/ml-learn", "path": "/source/basic/covid-19-analysis.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Xcelled/cap-n-snap path: /plugins/clipboard/__init__.py ''' cap n snap plugin to put the captured data on the clipboard ''' <|fim_suffix|> host.registerDestination(ClipboardDestination()) #enddef info = { 'name' : 'Clipboard', 'version' : 1.0 }<|fim_middle|>from .clipboard import ClipboardDes...
code_fim
medium
{ "lang": "python", "repo": "Xcelled/cap-n-snap", "path": "/plugins/clipboard/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def init(host): host.registerDestination(ClipboardDestination()) #enddef info = { 'name' : 'Clipboard', 'version' : 1.0 }<|fim_prefix|># repo: Xcelled/cap-n-snap path: /plugins/clipboard/__init__.py ''' cap n snap plugin to put the captured data on the clipboard ''' <|fim_middle|>from .clipboard imp...
code_fim
easy
{ "lang": "python", "repo": "Xcelled/cap-n-snap", "path": "/plugins/clipboard/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: strategist922/gta_swarm path: /ctriproom.py #!/usr/bin/env python # coding=utf-8 import pprint import csv import click import requests import datetime as datetime # from splinter import Browser import time import re from selenium import webdriver from selenium.webdriver.common.by im...
code_fim
hard
{ "lang": "python", "repo": "strategist922/gta_swarm", "path": "/ctriproom.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # entry_dict = {} for i, elem in enumerate(driver.find_elements_by_css_selector('div.hroom_tr.J_baseRoomlist')): # pp.pprint(elem) room_name = elem.find_element_by_css_selector('dt.hroom_base_tit').text pp.pprint(room_name) entry = {} entry['Ctrip_Hotel_id'] = hotel_id ent...
code_fim
hard
{ "lang": "python", "repo": "strategist922/gta_swarm", "path": "/ctriproom.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chucktilbury/shop-timer path: /part_dialogs.py from tkinter import messagebox as mbox import tkinter from utility import Logger #from data_store import DataStore from dialogs import BaseDialog class NewPartDialog(BaseDialog): ''' ''' def body(self, master): <|fim_suffix|> ''' ...
code_fim
hard
{ "lang": "python", "repo": "chucktilbury/shop-timer", "path": "/part_dialogs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ''' ''' def body(self, master): self.title("Select Part") class DelPartDialog(BaseDialog): ''' ''' def body(self, master): self.title("Delete Part")<|fim_prefix|># repo: chucktilbury/shop-timer path: /part_dialogs.py from tkinter import messagebox as mbox import...
code_fim
medium
{ "lang": "python", "repo": "chucktilbury/shop-timer", "path": "/part_dialogs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def body(self, master): self.title("Delete Part")<|fim_prefix|># repo: chucktilbury/shop-timer path: /part_dialogs.py from tkinter import messagebox as mbox import tkinter from utility import Logger #from data_store import DataStore from dialogs import BaseDialog class NewPartDialog(BaseDial...
code_fim
hard
{ "lang": "python", "repo": "chucktilbury/shop-timer", "path": "/part_dialogs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/heat-tempest-plugin path: /heat_tempest_plugin/tests/functional/test_nova_server_networks.py # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # ...
code_fim
hard
{ "lang": "python", "repo": "openstack/heat-tempest-plugin", "path": "/heat_tempest_plugin/tests/functional/test_nova_server_networks.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> old_snippet networks: - network: {get_resource: net} new_snippet networks: - network: {get_resource: net} subnet: {get_resource: subnet} ''' template = server_with_no_nets_template.replace( '$NETWORKS', '...
code_fim
hard
{ "lang": "python", "repo": "openstack/heat-tempest-plugin", "path": "/heat_tempest_plugin/tests/functional/test_nova_server_networks.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if not found_start or not found_end: raise ValueError(unwrap( ''' pem_bytes does not appear to contain PEM-encoded data - no BEGIN/END combination found ''' )) def unarmor(pem_bytes, multiple=False): """ Convert a PEM-encoded by...
code_fim
hard
{ "lang": "python", "repo": "kellyjonbrazil/jc", "path": "/jc/parsers/asn1crypto/pem.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kellyjonbrazil/jc path: /jc/parsers/asn1crypto/pem.py # coding: utf-8 """ Encoding DER to PEM and decoding PEM to DER. Exports the following items: - armor() - detect() - unarmor() """ from __future__ import unicode_literals, division, absolute_import, print_function import base64 import ...
code_fim
hard
{ "lang": "python", "repo": "kellyjonbrazil/jc", "path": "/jc/parsers/asn1crypto/pem.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): """Return a string of the declaration of the type""" if self.default_kind: return self.typestr elif check_fortran_intrinsic(self.typestr): return "{}(kind={})".format(self.typestr, self._kind) else: # Derived type ...
code_fim
hard
{ "lang": "python", "repo": "panll/ccpp-framework", "path": "/scripts/fortran_tools/parse_fortran.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: panll/ccpp-framework path: /scripts/fortran_tools/parse_fortran.py proplist.pop(0) while var.count('(') != var.count(')'): if len(proplist) == 0: raise ParseSyntaxError(errstr, token=propstr, context=context) # End if ...
code_fim
hard
{ "lang": "python", "repo": "panll/ccpp-framework", "path": "/scripts/fortran_tools/parse_fortran.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def __str__(self): return '{}({})'.format(self._class, self.typestr) ######################################################################## def Ftype_factory(line, context): ######################################################################## "Return an appropriate type object if th...
code_fim
hard
{ "lang": "python", "repo": "panll/ccpp-framework", "path": "/scripts/fortran_tools/parse_fortran.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: truenas/ports path: /devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py --- src/debugpy/_vendored/pydevd/_pydevd_bundle/pydevd_exec.py.orig 2021-09-26 20:08:05 UTC +++ src/debugpy/_v<|fim_suffix|> if local_vars is not None: - exec exp in global_vars, l...
code_fim
medium
{ "lang": "python", "repo": "truenas/ports", "path": "/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if local_vars is not None: - exec exp in global_vars, local_vars + exec(exp, global_vars, local_vars) else: - exec exp in global_vars \ No newline at end of file + exec(exp, global_vars)<|fim_prefix|># repo: truenas/ports path: /devel/py-debugpy/files/patch-src-debugpy-...
code_fim
medium
{ "lang": "python", "repo": "truenas/ports", "path": "/devel/py-debugpy/files/patch-src-debugpy-_vendored-pydevd-_pydevd_bundle-pydevd_exec.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ManuGar/CLoDSA path: /clodsa/clodsa/augmentors/hdf5LinearLocalizationAugmentor.py from iaugmentor import IAugmentor from sklearn.preprocessing import LabelEncoder from imutils import paths import os import cv2 from utils.aspectawarepreprocessor import AspectAwarePreprocessor from utils.hdf5datase...
code_fim
hard
{ "lang": "python", "repo": "ManuGar/CLoDSA", "path": "/clodsa/clodsa/augmentors/hdf5LinearLocalizationAugmentor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def applyAugmentation(self): self.readImagesAndAnnotations() le = LabelEncoder() writer = HDF5DatasetWriterClassification((len(self.imagePaths)*len(self.generators),self.width,self.height,3), self.outputPath) # We need to define this ...
code_fim
hard
{ "lang": "python", "repo": "ManuGar/CLoDSA", "path": "/clodsa/clodsa/augmentors/hdf5LinearLocalizationAugmentor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (j, generator) in enumerate(self.generators): (newimage, box) = generator.applyForLocalization(image, (category, (x, y, w, h))) writer.add([newimage],[0,box[1][0],box[1][1],box[1][2],box[1][3]]) pbar.update(i) pbar.finish() writer...
code_fim
hard
{ "lang": "python", "repo": "ManuGar/CLoDSA", "path": "/clodsa/clodsa/augmentors/hdf5LinearLocalizationAugmentor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # The distance of a branch is the greater of its two sides # plus its own distance return max(getdepth(clust.left),getdepth(clust.right))+clust.distance #create a list od img imlist = [] folderPath = r'F:\MachineLearningPractice\Img' for filename in os.listdir(folderPath): if os.pat...
code_fim
hard
{ "lang": "python", "repo": "xinpengliu/Machine-Learning-Practice", "path": "/Hierarchical_Clustering/Hierarchical_Clustering_Test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }