text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>['rot'] = rot items["idItem" + str(n)]["itemType"] = "door" if k["item_name"] == 'Out Door': items["idItem" + str(n)]["itemName"] = "exit" #Clave items["idItem" + str(n)]["itemType"] = "poi" items["idItem" + str(n)]["id"] = "out" items["idItem" + str(n+1000)] = {"pos": { "x": ...
code_fim
hard
{ "lang": "python", "repo": "gsi-upm/soba", "path": "/soba/visualization/ramen/mapGenerator.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># clip the dataset clipper = vtk.vtkClipDataSet() clipper.SetInputData(dataset.GetBlock(0).GetBlock(0)) plane = vtk.vtkPlane() plane.SetNormal(0.5,0.5,0.5) plane.SetOrigin(0.5,0.5,0.5) clipper.SetClipFunction(plane) clipper.Update() # get surface representation to render surfaceFilter = vtk.vtkDataSetSur...
code_fim
hard
{ "lang": "python", "repo": "t3dbrida/VTK", "path": "/Common/DataModel/Testing/Python/TestClipPolyhedra.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: t3dbrida/VTK path: /Common/DataModel/Testing/Python/TestClipPolyhedra.py #!/usr/bin/env python import vtk from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Create the RenderWindow, Renderer # ren = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.AddRenderer( ren...
code_fim
medium
{ "lang": "python", "repo": "t3dbrida/VTK", "path": "/Common/DataModel/Testing/Python/TestClipPolyhedra.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>ren.GetActiveCamera().SetPosition(-0.5,0.5,0) ren.GetActiveCamera().SetFocalPoint(0.5, 0.5, 0.5) ren.GetActiveCamera().SetViewUp(0.0820, 0.934, -0.348) ren.ResetCamera() renWin.Render() iren.Start()<|fim_prefix|># repo: t3dbrida/VTK path: /Common/DataModel/Testing/Python/TestClipPolyhedra.py #!/usr/bin/e...
code_fim
hard
{ "lang": "python", "repo": "t3dbrida/VTK", "path": "/Common/DataModel/Testing/Python/TestClipPolyhedra.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # TODO: Add news and reddit commands back # def call_eda(self, _): # try: # df = fx_view.get_candles_dataframe(account, self.instrument, None) # df = df.rename(columns={"Close": "Adj Close"}) # instrument = self.instrument # s_start = pd.to_datet...
code_fim
hard
{ "lang": "python", "repo": "kai-anderson/GamestonkTerminal", "path": "/gamestonk_terminal/forex/forex_controller.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kai-anderson/GamestonkTerminal path: /gamestonk_terminal/forex/forex_controller.py import argparse from datetime import timedelta, datetime from typing import List import pandas as pd from prompt_toolkit.completion import NestedCompleter from colorama import Style from gamestonk_terminal import ...
code_fim
hard
{ "lang": "python", "repo": "kai-anderson/GamestonkTerminal", "path": "/gamestonk_terminal/forex/forex_controller.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class J_crf(nn.Module): def __init__(self): super().__init__() self.crf = ConditionalRandomField(num_tags=len(label_dic), constraints=constraints, include_start_end_transitions=False) def forward(self, inputs, labels): return -self.crf(inputs, labels) import matplotlib.py...
code_fim
hard
{ "lang": "python", "repo": "xsthunder/HMM_CRF_torch", "path": "/exp/basic_test_for_crf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import matplotlib.pyplot as plt def pxy(x, y, name='idk'): name = str(name) fig, = plt.plot(x,y, ) fig.set_label(name) plt.legend() # pxy([1,2], [3,2], '2') # pxy([1,2], [5,6], '1')<|fim_prefix|># repo: xsthunder/HMM_CRF_torch path: /exp/basic_test_for_crf.py ############################...
code_fim
hard
{ "lang": "python", "repo": "xsthunder/HMM_CRF_torch", "path": "/exp/basic_test_for_crf.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xsthunder/HMM_CRF_torch path: /exp/basic_test_for_crf.py ################################################# ### THIS FILE WAS AUTOGENERATED! DO NOT EDIT! ### ################################################# # file to edit: ./nb/basic_test_for_crf.ipynb import sys if __name__ == '__main__': sys....
code_fim
medium
{ "lang": "python", "repo": "xsthunder/HMM_CRF_torch", "path": "/exp/basic_test_for_crf.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if kind == 'Pre-correction': kind = 'pre_correction' elif kind == 'Post-correction': kind = 'post_correction' elif kind == 'Illumina': kinda = 'illumina' plt.tight_layout() fname = '{}_{}_umis_v_barcodes.png'.format(oprefix, kind) plt.savefig(fname) plt.clf()<|fim_prefix|># repo: fairlieree...
code_fim
hard
{ "lang": "python", "repo": "fairliereese/LR-splitpipe", "path": "/LR-splitpipe/plot_ranked_barcodes.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: fairliereese/LR-splitpipe path: /LR-splitpipe/plot_ranked_barcodes.py def plot_umis_v_barcodes(df, oprefix, kind): bc_cols = ['bc1', 'bc2', 'bc3'] # only want unique bc/umi combos temp = df[bc_cols+['umi']].drop_duplicates() # get the number of unique bc/umi combos temp = temp[bc_cols+['um...
code_fim
medium
{ "lang": "python", "repo": "fairliereese/LR-splitpipe", "path": "/LR-splitpipe/plot_ranked_barcodes.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/python-heatclient path: /heatclient/osc/v1/event.py # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 ...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-heatclient", "path": "/heatclient/osc/v1/event.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if parsed_args.sort: sorts = [] sort_keys = [] for sort in parsed_args.sort: if sort.startswith(":"): sorts.append(":".join(["event_time", sort.lstrip(":")])) else: sorts.append(sort) ...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-heatclient", "path": "/heatclient/osc/v1/event.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> x = PackedSequence(x, sequence.batch_sizes, sequence.sorted_indices, sequence.unsorted_indices) hx = torch.cat(h_n, 0), torch.cat(c_n, 0) hx = self.permute_hidden(hx, sequence.unsorted_indices) return x, hx class LstmCell(nn.Module): def __init__(self, input_si...
code_fim
hard
{ "lang": "python", "repo": "markhsia/CLNER", "path": "/flair/models/biaffine_dp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #--------------lstm --------------------- class BiLSTM_1(nn.Module): def __init__(self, input_size, hidden_size, num_layers, dropout=None): super(BiLSTM_1, self).__init__() self.input_size = input_size #emb_size self.hidden_size = hidden_size self.num_layers = num_layers self.dropout_rate =...
code_fim
hard
{ "lang": "python", "repo": "markhsia/CLNER", "path": "/flair/models/biaffine_dp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: markhsia/CLNER path: /flair/models/biaffine_dp.py e=='eval': # self.eval_dataloader = eval_dataloader(config) # else: # pdb.set_trace() # def step(self): # if self.batch_len is not None: # batch = self.train_dataloader[self.global_step%self.batch_len] # loss_step = self.forwar...
code_fim
hard
{ "lang": "python", "repo": "markhsia/CLNER", "path": "/flair/models/biaffine_dp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Setter for credentials. Args: config (array): Json object to fetch keys. """ self._app_id = config['here'][0] self._app_code = config['here'][1] def __set_timeout(self, timeout): """Setter for timeout. Args: timeout (int):...
code_fim
hard
{ "lang": "python", "repo": "uvraj88/SimpleNetworkService", "path": "/src/services/here_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def form_params(self, lat, long): """Form Url params given lat and long Args: lat (float): latitude of a location long (float): longitude of a location Returns: A human readable address or None. """ data = {'mode': 'retrieveAddresse...
code_fim
hard
{ "lang": "python", "repo": "uvraj88/SimpleNetworkService", "path": "/src/services/here_api.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: uvraj88/SimpleNetworkService path: /src/services/here_api.py import logging class hereApi(object): """Base class for HERE Search, which is used to fetch address using HERE. """ def __init__(self, config, timeout=None): """Returns a Api instance. Args: co...
code_fim
hard
{ "lang": "python", "repo": "uvraj88/SimpleNetworkService", "path": "/src/services/here_api.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def _keys(self): """Return an iterator through the pickle files in this store.""" for name in listdir(abspath(self._path)): key, ext = splitext(name) if ext == ".pkl": yield key def _has(self, key): """Return whether a pickle file ex...
code_fim
hard
{ "lang": "python", "repo": "Ilgrim/cwmud", "path": "/cwmud/core/pickle.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ilgrim/cwmud path: /cwmud/core/pickle.py # -*- coding: utf-8 -*- """Pickle serialization and storage.""" # Part of Clockwork MUD Server (https://github.com/whutch/cwmud) # :copyright: (c) 2008 - 2017 Will Hutcheson # :license: MIT (https://github.com/whutch/cwmud/blob/master/LICENSE.txt) from os...
code_fim
hard
{ "lang": "python", "repo": "Ilgrim/cwmud", "path": "/cwmud/core/pickle.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return driver.main() if __name__ == '__main__': sys.exit(main())<|fim_prefix|># repo: hqs2212586/qingcloud-cli path: /bin/qingcloud.py # -*- coding:utf-8 -*- __author__ = 'Qiushi Huang' import os,sys,platform <|fim_middle|>#for linux if platform.system() == "Windows": BASE_DIR = '\\'.join...
code_fim
hard
{ "lang": "python", "repo": "hqs2212586/qingcloud-cli", "path": "/bin/qingcloud.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if __name__ == '__main__': sys.exit(main())<|fim_prefix|># repo: hqs2212586/qingcloud-cli path: /bin/qingcloud.py # -*- coding:utf-8 -*- __author__ = 'Qiushi Huang' import os,sys,platform #for linux if platform.system() == "Windows": BASE_DIR = '\\'.join(os.path.abspath(os.path.dirname(__file_...
code_fim
easy
{ "lang": "python", "repo": "hqs2212586/qingcloud-cli", "path": "/bin/qingcloud.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hqs2212586/qingcloud-cli path: /bin/qingcloud.py # -*- coding:utf-8 -*- __author__ = 'Qiushi Huang' import os,sys,platform #for linux if platform.system() == "Windows": BASE_DIR = '\\'.join(os.path.abspath(os.path.dirname(__file__)).split('\\')[:-1]) print(BASE_DIR) else: BASE_DIR =...
code_fim
easy
{ "lang": "python", "repo": "hqs2212586/qingcloud-cli", "path": "/bin/qingcloud.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>d_packages(), classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: BSD License", ], python_requires='>=3.1', )<|fim_prefix|># repo: apizzuto/v2_alert_stacking_FRA path: /setup.py import setuptools long_message = 'FRANCIS: Fast Response Analysis for...
code_fim
medium
{ "lang": "python", "repo": "apizzuto/v2_alert_stacking_FRA", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: apizzuto/v2_alert_stacking_FRA path: /setup.py import setuptools long_message = 'FRANCIS: Fast Response Analysis for Neutrino Coincidences with IceCube Signals' version = "0.0.1" setuptools.setup( name="fran<|fim_suffix|>essage, #long_description_content_type="text/markdown", url="h...
code_fim
medium
{ "lang": "python", "repo": "apizzuto/v2_alert_stacking_FRA", "path": "/setup.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>essage, #long_description_content_type="text/markdown", url="https://github.com/icecube/wg-nu-sources/2021_v2_alert_stacking_FRA", packages=setuptools.find_packages(), classifiers=[ "Programming Language :: Python :: 3", "License :: OSI Approved :: BSD License", ], ...
code_fim
medium
{ "lang": "python", "repo": "apizzuto/v2_alert_stacking_FRA", "path": "/setup.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: claudijd/honeycomb path: /honeycomb/commands/service/logs.py # -*- coding: utf-8 -*- """Honeycomb service logs command.""" import os import logging import threading import click from honeycomb.defs import SERVICES from honeycomb.utils.tailer import Tailer from honeycomb.servicemanager.defs imp...
code_fim
hard
{ "lang": "python", "repo": "claudijd/honeycomb", "path": "/honeycomb/commands/service/logs.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @click.command(short_help="Show logs for a daemonized service.") @click.option("-n", "--num", type=int, default=10, help="Number of lines to read from end of file", show_default=True) @click.option("-f", "--follow", is_flag=True, default=False, help="Follow log output") @click.argument("services", requir...
code_fim
hard
{ "lang": "python", "repo": "claudijd/honeycomb", "path": "/honeycomb/commands/service/logs.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: contengee/kuma_utils path: /torch/hooks/simple_hook.py from .base import HookTemplate class SimpleHook(HookTemplate): def __init__(self, evaluate_batch=False): super().__init__() self.evaluate_batch = evaluate_batch def forward_train(self, trainer, inputs): tar...
code_fim
hard
{ "lang": "python", "repo": "contengee/kuma_utils", "path": "/torch/hooks/simple_hook.py", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> storage = trainer.epoch_storage if self.evaluate_batch: # Batch level evaluation metric_total = storage['batch_metric'].mean(0) monitor_metrics_total = storage['batch_monitor'].mean(0).tolist() else: # Dataset level evaluation if trainer.eval_me...
code_fim
hard
{ "lang": "python", "repo": "contengee/kuma_utils", "path": "/torch/hooks/simple_hook.py", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|># repo: shish/context-demos path: /basic.py #!/usr/bin/env python from threading import Thread from time import sleep import sys sys.path.append("../context-apis/python/") import context.api as c def thread_1(): c.log_bmark("Server thread spawned") c.log_start("Logging in", bookmark=True) ...
code_fim
hard
{ "lang": "python", "repo": "shish/context-demos", "path": "/basic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c.log_start("Logging in", bookmark=True) sleep(0.1) c.log_start("Search database") sleep(0.3) c.log_endok("Search database") c.log_start("Initialise session for 'laura'") sleep(0.3) c.log_endok("Initialise session for 'laura'") c.log_start("Render") sleep(0.1) c...
code_fim
hard
{ "lang": "python", "repo": "shish/context-demos", "path": "/basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> c.log_start("Read article", bookmark=True) sleep(0.05) c.log_start("Search database") sleep(0.3) c.log_endok("Search database") c.log_start("Render") sleep(0.1) c.log_endok("Render") sleep(0.05) c.log_endok("Read article") if __name__ == "__main__": c.set_log("...
code_fim
hard
{ "lang": "python", "repo": "shish/context-demos", "path": "/basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> val_acc_history = [] val_f1_history = [] best_model_wts = copy.deepcopy(model.state_dict()) best_acc = 0.0 best_f1 = 0.0 # Detect if we have a GPU available device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") for epoch in range(num_epochs): pr...
code_fim
hard
{ "lang": "python", "repo": "Leo-xxx/kissing-detector", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Leo-xxx/kissing-detector path: /train.py # adapted from PyTorch tutorials import copy import time from typing import List, Tuple, Optional import torch import torch.optim as optim from torch import nn from data import AudioVideo, AudioVideo3D from kissing_detector import KissingDetector, Kissin...
code_fim
hard
{ "lang": "python", "repo": "Leo-xxx/kissing-detector", "path": "/train.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> best_model_wts = copy.deepcopy(model.state_dict()) best_acc = 0.0 best_f1 = 0.0 # Detect if we have a GPU available device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu") for epoch in range(num_epochs): print('Epoch {}/{}'.format(epoch, num_epochs - 1)) ...
code_fim
hard
{ "lang": "python", "repo": "Leo-xxx/kissing-detector", "path": "/train.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mozilla/python_mozetl path: /mozetl/constants.py # Restrict to a whitelist of search_source's to avoid double counting while # we test our new search_count telemetry developed in: # https://bugzilla.mozilla.org/show_bug.cgi?id=1367554 # https://bugzilla.mozil<|fim_suffix|>, "newtab", "con...
code_fim
medium
{ "lang": "python", "repo": "mozilla/python_mozetl", "path": "/mozetl/constants.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, "newtab", "contextmenu", "system", "activitystream", "webextension", "alias", ]<|fim_prefix|># repo: mozilla/python_mozetl path: /mozetl/constants.py # Restrict to a whitelist of search_source's to avoid double counting while # we test our new search_count telemetry developed in...
code_fim
medium
{ "lang": "python", "repo": "mozilla/python_mozetl", "path": "/mozetl/constants.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: airqo-platform/AirQo-frontend path: /website/backend/event/migrations/0003_alter_session_options.py # Generated by Django 4.1.7 on 2023-03-23 10:33 from django.db import migrations <|fim_suffix|> dependencies = [ ('event', '0002_session_order'), ] operations = [ migr...
code_fim
easy
{ "lang": "python", "repo": "airqo-platform/AirQo-frontend", "path": "/website/backend/event/migrations/0003_alter_session_options.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class Migration(migrations.Migration): dependencies = [ ('event', '0002_session_order'), ] operations = [ migrations.AlterModelOptions( name='session', options={'ordering': ['order']}, ), ]<|fim_prefix|># repo: airqo-platform/AirQo-frontend...
code_fim
easy
{ "lang": "python", "repo": "airqo-platform/AirQo-frontend", "path": "/website/backend/event/migrations/0003_alter_session_options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dependencies = [ ('event', '0002_session_order'), ] operations = [ migrations.AlterModelOptions( name='session', options={'ordering': ['order']}, ), ]<|fim_prefix|># repo: airqo-platform/AirQo-frontend path: /website/backend/event/migration...
code_fim
easy
{ "lang": "python", "repo": "airqo-platform/AirQo-frontend", "path": "/website/backend/event/migrations/0003_alter_session_options.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Cguilliman/django-ib-menus path: /menus/models/queysets.py from django.db import models from mptt.models import TreeManager <|fim_suffix|> return super().get_queryset() def get_by_position(self, position): """Get objects by position""" return self.get_queryset().fil...
code_fim
hard
{ "lang": "python", "repo": "Cguilliman/django-ib-menus", "path": "/menus/models/queysets.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Get objects by position""" return self.get_queryset().filter(position=position)<|fim_prefix|># repo: Cguilliman/django-ib-menus path: /menus/models/queysets.py from django.db import models from mptt.models import TreeManager <|fim_middle|>__all__ = ("BaseMenuManager", ) class Base...
code_fim
hard
{ "lang": "python", "repo": "Cguilliman/django-ib-menus", "path": "/menus/models/queysets.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> state = self.hass.states.get(self.entity.entity_id) self.assertTrue(state.attributes.get(ATTR_HIDDEN)) def test_overwriting_hidden_property_to_true(self): """ Test we can overwrite hidden property to True. """ entity.Entity.overwrite_attribute(self.entity.entity_id, ...
code_fim
hard
{ "lang": "python", "repo": "maddox/home-assistant", "path": "/tests/helpers/test_entity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: maddox/home-assistant path: /tests/helpers/test_entity.py """ tests.test_helper_entity ~~~~~~~~~~~~~~~~~~~~~~~~ Tests the entity helper. """ # pylint: disable=protected-access,too-many-public-methods import unittest import homeassistant.core as ha import homeassistant.helpers.entity as entity f...
code_fim
hard
{ "lang": "python", "repo": "maddox/home-assistant", "path": "/tests/helpers/test_entity.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Stop down stuff we started. """ self.hass.stop() entity.Entity.overwrite_attribute(self.entity.entity_id, [ATTR_HIDDEN], [None]) def test_default_hidden_not_in_attributes(self): """ Test that the default hidden property is ...
code_fim
hard
{ "lang": "python", "repo": "maddox/home-assistant", "path": "/tests/helpers/test_entity.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.basic = ['free']<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_freeing.py #calss header class _FREEING(): def __init__(self,): self.name = "FREEING" self.definitions = free <|fim_middle|> self.parents = [] self.childen = [] self.properties = [] self.jsonda...
code_fim
medium
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_freeing.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cash2one/xai path: /xai/brain/wordbase/otherforms/_freeing.py #calss header class _FREEING(): <|fim_suffix|> self.name = "FREEING" self.definitions = free self.parents = [] self.childen = [] self.properties = [] self.jsondata = {} self.basic = ['free']<|fim_middle|> def __init__...
code_fim
easy
{ "lang": "python", "repo": "cash2one/xai", "path": "/xai/brain/wordbase/otherforms/_freeing.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> @classmethod def handler(cls, message): responses = CommandHandler.inner_handler(message) output_responses = [] for (response_to, response) in responses: if response_to == "" and response == "": break if response_to == "*": ...
code_fim
hard
{ "lang": "python", "repo": "georgeteo/samsu-assasins", "path": "/model/handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """ Return [(number, msg),...]""" action, params = CommandHandler.get_command(message.Body) attacker = Util.get_attacker(message.From) if action == "KILL": return Kill.handler(attacker, params) elif action[1:] == "REPLY": ref = params.pop(0)...
code_fim
hard
{ "lang": "python", "repo": "georgeteo/samsu-assasins", "path": "/model/handler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: georgeteo/samsu-assasins path: /model/handler.py from model.reply import Reply from model.kill import Kill from model.util import Util from model.error import CommandError import logging from model.bomb import Bomb from model.disarm import Disarm from model.player import Player from model.snipe i...
code_fim
hard
{ "lang": "python", "repo": "georgeteo/samsu-assasins", "path": "/model/handler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zhoufei9/python path: /application/models/sharesHotTop100.py # -*- coding: utf-8 -*- from .base import ModelsBase class sharesHotTop100(ModelsBase): <|fim_suffix|> def shuchu(self): print('表名sharesHotTop100' + self.a) "调用子类构造方法"<|fim_middle|> def __init__(self,a): s...
code_fim
medium
{ "lang": "python", "repo": "zhoufei9/python", "path": "/application/models/sharesHotTop100.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print('表名sharesHotTop100' + self.a) "调用子类构造方法"<|fim_prefix|># repo: zhoufei9/python path: /application/models/sharesHotTop100.py # -*- coding: utf-8 -*- from .base import ModelsBase class sharesHotTop100(ModelsBase): def __init__(self,a): self.a = a print('111') <|fi...
code_fim
easy
{ "lang": "python", "repo": "zhoufei9/python", "path": "/application/models/sharesHotTop100.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Learn grammar lex.learn('datasets/{}/{}_training.txt'.format(args.language_name, args.language_name), 'datasets/{}/{}_constraints.txt'.format(args.language_name, args.language_name), 'dat...
code_fim
hard
{ "lang": "python", "repo": "bhallen/pyparadigms", "path": "/learn.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: bhallen/pyparadigms path: /learn.py """ Command-line interface for learning a grammar using Sublexical Morphology """ import paradigms import argparse ##################################################################### ## Parse command line arguments ## ##...
code_fim
hard
{ "lang": "python", "repo": "bhallen/pyparadigms", "path": "/learn.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: cohen39/fixedwing_gazebo path: /tools/stl_tools.py import os import subprocess from pathlib import Path from typing import List parts_subdivide = [] parts_decimate = [] def openscad_stl_export(scad_file: Path, part: str, out_dir: Path): """ Export stl components from an openscad model. ...
code_fim
hard
{ "lang": "python", "repo": "cohen39/fixedwing_gazebo", "path": "/tools/stl_tools.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>def decimate(file_in: Path, file_out: Path, ratio: float): assert ratio > 0 and ratio < 1 script = decimate_script.format(**{ 'file_in': str(file_in), 'file_out': str(file_out), 'ratio': ratio}) #print(script) with open("/tmp/decimate.py", "w") as f: f.write(script) sub...
code_fim
hard
{ "lang": "python", "repo": "cohen39/fixedwing_gazebo", "path": "/tools/stl_tools.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: xue-yuan/lingram path: /bot/utils/__init__.py from config import config as CONFIG <|fim_suffix|> for f in os.listdir(CONFIG.APP.TMP_FOLDER): if f == '.gitkeep': continue shutil.rmtree(f'{CONFIG.APP.TMP_FOLDER}/{f}')<|fim_middle|>def clean_tmp_folder(): import os import...
code_fim
easy
{ "lang": "python", "repo": "xue-yuan/lingram", "path": "/bot/utils/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for f in os.listdir(CONFIG.APP.TMP_FOLDER): if f == '.gitkeep': continue shutil.rmtree(f'{CONFIG.APP.TMP_FOLDER}/{f}')<|fim_prefix|># repo: xue-yuan/lingram path: /bot/utils/__init__.py from config import config as CONFIG <|fim_middle|>def clean_tmp_folder(): import os import...
code_fim
easy
{ "lang": "python", "repo": "xue-yuan/lingram", "path": "/bot/utils/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if args.awesome_list_mode: collector.mapAwesomeListsToGithubLinks() if args.githublinks_file: collector.dumpGithubLinks(args.githublinks_file) if args.redownload: collector.downloadReadmeFiles(args.readme_folder) collector.createDatabase(args.outfolder, args.readme_folder) elif args...
code_fim
hard
{ "lang": "python", "repo": "SoftwareUnderstanding/rolf", "path": "/src/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: SoftwareUnderstanding/rolf path: /src/main.py import json import sys from typing import List import pandas as pd import argparse from sklearn.model_selection import train_test_split import logthis from preprocessing import preprocess_file from util.utils import BASE_CATEGORIES, getCategories fro...
code_fim
hard
{ "lang": "python", "repo": "SoftwareUnderstanding/rolf", "path": "/src/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def push_note(self, device_iden, title, body): """Push note to a device""" self.session.post( PUSH_URL, json={ "device_iden": device_iden, "type": "note", "title": title, "body": body })...
code_fim
hard
{ "lang": "python", "repo": "Kokan/syslogng-pushbullet", "path": "/syslogng_pushbullet/pushbullet.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Kokan/syslogng-pushbullet path: /syslogng_pushbullet/pushbullet.py # -*- coding: utf-8 -*- import requests PUSH_URL = "https://api.pushbullet.com/v2/pushes" DEVICES_URL = "https://api.pushbullet.com/v2/devices" class PushbulletClient(object): """Pushbullet client""" def __init__(self...
code_fim
hard
{ "lang": "python", "repo": "Kokan/syslogng-pushbullet", "path": "/syslogng_pushbullet/pushbullet.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#train_dir = '/mnt/c/Users/sophi/Documents/phd/data/coliee2019/task1/task1_train' # # load directory structure # list_dir = [x for x in os.walk(args.train_dir)] for sub_dir in list_dir[0][1]: with jsonlines.open(os.path.join(args.train_dir, sub_dir, 'candidates.jsonl'), mode='w') as wr...
code_fim
medium
{ "lang": "python", "repo": "keshava/bert-pli", "path": "/preprocessing/coliee19_task1_index_jsonl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: keshava/bert-pli path: /preprocessing/coliee19_task1_index_jsonl.py import os import argparse import random import jsonlines random.seed(42) # # config # parser = argparse.ArgumentParser() parser.add_argument('--train-dir', action='store', dest='train_dir', help=...
code_fim
medium
{ "lang": "python", "repo": "keshava/bert-pli", "path": "/preprocessing/coliee19_task1_index_jsonl.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>for sub_dir in list_dir[0][1]: with jsonlines.open(os.path.join(args.train_dir, sub_dir, 'candidates.jsonl'), mode='w') as writer: # read in all paragraphs with their names and then choose the relevant ones and sample irrelevant ones! list_sub_dir_paragraphs = [x for x in os.walk(os...
code_fim
medium
{ "lang": "python", "repo": "keshava/bert-pli", "path": "/preprocessing/coliee19_task1_index_jsonl.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def submitter(url): driver = init_Driver() # Start survey nxt = WebDriverWait(driver, 10).until(EC.presence_of_element_located((By.XPATH, '/html/body/div/form/div[2]/div[3]/input'))) nxt.click() # Sends full name fn = driver.find_element_by_name('t50100775') fn.send_keys(...
code_fim
hard
{ "lang": "python", "repo": "GeekMuch/autoapplyvaxx", "path": "/vaxx_region_hovedstad.py", "mode": "spm", "license": "LicenseRef-scancode-wtfpl-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: GeekMuch/autoapplyvaxx path: /vaxx_region_hovedstad.py #!/usr/bin/python #!/usr/local/bin/python import os import sys import time import platform from termcolor import colored from selenium import webdriver from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by...
code_fim
hard
{ "lang": "python", "repo": "GeekMuch/autoapplyvaxx", "path": "/vaxx_region_hovedstad.py", "mode": "psm", "license": "LicenseRef-scancode-wtfpl-1.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: IFRCGo/go-api path: /country_plan/tests/test_commands.py from unittest import mock from django.core.management import call_command from main.test_case import APITestCase from api.factories.country import CountryFactory from country_plan.factories import CountryPlanFactory from country_plan.model...
code_fim
hard
{ "lang": "python", "repo": "IFRCGo/go-api", "path": "/country_plan/tests/test_commands.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> headers = { 'Content-Type': 'application/pdf', 'Content-Disposition': 'attachment;filename=Sample_document_2023.pdf', } if url.endswith('NOOP'): headers['Content-Type'] = 'html/text' elif url.endswith('000004'): headers['Conte...
code_fim
hard
{ "lang": "python", "repo": "IFRCGo/go-api", "path": "/country_plan/tests/test_commands.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make sure the manifests directory exists mkdir_p(os.path.dirname(self.manifests['exe'].path)) # Set flag to auto-scan input directories self.scaninputs = self.manifest_config.get('scaninputs', True) if self.reproduce['input'] and self.scaninputs: pri...
code_fim
hard
{ "lang": "python", "repo": "aekiss/payu", "path": "/payu/manifest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aekiss/payu path: /payu/manifest.py """payu.manifest =============== Provides an manifest class to store manifest data, which uses a subclassed yamanifest PayuManifest class :copyright: Copyright 2019 Aidan Heerdegen, see AUTHORS for details. :license: Apache License, Version 2.0...
code_fim
hard
{ "lang": "python", "repo": "aekiss/payu", "path": "/payu/manifest.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if copy: self.data[filepath]['copy'] = copy if filepath in self.existing_filepaths: self.existing_filepaths.remove(filepath) return True def add_fast(self, filepath, hashfn=None, force=False): """ Bespoke function to add filepaths but ...
code_fim
hard
{ "lang": "python", "repo": "aekiss/payu", "path": "/payu/manifest.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>def test_registered(): from ezdxf.entities.factory import ENTITY_CLASSES assert "TOLERANCE" in ENTITY_CLASSES def test_default_init(): entity = Tolerance() assert entity.dxftype() == "TOLERANCE" assert entity.dxf.handle is None assert entity.dxf.owner is None def test_default_...
code_fim
hard
{ "lang": "python", "repo": "mozman/ezdxf", "path": "/tests/test_02_dxf_graphics/test_238_tolerance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_load_from_text(entity): assert entity.dxf.layer == "0" assert entity.dxf.color == 256, "default color is 256 (by layer)" assert entity.dxf.dimstyle == "Standard" assert entity.dxf.insert == (0, 0, 0) assert entity.dxf.extrusion == (0, 0, 1) # default value assert entity....
code_fim
hard
{ "lang": "python", "repo": "mozman/ezdxf", "path": "/tests/test_02_dxf_graphics/test_238_tolerance.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mozman/ezdxf path: /tests/test_02_dxf_graphics/test_238_tolerance.py # Copyright (c) 2019 Manfred Moitzi # License: MIT License import pytest import ezdxf from ezdxf.entities.tolerance import Tolerance from ezdxf.lldxf.tagwriter import TagCollector, basic_tags_from_text TOLERANCE = """0 TOLERANC...
code_fim
hard
{ "lang": "python", "repo": "mozman/ezdxf", "path": "/tests/test_02_dxf_graphics/test_238_tolerance.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: cabrittin/volumetric_analysis path: /scripts/dist_adj_subgrp2.py """ dist_adj_subgrp2.py Plots adjacency degree distributions broken down by anatomical groups created: Christopher Brittin date: 01 November 2018 """ import sys sys.path.append(r'./volumetric_analysis') import matplotlib.pyplot...
code_fim
hard
{ "lang": "python", "repo": "cabrittin/volumetric_analysis", "path": "/scripts/dist_adj_subgrp2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data = [] for i in range(len(n2u)): data.append(n2u[i]) data.append(jsh[i]) fig,ax = plt.subplots(1,1,figsize=(15,10)) dist_adj_subgroups2(ax,data,fout=fout) ax.xaxis.set_tick_params(labelsize=20) plt.show() if __name__ == '__main__': run()<|fim_pref...
code_fim
hard
{ "lang": "python", "repo": "cabrittin/volumetric_analysis", "path": "/scripts/dist_adj_subgrp2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def group_degrees(db,_neuron_class): _remove = ['VC01','VD01','VB01','VB02'] nclass = aux.read.into_dict(_neuron_class) C = from_db(db,adjacency=True,remove=_remove) C.A.assign_membership_dict(nclass,key='group') sp_idx = get_group_index(C.A,['Sp1','Sp2']) i1_idx = get_group_...
code_fim
hard
{ "lang": "python", "repo": "cabrittin/volumetric_analysis", "path": "/scripts/dist_adj_subgrp2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hamster_files = glob.glob(osp.join(hamster_dir, jpeg)) hare_files = glob.glob(osp.join(hare_dir, jpeg)) all_files = list(hamster_files) + list(hare_files) all_labels = [0] * len(hamster_files) + [1] * len(hare_files) shuffle_lists(all_files, all_labels) train_idx = int(len(all...
code_fim
hard
{ "lang": "python", "repo": "hoangtnm/deep-learning", "path": "/tutorials/Intel-TF101-Class8/helpers_07.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> hamster_dir = osp.join(parent_dir, "hamsterhare", "hamster") hare_dir = osp.join(parent_dir, "hamsterhare", "hare") jpeg = "*.JPEG" hamster_files = glob.glob(osp.join(hamster_dir, jpeg)) hare_files = glob.glob(osp.join(hare_dir, jpeg)) all_files = list(hamster_files) + list(h...
code_fim
hard
{ "lang": "python", "repo": "hoangtnm/deep-learning", "path": "/tutorials/Intel-TF101-Class8/helpers_07.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: hoangtnm/deep-learning path: /tutorials/Intel-TF101-Class8/helpers_07.py import random, glob, sys import os.path as osp import tensorflow as tf import numpy as np from helpers_05 import grouper, flatten, fully_connected_layer from helpers_06 import maybe_download, maybe_extract def shuffle_arr...
code_fim
hard
{ "lang": "python", "repo": "hoangtnm/deep-learning", "path": "/tutorials/Intel-TF101-Class8/helpers_07.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: wachjose88/local-lti-consumer path: /lti_consumer/manage.py #!/usr/bin/env python # Copyright (c) 2018 Josef Wachtler # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software...
code_fim
medium
{ "lang": "python", "repo": "wachjose88/local-lti-consumer", "path": "/lti_consumer/manage.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>import os import sys if __name__ == "__main__": os.environ.setdefault("DJANGO_SETTINGS_MODULE", "lti_consumer.settings") try: from django.core.management import execute_from_command_line except ImportError: # The above import may fail for some other reason. Ensure that the ...
code_fim
medium
{ "lang": "python", "repo": "wachjose88/local-lti-consumer", "path": "/lti_consumer/manage.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gabrielgts/itapecerica-simulation path: /MapGenerator/mapGraphKepler.py import matplotlib.pyplot as plt import pandas as pd import os from six.moves import urllib import pandas as pd # importing the Pandas Library as 'pd' from keplergl import KeplerGl # importing KeplerGl import geopandas as g...
code_fim
medium
{ "lang": "python", "repo": "gabrielgts/itapecerica-simulation", "path": "/MapGenerator/mapGraphKepler.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>map.add_data(data=gdf, name="IQA") # add geoenabled dataframe to map map.save_to_html(file_name='GeoViz.html') map<|fim_prefix|># repo: gabrielgts/itapecerica-simulation path: /MapGenerator/mapGraphKepler.py import matplotlib.pyplot as plt import pandas as pd import os from six.moves import urllib <|...
code_fim
hard
{ "lang": "python", "repo": "gabrielgts/itapecerica-simulation", "path": "/MapGenerator/mapGraphKepler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>dataset.head() #Create a basemap map = KeplerGl(height=600, width=800) # Create a geodataframe gdf = gpd.GeoDataFrame( dataset, geometry=gpd.points_from_xy(dataset.latitude, dataset.longitude)) #make sure that your latitude and longitude are named as they are in your csv map.add_data(data=gdf, n...
code_fim
medium
{ "lang": "python", "repo": "gabrielgts/itapecerica-simulation", "path": "/MapGenerator/mapGraphKepler.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pipeline_builder = sdc_builder.get_pipeline_builder() # Dev raw data source dev_raw_data_source = pipeline_builder.add_stage('Dev Raw Data Source') dev_raw_data_source.set_attributes(data_format='JSON', raw_data=data, ...
code_fim
hard
{ "lang": "python", "repo": "streamsets/datacollector-tests", "path": "/stage/test_google_bigquery_enterprise_destination.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: streamsets/datacollector-tests path: /stage/test_google_bigquery_enterprise_destination.py er_first_batch=True) # Google BigQuery destination stage bigquery = pipeline_builder.add_stage(name=DESTINATION_STAGE_NAME) bigquery.set_attributes(project_id=gcp.project_id, ...
code_fim
hard
{ "lang": "python", "repo": "streamsets/datacollector-tests", "path": "/stage/test_google_bigquery_enterprise_destination.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: logger.info(f'Creating temporary bucket {bucket_name}') bucket = gcp.retry_429(gcp.storage_client.create_bucket)(bucket_name) logger.info('Creating dataset %s using Google BigQuery client ...', dataset_name) bigquery_client.create_dataset(dataset_ref) sdc...
code_fim
hard
{ "lang": "python", "repo": "streamsets/datacollector-tests", "path": "/stage/test_google_bigquery_enterprise_destination.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: soeque1/bert_torchserve path: /get_bert.py from transformers import BertModel, BertTokenizer def main(): <|fim_suffix|>if __name__ == "__main__": main()<|fim_middle|> tokenizer = BertTokenizer.from_pretrained("bert-base-uncased", unk_token="<|unkwn|>") tokenizer.save_vocabulary('bert'...
code_fim
hard
{ "lang": "python", "repo": "soeque1/bert_torchserve", "path": "/get_bert.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": main()<|fim_prefix|># repo: soeque1/bert_torchserve path: /get_bert.py from transformers import BertModel, BertTokenizer <|fim_middle|>def main(): tokenizer = BertTokenizer.from_pretrained("bert-base-uncased", unk_token="<|unkwn|>") tokenizer.save_vocabulary('bert'...
code_fim
hard
{ "lang": "python", "repo": "soeque1/bert_torchserve", "path": "/get_bert.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> schema_stdout = capsys.readouterr().out schema = yaml.load(schema_stdout, Loader=yaml.SafeLoader) assert 'openapi' in schema assert 'info' in schema assert 'paths' in schema<|fim_prefix|># repo: MissiaL/drf-spectacular path: /tests/test_command.py import yaml from django.core import m...
code_fim
medium
{ "lang": "python", "repo": "MissiaL/drf-spectacular", "path": "/tests/test_command.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: MissiaL/drf-spectacular path: /tests/test_command.py import yaml from django.core import management <|fim_suffix|> schema_stdout = capsys.readouterr().out schema = yaml.load(schema_stdout, Loader=yaml.SafeLoader) assert 'openapi' in schema assert 'info' in schema assert 'paths...
code_fim
medium
{ "lang": "python", "repo": "MissiaL/drf-spectacular", "path": "/tests/test_command.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> """ exists = False if get_occurrence_of_key(lookup_dict, key) > 0: exists = True return exists def _key_list_search(self, keys_list, lookup_dict): """ Return the final value returned after iterating over keys_list. In order to hand...
code_fim
hard
{ "lang": "python", "repo": "ABORGT/PyConvertAlert", "path": "/pyconvertalert/py_convert_alert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> lookup_key : str This is the key we are looking up in our arbitrary alert json structure to be assigned as the value of the transform_key. lookup_dict : dict This is the arbitrary alert we are searching for values to be assigned to our trans...
code_fim
hard
{ "lang": "python", "repo": "ABORGT/PyConvertAlert", "path": "/pyconvertalert/py_convert_alert.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ABORGT/PyConvertAlert path: /pyconvertalert/py_convert_alert.py #!/usr/bin/env python3 # -*_ coding: utf-8 -*- # """ Simple library to convert an alert from an arbitrary alerting system to an Alert Manager alert based on config. """ import json import pathlib import copy from nested_lookup impor...
code_fim
hard
{ "lang": "python", "repo": "ABORGT/PyConvertAlert", "path": "/pyconvertalert/py_convert_alert.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mobiusklein/glycresoft path: /src/glycan_profiling/cli/base.py import logging import multiprocessing import click from glycan_profiling import version from glycan_profiling.cli.logger_config import make_log_file_logger, LOG_FILE_MODE, LOG_LEVEL CONTEXT_SETTINGS = dict(help_option_names=['-h', ...
code_fim
hard
{ "lang": "python", "repo": "mobiusklein/glycresoft", "path": "/src/glycan_profiling/cli/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> click.option = option click.argument = argument processes_option = click.option( "-p", "--processes", 'processes', type=click.IntRange(1, multiprocessing.cpu_count()), default=min(multiprocessing.cpu_count(), 4), help=('Number of worker processes to use. Defaults to 4 ' ...
code_fim
medium
{ "lang": "python", "repo": "mobiusklein/glycresoft", "path": "/src/glycan_profiling/cli/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }