text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|># repo: chrismaddalena/Ghostwriter path: /ghostwriter/shepherd/migrations/0005_auto_20191001_1352.py # Generated by Django 2.2.3 on 2019-10-01 13:52 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): <|fim_suffix|> operations = [ ...
code_fim
medium
{ "lang": "python", "repo": "chrismaddalena/Ghostwriter", "path": "/ghostwriter/shepherd/migrations/0005_auto_20191001_1352.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_ascents(self): climbers = get_ascents('Midnight Lightning', 'bouldering') expectedKeys = ['userAvatar', 'userName', 'userSlug', 'date', 'difficulty', 'isHard', 'isEasy', 'type', 'notes', 'rating', 'userPrivate', 'firstAscent', 'secondGo'] self.assertListEqual(list...
code_fim
easy
{ "lang": "python", "repo": "bjariel/8a_scraper", "path": "/test/test_ascents.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: bjariel/8a_scraper path: /test/test_ascents.py import unittest from _8a_scraper.ascents import get_ascents <|fim_suffix|> climbers = get_ascents('Midnight Lightning', 'bouldering') expectedKeys = ['userAvatar', 'userName', 'userSlug', 'date', 'difficulty', 'isHard', 'isEasy', 'typ...
code_fim
medium
{ "lang": "python", "repo": "bjariel/8a_scraper", "path": "/test/test_ascents.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @traced(logging.getLogger("harry")) def connect_to_database(database_connection): """Connect to the cube database.""" conn = psycopg2.connect(database_connection) return conn, conn.cursor() @traced(logging.getLogger("harry")) def commit_and_close_database(conn, cur): """Finalize changes...
code_fim
hard
{ "lang": "python", "repo": "HarryNash/rubiks-cube-for-discord", "path": "/db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: HarryNash/rubiks-cube-for-discord path: /db.py import psycopg2 from autologging import traced import logging @traced(logging.getLogger("harry")) def create_cube_if_channel_has_none(channel_id, database_connection): """Creates a cube in the database if there isn't one already.""" conn, c...
code_fim
hard
{ "lang": "python", "repo": "HarryNash/rubiks-cube-for-discord", "path": "/db.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @traced(logging.getLogger("harry")) def commit_and_close_database(conn, cur): """Finalize changes and close the connection to the cube database.""" conn.commit() cur.close() conn.close()<|fim_prefix|># repo: HarryNash/rubiks-cube-for-discord path: /db.py import psycopg2 from autologging ...
code_fim
hard
{ "lang": "python", "repo": "HarryNash/rubiks-cube-for-discord", "path": "/db.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Desperatesonic/roosterize path: /roosterize/ml/MLModelBase.py from typing import * import abc from pathlib import Path import time from seutil import LoggingUtils, IOUtils from roosterize.data.ModelSpec import ModelSpec TConfig = TypeVar("TConfig") class MLModelBase(Generic[TConfig]): ...
code_fim
hard
{ "lang": "python", "repo": "Desperatesonic/roosterize", "path": "/roosterize/ml/MLModelBase.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> :param train_processed_data_dir: the directory containing the processed train data :param val_processed_data_dir: the directory containing the processed val data """ pass TRAINING_COMPLETED_FILE_NAME = "training-completed.txt" def train( self, ...
code_fim
hard
{ "lang": "python", "repo": "Desperatesonic/roosterize", "path": "/roosterize/ml/MLModelBase.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rubas-cientistadedados/Classifica-o-de-Linguagem-Natural-com-Redes-Neurais-Convolucionais path: /cnn.py from sklearn import model_selection, preprocessing, metrics import pandas, numpy, keras from keras.preprocessing import text, sequence from keras import layers, models, optimizers, initial...
code_fim
hard
{ "lang": "python", "repo": "rubas-cientistadedados/Classifica-o-de-Linguagem-Natural-com-Redes-Neurais-Convolucionais", "path": "/cnn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def create_cnn(): # Adicione uma camada de entrada input_layer = layers.Input((70, )) # Adicione a camada de incorporação de palavras embedding_layer = layers.Embedding(len(word_index) + 1, 300, weights=[embedding_matrix], trainable=False)(input_layer) embedding_layer = layers...
code_fim
hard
{ "lang": "python", "repo": "rubas-cientistadedados/Classifica-o-de-Linguagem-Natural-com-Redes-Neurais-Convolucionais", "path": "/cnn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: epfl-dcsl/ptf-persona path: /runtime/recording.py # Copyright 2019 École Polytechnique Fédérale de Lausanne. All Rights Reserved. # # 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 L...
code_fim
hard
{ "lang": "python", "repo": "epfl-dcsl/ptf-persona", "path": "/runtime/recording.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> prior_counters = None prior_time = None while not stop_event.is_set(): current_time = time.time() current_counters = psutil.net_io_counters(pernic=True) if prior_counters is not None: prior_nic = prior_counters[iface_name] ...
code_fim
hard
{ "lang": "python", "repo": "epfl-dcsl/ptf-persona", "path": "/runtime/recording.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if compressed is None: compressed = filename.endswith('.qimz') # Open the image with open(filename, 'rb') as f: wh = f.read(2) width = int(wh[0]) height = int(wh[1]) im_buf = bytearray(f.read()) if compressed: im_buf = zlib.decompress(im_buf) return framebuf.FrameBuffer(i...
code_fim
medium
{ "lang": "python", "repo": "jimmo/quokka-projects", "path": "/quokka_images/load_image.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jimmo/quokka-projects path: /quokka_images/load_image.py # Micropython image loader. Works with .qim and .qimz files created by convert_image import framebuf import zlib <|fim_suffix|> if compressed is None: compressed = filename.endswith('.qimz') # Open the image with open(filename, '...
code_fim
medium
{ "lang": "python", "repo": "jimmo/quokka-projects", "path": "/quokka_images/load_image.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Dref360/keras-transform path: /transform/sequences/functional.py class SequentialTransformer(): def __init__(self, transformers): <|fim_suffix|> def __call__(self, seq, mask=(True, False)): """ Create a transformer that combines multiples transformers. :param seq: S...
code_fim
medium
{ "lang": "python", "repo": "Dref360/keras-transform", "path": "/transform/sequences/functional.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Create a transformer that combines multiples transformers. :param seq: Sequence object :param mask: Boolean tree-like structure. :return: Sequence """ for transformer in self.transformers: seq = transformer(seq, mask) return s...
code_fim
hard
{ "lang": "python", "repo": "Dref360/keras-transform", "path": "/transform/sequences/functional.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: dongyi1996/geowombat path: /tests/test_config.py import unittest import geowombat as gw from geowombat.data import l8_224078_20200518 from testfixtures import LogCapture class TestConfig(unittest.TestCase): def test_config_bands(self): with gw.open(l8_224078_20200518) as src: ...
code_fim
hard
{ "lang": "python", "repo": "dongyi1996/geowombat", "path": "/tests/test_config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for config_default in ['sensor', 'nodata', 'ref_image', 'ref_bounds', 'ref_crs', 'ref_res', 'ref_tar', 'compress']: self.assertIsNone(src.gw.config[config_default]) def test_config_set_res(self): with gw.config.update(ref_res=100): with gw.open(l8_224...
code_fim
hard
{ "lang": "python", "repo": "dongyi1996/geowombat", "path": "/tests/test_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with gw.config.update(): with gw.open(l8_224078_20200518) as src: self.assertTrue(src.gw.config['with_config']) with gw.open(l8_224078_20200518) as src: self.assertFalse(src.gw.config['with_config']) def test_warnings_ignore(self): wi...
code_fim
hard
{ "lang": "python", "repo": "dongyi1996/geowombat", "path": "/tests/test_config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anchen1011/mxnet-lambda path: /src/geopy/geocoders/geocodefarm.py """ :class:`.GeocodeFarm` geocoder. """ from geopy.geocoders.base import Geocoder, DEFAULT_FORMAT_STRING, \ DEFAULT_TIMEOUT from geopy.location import Location from geopy.util import logger from geopy.exc import GeocoderAuthen...
code_fim
hard
{ "lang": "python", "repo": "anchen1011/mxnet-lambda", "path": "/src/geopy/geocoders/geocodefarm.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def reverse(self, query, exactly_one=True, timeout=None): """ Returns a reverse geocoded location. :param query: The coordinates for which you wish to obtain the closest human-readable addresses. :type query: :class:`geopy.point.Point`, list or tuple of (la...
code_fim
hard
{ "lang": "python", "repo": "anchen1011/mxnet-lambda", "path": "/src/geopy/geocoders/geocodefarm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> :param bool exactly_one: Return one result or a list of results, if available. GeocodeFarm's API will always return at most one result. :param int timeout: Time, in seconds, to wait for the geocoding service to respond before raising a :class:`geopy.exc...
code_fim
hard
{ "lang": "python", "repo": "anchen1011/mxnet-lambda", "path": "/src/geopy/geocoders/geocodefarm.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># zero_to_end() # print(list_merge) # 2. 定义函数 merge() # [2,0,2,0] -->[2,2,0,0] --> [4,0,0,0] # [2,0,0,2] -->[2,2,0,0] --> [4,0,0,0] # [4,4,4,4] --> [8,8,0,0] # [2,0,4,2] --> [2,4,2,0] def merge(): """ 合并数据 核心思想:零元素后移,判断是否相邻相同。如果是则合并. """ zero_to_end() # len() ...
code_fim
hard
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month01/all_code/day12/homework/game2048.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: chaofan-zheng/tedu-python-demo path: /month01/all_code/day12/homework/game2048.py """ 2048核心算法 """ list_merge = [2, 0, 0, 2] # 1. 定义函数 zero_to_end() # [2,0,2,0] --> [2,2,0,0] # [2,0,0,2] --> [2,2,0,0] # [2,4,0,2] --> [2,4,2,0] def zero_to_end(): """ 零元素向后移动 思想:从后向前判...
code_fim
medium
{ "lang": "python", "repo": "chaofan-zheng/tedu-python-demo", "path": "/month01/all_code/day12/homework/game2048.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if args.check: result = os.EX_DATAERR diff = difflib.unified_diff( idata.splitlines(keepends=True), odata.splitlines(keepends=True), fromfile=source + " (original)", tofile=...
code_fim
hard
{ "lang": "python", "repo": "ARM-software/SCP-firmware", "path": "/tools/yaml-format.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: ARM-software/SCP-firmware path: /tools/yaml-format.py #!/usr/bin/env python3 # # Arm SCP/MCP Software # Copyright (c) 2021, Arm Limited and Contributors. All rights reserved. # # SPDX-License-Identifier: BSD-3-Clause # import argparse import colorama import difflib import os import sys import ...
code_fim
hard
{ "lang": "python", "repo": "ARM-software/SCP-firmware", "path": "/tools/yaml-format.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #print(magic) return magic def list_input(mode='sh'): code_dict={'all':'stock_code_all', 'sh':'stock_code_sh', 'cy':'stock_code_cy', 'sz':'stock_code_sz', } if mode in code_dict.keys(): search_file=code_dict[mode]+'.csv' #pri...
code_fim
hard
{ "lang": "python", "repo": "Johnzjy/wakuang", "path": "/data_contorl/Magic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def list_input(mode='sh'): code_dict={'all':'stock_code_all', 'sh':'stock_code_sh', 'cy':'stock_code_cy', 'sz':'stock_code_sz', } if mode in code_dict.keys(): search_file=code_dict[mode]+'.csv' #print (search_file) else: searc...
code_fim
hard
{ "lang": "python", "repo": "Johnzjy/wakuang", "path": "/data_contorl/Magic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Johnzjy/wakuang path: /data_contorl/Magic.py # -*- coding: utf-8 -*- """ Created on Wed Jan 24 14:36:08 2018 @author: 310128142 """ import tushare as ts import pandas as pd import time import matplotlib.pyplot as plt import datetime import numpy as np import os import tqdm def get_magic(code):...
code_fim
hard
{ "lang": "python", "repo": "Johnzjy/wakuang", "path": "/data_contorl/Magic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # build the model from a config file and a checkpoint file model = init_model(args.config, args.checkpoint, device=args.device) # test a single point cloud file model_result, _ = inference_detector(model, args.pcd) # filter the 3d bboxes whose scores > 0.5 if 'pts_bbox' in model_re...
code_fim
medium
{ "lang": "python", "repo": "OpenGVLab/InternImage", "path": "/autonomous_driving/openlane-v2/tools/deployment/test_torchserver.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenGVLab/InternImage path: /autonomous_driving/openlane-v2/tools/deployment/test_torchserver.py from argparse import ArgumentParser import numpy as np import requests from mmdet3d.apis import inference_detector, init_model def parse_args(): parser = ArgumentParser() parser.add_argume...
code_fim
medium
{ "lang": "python", "repo": "OpenGVLab/InternImage", "path": "/autonomous_driving/openlane-v2/tools/deployment/test_torchserver.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: joeig/memodrop path: /authentication/migrations/0003_auto_20181203_1431.py # -*- coding: utf-8 -*- # Generated by Django 1.11.13 on 2018-12-03 20:31 from __future__ import unicode_literals from django.db import migrations <|fim_suffix|> operations = [ migrations.AlterModelOptions( ...
code_fim
medium
{ "lang": "python", "repo": "joeig/memodrop", "path": "/authentication/migrations/0003_auto_20181203_1431.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AlterModelOptions( name='userguisettings', options={'verbose_name': 'User GUI settings', 'verbose_name_plural': 'User GUI settings'}, ), ]<|fim_prefix|># repo: joeig/memodrop path: /authentication/migrations/0003_auto_20181203_1431...
code_fim
medium
{ "lang": "python", "repo": "joeig/memodrop", "path": "/authentication/migrations/0003_auto_20181203_1431.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mikemhenry/sc2gameMapRepo path: /sc2maptool/functions.py from six import iteritems # python 2/3 compatibility import random import re from sc2maptool.index import getIndex from sc2maptool import constants as c ################################################################################ d...
code_fim
hard
{ "lang": "python", "repo": "mikemhenry/sc2gameMapRepo", "path": "/sc2maptool/functions.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>################################################################################ def filterMapNames(regexText, records=getIndex(), excludeRegex=False, closestMatch=True): """matches each record against regexText according to parameters NOTE: the code could be written more simply, but this is loop...
code_fim
hard
{ "lang": "python", "repo": "mikemhenry/sc2gameMapRepo", "path": "/sc2maptool/functions.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jamayfieldjr/iem path: /scripts/iemre/stage4_12z_adjust.py """Use the QC'd 12z 24 Hour files to adjust hourly data.""" import sys import os import datetime import numpy as np from scipy.interpolate import NearestNDInterpolator import pygrib from pyiem import iemre from pyiem.util import ncopen, ...
code_fim
hard
{ "lang": "python", "repo": "jamayfieldjr/iem", "path": "/scripts/iemre/stage4_12z_adjust.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def main(argv): """Go Main Go""" if len(argv) == 4: ts = utc(int(argv[1]), int(argv[2]), int(argv[3]), 12) else: ts = utc() ts = ts - datetime.timedelta(days=1) ts = ts.replace(hour=12, minute=0, second=0, microsecond=0) merge(ts) if __name__ == "__main__...
code_fim
hard
{ "lang": "python", "repo": "jamayfieldjr/iem", "path": "/scripts/iemre/stage4_12z_adjust.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Go Main Go""" if len(argv) == 4: ts = utc(int(argv[1]), int(argv[2]), int(argv[3]), 12) else: ts = utc() ts = ts - datetime.timedelta(days=1) ts = ts.replace(hour=12, minute=0, second=0, microsecond=0) merge(ts) if __name__ == "__main__": main(sys.a...
code_fim
hard
{ "lang": "python", "repo": "jamayfieldjr/iem", "path": "/scripts/iemre/stage4_12z_adjust.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amandewatnitrr/Robothon_1.0_NITRR path: /Robothon_Final/water-judge/water-judge/iotData/migrations/0006_auto_20200301_1019.py # Generated by Django 2.2 on 2020-03-01 04:49 from django.db import migrations, models <|fim_suffix|> dependencies = [ ('iotData', '0005_auto_20200301_0858')...
code_fim
medium
{ "lang": "python", "repo": "amandewatnitrr/Robothon_1.0_NITRR", "path": "/Robothon_Final/water-judge/water-judge/iotData/migrations/0006_auto_20200301_1019.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> operations = [ migrations.AddField( model_name='reading', name='field5', field=models.FloatField(default=0), ), migrations.AddField( model_name='reading', name='wqi', field=models.FloatField(default=0), ...
code_fim
medium
{ "lang": "python", "repo": "amandewatnitrr/Robothon_1.0_NITRR", "path": "/Robothon_Final/water-judge/water-judge/iotData/migrations/0006_auto_20200301_1019.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: realpython/materials path: /intro-to-threading/executor.py #!/usr/bin/env python3 import concurrent.futures import logging import time <|fim_suffix|>if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicConfig(format=format, level=logging.INFO, datefmt="%H:%M:%S") ...
code_fim
medium
{ "lang": "python", "repo": "realpython/materials", "path": "/intro-to-threading/executor.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": format = "%(asctime)s: %(message)s" logging.basicConfig(format=format, level=logging.INFO, datefmt="%H:%M:%S") with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: executor.map(thread_function, range(3))<|fim_prefix|># repo: realpython/mate...
code_fim
medium
{ "lang": "python", "repo": "realpython/materials", "path": "/intro-to-threading/executor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> with concurrent.futures.ThreadPoolExecutor(max_workers=3) as executor: executor.map(thread_function, range(3))<|fim_prefix|># repo: realpython/materials path: /intro-to-threading/executor.py #!/usr/bin/env python3 import concurrent.futures import logging import time <|fim_middle|> def thread...
code_fim
hard
{ "lang": "python", "repo": "realpython/materials", "path": "/intro-to-threading/executor.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rocktavious/DevToolsLib path: /DTL/maya/vertexColorUtils.py import os, sys, traceback import maya.cmds as cmds from functools import partial #Needs refactoring from ..utils.funcs import selection from DTL.api import Safe """ #------------------------------------------------------------ def bui...
code_fim
hard
{ "lang": "python", "repo": "rocktavious/DevToolsLib", "path": "/DTL/maya/vertexColorUtils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#------------------------------------------------------------ def vertexColorBlend(vertList=None, currentRGBA=None, red=1, green=1, blue=1, mix=0.5 ): '''Blend New Color with Current Color - Alpha Excluded''' if currentRGBA == None: return newR = currentRGBA[0]*(1-mix) + red*mix n...
code_fim
hard
{ "lang": "python", "repo": "rocktavious/DevToolsLib", "path": "/DTL/maya/vertexColorUtils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ll_code = """ define void @mykernel(i32* %data) { %1 = load i32, i32* %data %2 = sext i32 %1 to i64 %3 = lshr i64 %2, 32 %4 = trunc i64 %3 to i32 store i32 %4, i32* %data ret void } """ cl_code = test_common.ll_to_cl(ll_code, 'mykernel', 1) print('cl_code', cl_code) for experim...
code_fim
hard
{ "lang": "python", "repo": "pint1022/coriander", "path": "/test/test_cast.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def test_sext(context, q, int_data, int_data_gpu): ll_code = """ define void @mykernel(i32* %data) { %1 = load i32, i32* %data %2 = sext i32 %1 to i64 %3 = lshr i64 %2, 32 %4 = trunc i64 %3 to i32 store i32 %4, i32* %data ret void } """ cl_code = test_common.ll_to_cl(ll_code, 'mykerne...
code_fim
hard
{ "lang": "python", "repo": "pint1022/coriander", "path": "/test/test_cast.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pint1022/coriander path: /test/test_cast.py # Copyright Hugh Perkins 2016, 2017 """ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-...
code_fim
medium
{ "lang": "python", "repo": "pint1022/coriander", "path": "/test/test_cast.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: abeaumont/competitive-programming path: /tuenti/tuenti-challenge-10/1.py #!/usr/bin/env python for i in range(int(input())): k = ''.join(sorted(input().split())) s =<|fim_suffix|>: 'R', 'SS': '-'} print(f'Case #{i+1}: {s[k]}')<|fim_middle|> {'PP': '-', 'PR': 'P', 'PS': 'S', 'RR': '-',...
code_fim
easy
{ "lang": "python", "repo": "abeaumont/competitive-programming", "path": "/tuenti/tuenti-challenge-10/1.py", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|>: 'R', 'SS': '-'} print(f'Case #{i+1}: {s[k]}')<|fim_prefix|># repo: abeaumont/competitive-programming path: /tuenti/tuenti-challenge-10/1.py #!/usr/bin/env python for i in range(int(input()))<|fim_middle|>: k = ''.join(sorted(input().split())) s = {'PP': '-', 'PR': 'P', 'PS': 'S', 'RR': '-',...
code_fim
medium
{ "lang": "python", "repo": "abeaumont/competitive-programming", "path": "/tuenti/tuenti-challenge-10/1.py", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|># repo: reviewboard/reviewboard path: /reviewboard/extensions/tests/test_filediffacl_hook.py """Unit tests for reviewboard.extensions.hooks.FileDiffACLHook.""" import kgb from djblets.features.testing import override_feature_check from reviewboard.extensions.hooks import FileDiffACLHook from reviewboar...
code_fim
hard
{ "lang": "python", "repo": "reviewboard/reviewboard", "path": "/reviewboard/extensions/tests/test_filediffacl_hook.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def _test_hook_approval_sequence(self, accessible_values, result): """Test a sequence of FileDiffACLHook approval results. Args: accessible_values (list of bool): A list of the values to return from FileDiffACLHook implementations. ...
code_fim
hard
{ "lang": "python", "repo": "reviewboard/reviewboard", "path": "/reviewboard/extensions/tests/test_filediffacl_hook.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>setup( name='spectral_rhythm_detector', version='0.1.0.dev0', license='MIT', description=('Identify spectral rhythm events'), author='', author_email='', url='https://github.com/Eden-Kramer-Lab/spectral_rhythm_detector', packages=find_packages(), install_requires=INSTAL...
code_fim
hard
{ "lang": "python", "repo": "Eden-Kramer-Lab/spectral_rhythm_detector", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Eden-Kramer-Lab/spectral_rhythm_detector path: /setup.py #!/usr/bin/env python3 from setuptools import find_packages, setup <|fim_suffix|>setup( name='spectral_rhythm_detector', version='0.1.0.dev0', license='MIT', description=('Identify spectral rhythm events'), author='', ...
code_fim
hard
{ "lang": "python", "repo": "Eden-Kramer-Lab/spectral_rhythm_detector", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: emizhang/HostaLabs-Localization path: /samples/dnn/mobilenet_ssd_python_copy_2.py # This script is used to demonstrate MobileNet-SSD network using OpenCV deep learning module. # # It works with model taken from https://github.com/chuanqi305/MobileNet-SSD/ that # was trained in Caffe-SSD framework...
code_fim
hard
{ "lang": "python", "repo": "emizhang/HostaLabs-Localization", "path": "/samples/dnn/mobilenet_ssd_python_copy_2.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> if frame_num == 0: # Don't need Counter or any of the code in the next block but keeping it for now in case I want to fix the situation of multiple classes later labels = [] for i in range(detections.shape[2]): confidence = detections[0, 0, i, 2]...
code_fim
hard
{ "lang": "python", "repo": "emizhang/HostaLabs-Localization", "path": "/samples/dnn/mobilenet_ssd_python_copy_2.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>max_level = pywt.dwt_max_level(len(signal), discrete_wavelet) print('MAXIMUM DECOMPOSE LEVEL = ',max_level) # decompose tree = pywt.wavedec(signal, 'db2',level=3) cA3, cD3, cD2, cD1 = tree #print(len(cD1),len(cD2),len(cD3),len(cA3)) # reconstruct rec_sample = pywt.waverec(tree, 'db2') rec_to_o...
code_fim
hard
{ "lang": "python", "repo": "BNMEZR/PFE", "path": "/SP_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BNMEZR/PFE path: /SP_data.py import numpy as np import librosa, librosa.display import matplotlib.pyplot as plt import pywt import scipy import time FIG_SIZE = (15,10) file = "spkr09_M_S1a_cry14.wav" ##for file in range(0, len(audio_file),1) # load audio file with Librosa start ...
code_fim
hard
{ "lang": "python", "repo": "BNMEZR/PFE", "path": "/SP_data.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>plt.subplot(5,1,2) plt.title('cD1') plt.plot(np.linspace(0.0, len(rec_to_orig),len(rec_to_orig)), rec_to_orig) plt.xlim(xmin=0) plt.grid() plt.subplot(5,1,3) plt.title('cD2') plt.plot(np.linspace(0.0, len(rec_to_level1),len(rec_to_level1)), rec_to_level1) plt.xlim(xmin=0) plt.grid() plt.subplot(...
code_fim
hard
{ "lang": "python", "repo": "BNMEZR/PFE", "path": "/SP_data.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xflows/textflows path: /workflows/api_views.py from rest_framework import viewsets, mixins from rest_framework.views import APIView from rest_framework.response import Response from rest_framework import filters from workflows.models import * from workflows.serializers import * class WorkflowVi...
code_fim
medium
{ "lang": "python", "repo": "xflows/textflows", "path": "/workflows/api_views.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_queryset(self): return Workflow.objects.filter(user=self.request.user).prefetch_related('widgets','widgets__inputs','widgets__outputs') class WidgetViewSet(viewsets.ModelViewSet): """ API endpoint that allows widgets to be viewed or edited. """ model = Widget filt...
code_fim
hard
{ "lang": "python", "repo": "xflows/textflows", "path": "/workflows/api_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_serializer_class(self): if self.action == 'list': return WorkflowListSerializer return WorkflowSerializer def perform_create(self, serializer): serializer.save(user=self.request.user) def get_queryset(self): return Workflow.objects.filter(u...
code_fim
medium
{ "lang": "python", "repo": "xflows/textflows", "path": "/workflows/api_views.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: flexciton/pyomo path: /pyomo/contrib/pynumero/examples/callback/cyipopt_callback.py import pyomo.environ as pyo from pyomo.contrib.pynumero.examples.callback.reactor_design import model as m import logging <|fim_suffix|> solver = pyo.SolverFactory('cyipopt') status, nlp = solver.solve(m, ...
code_fim
hard
{ "lang": "python", "repo": "flexciton/pyomo", "path": "/pyomo/contrib/pynumero/examples/callback/cyipopt_callback.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> solver = pyo.SolverFactory('cyipopt') status, nlp = solver.solve(m, tee=False, return_nlp=True, intermediate_callback=iteration_callback) if __name__ == '__main__': logging.getLogger('pyomo').setLevel(logging.INFO) main()<|fim_prefix|># repo: flexciton/pyomo pa...
code_fim
hard
{ "lang": "python", "repo": "flexciton/pyomo", "path": "/pyomo/contrib/pynumero/examples/callback/cyipopt_callback.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def test_set_and_load_settings(self): aSettingDir = "/MyProject/aSetting.sublime-settings" aSetting = {"setting1": "a Setting", "setting2": 5} sublime.setSettings(aSettingDir, aSetting) result = sublime.load_settings(aSettingDir) self.assertEqual(aSetting, result) def test_loading_non_existan...
code_fim
medium
{ "lang": "python", "repo": "anconaesselmann/LiveUnit", "path": "/classes_and_tests/srcTest/mocking/sublimeTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: anconaesselmann/LiveUnit path: /classes_and_tests/srcTest/mocking/sublimeTest.py import unittest import os if __name__ == '__main__' and __package__ is None: from os import sys, path sys.path.append(path.abspath(path.join(__file__, "..", "..", ".."))) from src.mocking.sublime import sub...
code_fim
hard
{ "lang": "python", "repo": "anconaesselmann/LiveUnit", "path": "/classes_and_tests/srcTest/mocking/sublimeTest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_get_packagePath(self): expected = os.path.join("A", "mock", "packages", "path") result = sublime.packages_path() self.assertEqual(expected, result) def test_set_get_active_window(self): activeWindow = "window" resultBefore = sublime.active_window() sublime.setActiveWindow(activeWin...
code_fim
hard
{ "lang": "python", "repo": "anconaesselmann/LiveUnit", "path": "/classes_and_tests/srcTest/mocking/sublimeTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> sessionsFolder = self.findSessionsFolder() items = list(Folder().childItems(sessionsFolder, filters={'name': 'json'})) if not len(items): raise RestException('doesn\'t contain a json item', code=404) jsonItem = items[0] # Next TODO: read, format, and str...
code_fim
hard
{ "lang": "python", "repo": "OpenImaging/miqa-web", "path": "/server/miqa_server/session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> @access.user @autoDescribeRoute( Description('Retrieve all sessions in a tree structure') .errorResponse()) def getSessions(self, params): return self._getSessions() def _getSessions(self): user = self.getCurrentUser() sessionsFolder = self.findSess...
code_fim
hard
{ "lang": "python", "repo": "OpenImaging/miqa-web", "path": "/server/miqa_server/session.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenImaging/miqa-web path: /server/miqa_server/session.py import datetime import io import json from jsonschema import validate from jsonschema.exceptions import ValidationError as JSONValidationError import os import sys import traceback from girder.api.rest import Resource, setResponseHeader, ...
code_fim
hard
{ "lang": "python", "repo": "OpenImaging/miqa-web", "path": "/server/miqa_server/session.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: dmlc/gluon-cv path: /gluoncv/model_zoo/pspnet.py # pylint: disable=unused-argument """Pyramid Scene Parsing Network""" from mxnet.gluon import nn from mxnet.context import cpu from mxnet.gluon.nn import HybridBlock from .segbase import SegBaseModel from .fcn import _FCNHead # pylint: disable-all ...
code_fim
hard
{ "lang": "python", "repo": "dmlc/gluon-cv", "path": "/gluoncv/model_zoo/pspnet.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> feat1 = self.upsample(F, self.conv1(self.pool(F, x, 1))) feat2 = self.upsample(F, self.conv2(self.pool(F, x, 2))) feat3 = self.upsample(F, self.conv3(self.pool(F, x, 3))) feat4 = self.upsample(F, self.conv4(self.pool(F, x, 6))) return F.concat(x, feat1, feat2, feat3...
code_fim
hard
{ "lang": "python", "repo": "dmlc/gluon-cv", "path": "/gluoncv/model_zoo/pspnet.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: WikiWatershed/gwlf-e path: /gwlfe/Memoization.py import hashlib from numpy import ndarray def memoize_with_args(f): """This memoization function checks to ensure that the called arguments are equal before returning memoized result. This is patched in for testing to ensure that there is...
code_fim
hard
{ "lang": "python", "repo": "WikiWatershed/gwlf-e", "path": "/gwlfe/Memoization.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>memoized_return_values = {} def resetMemoization(): global memoized_return_values memoized_return_values = {} def memoize(f): """This memoization function does not check what arguments the function is called with. This requires that the model be reitinitalized between each run, but sav...
code_fim
hard
{ "lang": "python", "repo": "WikiWatershed/gwlf-e", "path": "/gwlfe/Memoization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> class memodict(dict): def __init__(self, f): self.f = f self.__name__ = f.__name__ def __call__(self, *args): global memoized_return_values try: return memoized_return_values[self.__name__] except KeyError: ...
code_fim
hard
{ "lang": "python", "repo": "WikiWatershed/gwlf-e", "path": "/gwlfe/Memoization.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: zihaohe123/pytorch-seq2seq path: /model2lstm.py import numpy as np import pdb import math import torch from torch import nn from torch.nn import functional as F from torch.nn.utils.rnn import pad_sequence from torch.autograd import Variable from torch.nn.utils.rnn import pack_padded_sequence, pa...
code_fim
hard
{ "lang": "python", "repo": "zihaohe123/pytorch-seq2seq", "path": "/model2lstm.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def forward(self, input_seq, input_len, output_seq, output_len, training=True, sos_tok=0, max_length=0, device='cpu'): input_emb = self.input_embedding(input_seq) batch_size = input_seq.size(1) max_len = output_seq.size(0)#this one is only for the training, different from max_l...
code_fim
hard
{ "lang": "python", "repo": "zihaohe123/pytorch-seq2seq", "path": "/model2lstm.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>np.save('bars_and_stripes', dataset) subset = dataset[0:10] for img in subset: img[0:2,0:2]=0 np.save('blanked_bars_and_stripes', subset) # plt.imshow(dataset[0]) # plt.show() # plt.imshow(subset[0]) # plt.show()<|fim_prefix|># repo: shukob/CohortProject_2020 path: /Project_1_RBM_and_Tomogra...
code_fim
medium
{ "lang": "python", "repo": "shukob/CohortProject_2020", "path": "/Project_1_RBM_and_Tomography/BarsAndStripes/Bars_and_Stripes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: shukob/CohortProject_2020 path: /Project_1_RBM_and_Tomography/BarsAndStripes/Bars_and_Stripes.py import numpy as np import matplotlib.pyplot as plt dataset = [] set_size = 10000 for k in range(set_size): init = np.zeros((4,4)) nr_of_stripes = np.random.randint(low = 1, high= 4, size = 1...
code_fim
medium
{ "lang": "python", "repo": "shukob/CohortProject_2020", "path": "/Project_1_RBM_and_Tomography/BarsAndStripes/Bars_and_Stripes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: BFriedland/data-structures path: /radix_sort/radix_sort.py # This implementation was created with assistance from: # http://www.geekviewpoint.com/python/sorting/radixsort # http://en.wikibooks.org/wiki/Algorithm_Implementation/Sorting/Radix_sort def radix_sort(the_list, base_of_each_digit=10)...
code_fim
hard
{ "lang": "python", "repo": "BFriedland/data-structures", "path": "/radix_sort/radix_sort.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> random_list = [] giant_quality_list = [] for each_pass in range(0, 100000): # E.g., 1000 to 9999 or 10 to 99 or 10000000 to 99999999 topend = (not_so_random_order_of_magnitude * 10) - 1 random_number = random.randint(not_so_random_order_of_magnitude, ...
code_fim
hard
{ "lang": "python", "repo": "BFriedland/data-structures", "path": "/radix_sort/radix_sort.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if len(sys.argv) != 4: print "Expect createSetFiles data, output file, universal POS Tag file." sys.exit() posConverter = dict() input = open(sys.argv[3], "r") for line in input: tokens = line.strip().split("\t") posConverter[tokens[0]] = tokens[1] inpu...
code_fim
medium
{ "lang": "python", "repo": "chapzq77/Multilingual_Event_Extraction", "path": "/preprocessing_2.0/MaltParser_scripts/convertToCoNLL.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def main(): if len(sys.argv) != 4: print "Expect createSetFiles data, output file, universal POS Tag file." sys.exit() posConverter = dict() input = open(sys.argv[3], "r") for line in input: tokens = line.strip().split("\t") posConverter[tokens[0]] = tokens...
code_fim
medium
{ "lang": "python", "repo": "chapzq77/Multilingual_Event_Extraction", "path": "/preprocessing_2.0/MaltParser_scripts/convertToCoNLL.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: chapzq77/Multilingual_Event_Extraction path: /preprocessing_2.0/MaltParser_scripts/convertToCoNLL.py # script to convert from createSetFiles file to CoNLL format import sys import string def convertPOS(pos, converter): newPOS = "" for character in pos: if character not in string....
code_fim
hard
{ "lang": "python", "repo": "chapzq77/Multilingual_Event_Extraction", "path": "/preprocessing_2.0/MaltParser_scripts/convertToCoNLL.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: frankier/finntk path: /finntk/omor/anlys.py """ Functions for basic processing of OMorFi analyses. """ from more_itertools import split_at import re from itertools import product def analysis_to_pairs(ana): assert ana[0] == "[" and ana[-1] == "]" ana = ana[1:-1] for bit in ana.split...
code_fim
hard
{ "lang": "python", "repo": "frankier/finntk", "path": "/finntk/omor/anlys.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def ud_to_omor(lemma, pos, feats=None): from finntk.data.omorfi_ud import ( PASSTHROUGHS, PASSTHROUGHS_KEY_MAP, NUM_KEY_MAP, NUM_VAL_MAP, TENSE_MAP, MOOD_MAP, VOICE_MAP, PART_FORM_MAP, INF_FORM_MAP, ) pos = pos.upper() ...
code_fim
hard
{ "lang": "python", "repo": "frankier/finntk", "path": "/finntk/omor/anlys.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: doy/libvt100-python path: /t/processing_test.py # coding=utf-8 from . import VT100Test class ProcessingTest(VT100Test): def test_split_escape_sequences(self): assert self.vt.process("abc") == 3 assert self.vt.process("abc\033[12;24Hdef") == 14 assert self.vt.process(...
code_fim
hard
{ "lang": "python", "repo": "doy/libvt100-python", "path": "/t/processing_test.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert self.vt.process("a") == 1 assert self.vt.process(b"\303") == 0 assert self.vt.process(b"\303\241") == 2 assert self.vt.process("á") == 2 assert self.vt.process(b"\343") == 0 assert self.vt.process(b"\343\202") == 0 assert self.vt.process(b"\...
code_fim
medium
{ "lang": "python", "repo": "doy/libvt100-python", "path": "/t/processing_test.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # for x in range(100): # print(x) # requests.post('http://172.18.2.168:1234/equip_type',data = json.dumps({'e_code': '3'}), verify=False) # for x in range(100): # print(x) # requests.post('http://172.18.2.168:1234/unconnected_assist_equip', verify=False) # for x in range(100): # p...
code_fim
hard
{ "lang": "python", "repo": "herambchaudhari4121/website-10", "path": "/weatherSys/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: herambchaudhari4121/website-10 path: /weatherSys/tests.py from django.test import TestCase # Create your tests here. import requests import json import time import random from weatherSys import db_handling as db from treelib import Tree, Node time_start=time.time() # eid = ['HZGEXT0306', 'HZGE...
code_fim
hard
{ "lang": "python", "repo": "herambchaudhari4121/website-10", "path": "/weatherSys/tests.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # for x in range(100): # print(x) # requests.post('http://172.18.2.168:1234/features', verify=False) # for x in range(100): # print(x) # requests.post('http://172.18.2.168:1234/features_filter', verify=False) # for x in range(100): # print(requests.post('http://172.18.2.168:1234/fe...
code_fim
hard
{ "lang": "python", "repo": "herambchaudhari4121/website-10", "path": "/weatherSys/tests.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_quit(self): apps = app.App() apps.main.template.active_template.quit_gui() assert apps.main.template is None<|fim_prefix|># repo: Walrick/gui_tool path: /tk_gui_tools/test/test_global.py #!/usr/bin/python3 # -*- coding: utf8 -*- import app <|fim_middle|> class TestG...
code_fim
easy
{ "lang": "python", "repo": "Walrick/gui_tool", "path": "/tk_gui_tools/test/test_global.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> apps = app.App() apps.main.template.active_template.quit_gui() assert apps.main.template is None<|fim_prefix|># repo: Walrick/gui_tool path: /tk_gui_tools/test/test_global.py #!/usr/bin/python3 # -*- coding: utf8 -*- import app <|fim_middle|> class TestGlobal: def test_quit(...
code_fim
easy
{ "lang": "python", "repo": "Walrick/gui_tool", "path": "/tk_gui_tools/test/test_global.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Walrick/gui_tool path: /tk_gui_tools/test/test_global.py #!/usr/bin/python3 # -*- coding: utf8 -*- import app <|fim_suffix|> def test_quit(self): apps = app.App() apps.main.template.active_template.quit_gui() assert apps.main.template is None<|fim_middle|> class TestG...
code_fim
easy
{ "lang": "python", "repo": "Walrick/gui_tool", "path": "/tk_gui_tools/test/test_global.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: monster1025/aqara-mqtt path: /src/xiaomihub.py import socket import struct import json import logging import sys import select from collections import defaultdict from queue import Queue from threading import Thread _LOGGER = logging.getLogger(__name__) # MANDATORY!!!! NEED TO TURN OFF "_proces...
code_fim
hard
{ "lang": "python", "repo": "monster1025/aqara-mqtt", "path": "/src/xiaomihub.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def stop(self): """Stop listening.""" self._listening = False self._queue.put(None) for t in self._threads: t.join() if self._mcastsocket is not None: self._mcastsocket.close() self._mcastsocket = None def _listen_to_ms...
code_fim
hard
{ "lang": "python", "repo": "monster1025/aqara-mqtt", "path": "/src/xiaomihub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _send_socket(self, cmd, rtnCmd, ip, port): socket = self._socket try: _LOGGER.debug('Sending to GW {0}'.format(cmd)) self._read_unwanted_data() socket.settimeout(30.0) socket.sendto(cmd.encode(), (ip, port)) socket.settim...
code_fim
hard
{ "lang": "python", "repo": "monster1025/aqara-mqtt", "path": "/src/xiaomihub.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: UNSW-CEEM/NEMPRO path: /examples/forecaster_day_ahead.py import pandas as pd from NEMPRO import historical_inputs, planner import plotly.graph_objects as go from plotly.subplots import make_subplots raw_data_cache = 'C:/Users/nick/Documents/nem_data' # Build data set for calibrating the dispatc...
code_fim
hard
{ "lang": "python", "repo": "UNSW-CEEM/NEMPRO", "path": "/examples/forecaster_day_ahead.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#tech_availability = historical_inputs.get_tech_operating_capacities(start_time_forward_data, # end_time_forward_data, # raw_data_cache) #forward_data = pd.merge(demand_da...
code_fim
hard
{ "lang": "python", "repo": "UNSW-CEEM/NEMPRO", "path": "/examples/forecaster_day_ahead.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>older.exists: print("Folder '{0}' is found".format(folder_path)) else: print("Folder '{0}' not found".format(folder_path))<|fim_prefix|># repo: vgrem/Office365-REST-Python-Client path: /examples/sharepoint/folders/folder_exists.py """ How to determine whether folder exist? """ from office365.sha...
code_fim
medium
{ "lang": "python", "repo": "vgrem/Office365-REST-Python-Client", "path": "/examples/sharepoint/folders/folder_exists.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }