text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPO...
code_fim
hard
{ "lang": "python", "repo": "DexterInd/GrovePi", "path": "/Software/Python/grove_barometer_sensors/high_accuracy_hp206c_barometer/high_accuracy_barometer_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ret=h.isAvailable() if h.OK_HP20X_DEV == ret: print("HP20x_dev is available.") else: print("HP20x_dev isn't available.") temp=h.ReadTemperature() pressure=h.ReadPressure() altitude=h.ReadAltitude() print("Temperature\t: %.2f C\nPressure\t: %.2f hPa\nAltitude\t: %.2f m" %(temp,pressure,altitud...
code_fim
hard
{ "lang": "python", "repo": "DexterInd/GrovePi", "path": "/Software/Python/grove_barometer_sensors/high_accuracy_hp206c_barometer/high_accuracy_barometer_example.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Example:: >>> from keystoneclient import discover >>> disc = discover.Discovery(auth_url='http://localhost:5000') >>> disc.raw_version_data() [{'id': 'v3.0', 'links': [{'href': 'http://127.0.0.1:5000/v3/', ...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-keystoneclient", "path": "/keystoneclient/discover.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/python-keystoneclient path: /keystoneclient/discover.py # 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 # # Unless required by applicable law or agreed to in writing, software # dis...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-keystoneclient", "path": "/keystoneclient/discover.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: openstack/python-keystoneclient path: /keystoneclient/discover.py 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 # # Unless required by applicabl...
code_fim
hard
{ "lang": "python", "repo": "openstack/python-keystoneclient", "path": "/keystoneclient/discover.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liusulin/Ax path: /ax/benchmark/benchmark_result.py #!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging from dataclasses import datac...
code_fim
hard
{ "lang": "python", "repo": "liusulin/Ax", "path": "/ax/benchmark/benchmark_result.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns: An array representing the optimization trace as a function of time. """ if any(isinstance(trial, BatchTrial) for trial in experiment.trials.values()): raise NotImplementedError("Batched trials are not yet supported.") def get_completed_time(row): time = ex...
code_fim
hard
{ "lang": "python", "repo": "liusulin/Ax", "path": "/ax/benchmark/benchmark_result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def get_completed_time(row): time = experiment.trials[row.trial_index].run_metadata[completed_time_key] return pd.Series({"completed_time": time}) if include_only_completed_trials: completed_trials = experiment.trial_indices_by_status[TrialStatus.COMPLETED] data_df...
code_fim
hard
{ "lang": "python", "repo": "liusulin/Ax", "path": "/ax/benchmark/benchmark_result.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> try: msg = self.format(record) self.logs.append(msg) self.logs = self.logs[-1000:] self.flush() except Exception: self.handleError(record)<|fim_prefix|># repo: salesforce/Merlion path: /merlion/dashboard/utils/log.py # # Copyrigh...
code_fim
medium
{ "lang": "python", "repo": "salesforce/Merlion", "path": "/merlion/dashboard/utils/log.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: salesforce/Merlion path: /merlion/dashboard/utils/log.py # # Copyright (c) 2023 salesforce.com, inc. # All rights reserved. # SPDX-License-Identifier: BSD-3-Clause # For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause # import logging cla...
code_fim
medium
{ "lang": "python", "repo": "salesforce/Merlion", "path": "/merlion/dashboard/utils/log.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: capusta/handyAutomation path: /tensorflow/t.py #! /usr/bin/env python import tensorflow as tf import os, sys, argparse from tensorflow.contrib import lookup from tensorflow.python.platform import gfile os.environ['WORKSPACE'] = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) #sys.pa...
code_fim
medium
{ "lang": "python", "repo": "capusta/handyAutomation", "path": "/tensorflow/t.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # the text to be classified vocab_processor = tf.contrib.learn.preprocessing.VocabularyProcessor(MAX_DOC_LENGTH) vocab_processor.fit(LINES) with gfile.Open(outfilename, 'wb') as f: f.write("{}\n".format(PADWORD)) for w, i in vocab_processor.vocabulary_._mapping.iteritems()...
code_fim
hard
{ "lang": "python", "repo": "capusta/handyAutomation", "path": "/tensorflow/t.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: simonsdave/ecs path: /tests/load/locustfile.py # # this module is a locustfile drives load into a ECS deployment # # this locustfile is expected to called from a BASH script # import httplib import os import random import re import uuid from locust import HttpLocust import requests from locust ...
code_fim
hard
{ "lang": "python", "repo": "simonsdave/ecs", "path": "/tests/load/locustfile.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class QuickHealthBehavior(ECSTaskSet): min_wait = 500 max_wait = 1000 @task def quick_health_check(self): response = self.client.get('/v1.1/_health?quick=true', auth=_get_random_credentials()) self.log_on_response('Health-Check-Quick', response, httplib.OK) class Quick...
code_fim
hard
{ "lang": "python", "repo": "simonsdave/ecs", "path": "/tests/load/locustfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> min_wait = 500 max_wait = 1000 @task def quick_health_check(self): response = self.client.get('/v1.1/_health?quick=true', auth=_get_random_credentials()) self.log_on_response('Health-Check-Quick', response, httplib.OK) class QuickHealthLocust(ECSHttpLocust): task_s...
code_fim
hard
{ "lang": "python", "repo": "simonsdave/ecs", "path": "/tests/load/locustfile.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Args: xml (str or bytes) root (str): (optional) name of root element Returns: lxml document object. ''' if isinstance(xml, str) or isinstance(xml, bytes): dom = etree.XML(xml) else: dom = etree.XML(xml) ...
code_fim
hard
{ "lang": "python", "repo": "pmartin23/metapub", "path": "/metapub/base.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pmartin23/metapub path: /metapub/base.py from __future__ import absolute_import, unicode_literals import six from lxml import etree from .exceptions import MetaPubError, BaseXMLError def parse_elink_response(xmlstr): """ return all Ids from an elink XML response :param xmlstr: :...
code_fim
hard
{ "lang": "python", "repo": "pmartin23/metapub", "path": "/metapub/base.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def ratio(img, height=800): """Getting scale ratio.""" return img.shape[0] / height<|fim_prefix|># repo: gaurav879/PlagiarismChecker path: /backend/OCR/utils.py import cv2 def resize(img, height=800): <|fim_middle|> """Resize image to given height""" ratio = height / img.shape[0] re...
code_fim
medium
{ "lang": "python", "repo": "gaurav879/PlagiarismChecker", "path": "/backend/OCR/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> """Getting scale ratio.""" return img.shape[0] / height<|fim_prefix|># repo: gaurav879/PlagiarismChecker path: /backend/OCR/utils.py import cv2 def resize(img, height=800): """Resize image to given height""" ratio = height / img.shape[0] return cv2.resize(img, (int(ratio * img.shape...
code_fim
easy
{ "lang": "python", "repo": "gaurav879/PlagiarismChecker", "path": "/backend/OCR/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: gaurav879/PlagiarismChecker path: /backend/OCR/utils.py import cv2 def resize(img, height=800): <|fim_suffix|> """Getting scale ratio.""" return img.shape[0] / height<|fim_middle|> """Resize image to given height""" ratio = height / img.shape[0] return cv2.resize(img, (int(rat...
code_fim
medium
{ "lang": "python", "repo": "gaurav879/PlagiarismChecker", "path": "/backend/OCR/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def getMean(numbers): return sum(numbers) / len(numbers) if numbers else None out = getMean(numbers) print(out)<|fim_prefix|># repo: PedroBernini/ipl-2021 path: /set_1/p1_2_1.py # Programa para calcular a média aritmética de uma lista de números (que podem ser ints ou floats). <|fim_middle|>number...
code_fim
easy
{ "lang": "python", "repo": "PedroBernini/ipl-2021", "path": "/set_1/p1_2_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>out = getMean(numbers) print(out)<|fim_prefix|># repo: PedroBernini/ipl-2021 path: /set_1/p1_2_1.py # Programa para calcular a média aritmética de uma lista de números (que podem ser ints ou floats). numbers = [2, 7, 3, 9, 13] def getMean(numbers): <|fim_middle|> return sum(numbers) / len(numbers) ...
code_fim
medium
{ "lang": "python", "repo": "PedroBernini/ipl-2021", "path": "/set_1/p1_2_1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: PedroBernini/ipl-2021 path: /set_1/p1_2_1.py # Programa para calcular a média aritmética de uma lista de números (que podem ser ints ou floats). numbers = [2, 7, 3, 9, 13] <|fim_suffix|>out = getMean(numbers) print(out)<|fim_middle|>def getMean(numbers): return sum(numbers) / len(numbers) ...
code_fim
medium
{ "lang": "python", "repo": "PedroBernini/ipl-2021", "path": "/set_1/p1_2_1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data_root=data_root, ann_file=data_root + f's3dis_infos_Area_{i}.pkl', pipeline=train_pipeline, filter_empty_gt=False, classes=class_names, box_type_3d='Depth') for i in train_area ...
code_fim
hard
{ "lang": "python", "repo": "OpenGVLab/InternImage", "path": "/autonomous_driving/occupancy_prediction/projects/configs/_base_/datasets/s3dis-3d-5class.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: OpenGVLab/InternImage path: /autonomous_driving/occupancy_prediction/projects/configs/_base_/datasets/s3dis-3d-5class.py # dataset settings dataset_type = 'S3DISDataset' data_root = './data/s3dis/' class_names = ('table', 'chair', 'sofa', 'bookcase', 'board') train_area = [1, 2, 3, 4, 6] test_are...
code_fim
hard
{ "lang": "python", "repo": "OpenGVLab/InternImage", "path": "/autonomous_driving/occupancy_prediction/projects/configs/_base_/datasets/s3dis-3d-5class.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>dle3D', class_names=class_names, with_label=False), dict(type='Collect3D', keys=['points']) ]) ] # construct a pipeline for data and gt loading in show function # please keep its loading function consistent with test_pipeline (e.g. client) eval_pipeline ...
code_fim
hard
{ "lang": "python", "repo": "OpenGVLab/InternImage", "path": "/autonomous_driving/occupancy_prediction/projects/configs/_base_/datasets/s3dis-3d-5class.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> This function is called automatically when a Python process exits. Normally, the training script does not need to invoke this function at the end. In the case that the training script needs to initialize the distributed module multiple times (so far, this is needed in the unit tests), the...
code_fim
hard
{ "lang": "python", "repo": "hengruizhang98/dgl", "path": "/python/dgl/distributed/dist_context.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: hengruizhang98/dgl path: /python/dgl/distributed/dist_context.py """Initialize the distributed services""" import multiprocessing as mp import traceback import atexit import time import os import sys from . import rpc from .constants import MAX_QUEUE_SIZE from .kvstore import init_kvstore, clos...
code_fim
hard
{ "lang": "python", "repo": "hengruizhang98/dgl", "path": "/python/dgl/distributed/dist_context.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> """join the worker close process""" global SAMPLER_POOL if SAMPLER_POOL is not None: SAMPLER_POOL.join() SAMPLER_POOL = None def is_initialized(): """Is RPC initialized? """ return INITIALIZED def exit_client(): """Trainer exits This function is called automa...
code_fim
hard
{ "lang": "python", "repo": "hengruizhang98/dgl", "path": "/python/dgl/distributed/dist_context.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: pyzh/ix path: /ix/cmd.py import os import os.path from argparse import ArgumentParser from functools import wraps import logging logging.captureWarnings(True) logger = logging.getLogger('') logger.setLevel(logging.DEBUG) handler = logging.StreamHandler() formatter = logging.Formatter(fmt='%(mess...
code_fim
hard
{ "lang": "python", "repo": "pyzh/ix", "path": "/ix/cmd.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@command( argument("-r", "--recompile", action="store_true", help="recompile if already compiled before test"), argument("filename", nargs='?', help="path to solution")) def test(cfg, filename=None, recompile=False): """check solution against sample testcases""" for filename, (oj, problem)...
code_fim
hard
{ "lang": "python", "repo": "pyzh/ix", "path": "/ix/cmd.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: geertj/draco2 path: /draco2/command/config.py # vi: ts=8 sts=4 sw=4 et # # config.py: config commands # # This file is part of Draco2. Draco2 is free software and is made available # under the MIT license. Consult the file "LICENSE" that is distributed # together with this file for the exact lice...
code_fim
hard
{ "lang": "python", "repo": "geertj/draco2", "path": "/draco2/command/config.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> name = 'config' description = 'manage configuration' def __init__(self): super(ConfigCommand, self).__init__() self.add_subcommand(SetConfig()) self.add_subcommand(DeleteConfig()) self.add_subcommand(ListConfig())<|fim_prefix|># repo: geertj/draco2 path: /drac...
code_fim
hard
{ "lang": "python", "repo": "geertj/draco2", "path": "/draco2/command/config.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: scivision/mbta_salary path: /mbtasalary/plots.py from matplotlib.pyplot import figure import typing import pandas import numpy as np def doplot( data: pandas.DataFrame, ind: np.ndarray, saltype: str, thres: float, ax ) -> typing.Tuple[float, float, float, float, float]: # %% for analysi...
code_fim
hard
{ "lang": "python", "repo": "scivision/mbta_salary", "path": "/mbtasalary/plots.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fg.suptitle(f'{year} MBTA salary histograms', fontsize='xx-large') fg.tight_layout() fg.subplots_adjust(top=0.93) maxearner = data.loc[data['Salary'].idxmax(), :] maxsalary = maxearner['Salary'] try: maxearnerOT = maxsalary - maxearner['ProjSal'] print( ...
code_fim
hard
{ "lang": "python", "repo": "scivision/mbta_salary", "path": "/mbtasalary/plots.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: VTranCS/NewsTrust path: /sentimentTest.py # Imports the Google Cloud client library from google.cloud import language_v1 import math <|fim_suffix|> client = language_v1.LanguageServiceClient() document = language_v1.Document(content=tweet, type_=language_v1.Document.Type.PLAIN_TEXT) s...
code_fim
medium
{ "lang": "python", "repo": "VTranCS/NewsTrust", "path": "/sentimentTest.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> client = language_v1.LanguageServiceClient() document = language_v1.Document(content=tweet, type_=language_v1.Document.Type.PLAIN_TEXT) sentiment = client.analyze_sentiment(request={'document': document}).document_sentiment normDirection = (3.7 / (.3 * math.sqrt(2 * math.pi))) * math.e ** ...
code_fim
medium
{ "lang": "python", "repo": "VTranCS/NewsTrust", "path": "/sentimentTest.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> res = self.client.get(urlunquote(url)) self.assertEqual(res.status_code, 200) self.assertTemplateUsed(res, 'project/volumes/index.html') self.mox.UnsetStubs() return res def ensure_attachments_exist(self, volumes): volumes = copy.copy(volumes) ...
code_fim
hard
{ "lang": "python", "repo": "etforshell/horizon", "path": "/openstack_dashboard/dashboards/project/volumes/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>from openstack_dashboard import api from openstack_dashboard.dashboards.project.volumes.volumes \ import tables as volume_tables from openstack_dashboard.test import helpers as test INDEX_URL = reverse('horizon:project:volumes:index') class VolumeAndSnapshotsAndBackupsTests(test.TestCase): @te...
code_fim
hard
{ "lang": "python", "repo": "etforshell/horizon", "path": "/openstack_dashboard/dashboards/project/volumes/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: etforshell/horizon path: /openstack_dashboard/dashboards/project/volumes/test.py # Copyright 2012 Nebula, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at ...
code_fim
hard
{ "lang": "python", "repo": "etforshell/horizon", "path": "/openstack_dashboard/dashboards/project/volumes/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ctn-waterloo/nengo_pushbot path: /nengo_pushbot/pushbot2.py import socket import time import numpy as np import struct import atexit class PushBot2(object): def __init__(self, address, port=56000, message_delay=0.01): self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) ...
code_fim
hard
{ "lang": "python", "repo": "ctn-waterloo/nengo_pushbot", "path": "/nengo_pushbot/pushbot2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def stop(self): if self.socket is not None: self.beep(0, force=True) #self.laser(0, force=True) #self.led(0, force=True) self.socket.send('!M-\n') self.socket.send('E-\n') #self.send_motor(0, 0, force=True)<|fim_prefix|># ...
code_fim
hard
{ "lang": "python", "repo": "ctn-waterloo/nengo_pushbot", "path": "/nengo_pushbot/pushbot2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> data_out = pd.DataFrame(res, index=['absolute']).drop('chunk_height', axis=1).transpose() total_utxos = data_out.sum(axis=0)[0] print(str(total_utxos)) data_out['relative'] = (100. * data_out['absolute']) / (1. * total_utxos) print(str(data_out))<|fim_prefix|># repo: COMSYS/coinprune-s...
code_fim
hard
{ "lang": "python", "repo": "COMSYS/coinprune-scripts", "path": "/read_utxo_histogram.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: COMSYS/coinprune-scripts path: /read_utxo_histogram.py #!/usr/bin/env python3 """ This file parses a histogram CSV file generated via get_utxo_histogram.py. """ import sys import argparse import pandas as pd <|fim_suffix|> with open(f'{args.folder}/{args.prefix}{args.snapshot_height:010d}_h...
code_fim
hard
{ "lang": "python", "repo": "COMSYS/coinprune-scripts", "path": "/read_utxo_histogram.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> res = dict() res['chunk_height'] = args.snapshot_height for column in data: if column in ['chunk_height', 'chunk_offset']: continue res[column] = data[column].sum() data_out = pd.DataFrame(res, index=['absolute']).drop('chunk_height', axis=1).transpose() to...
code_fim
medium
{ "lang": "python", "repo": "COMSYS/coinprune-scripts", "path": "/read_utxo_histogram.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def f(): raise IgnoredException('any exception') try: utils.ignore_exception(f) except IgnoredException: self.fail('should not raise any exception.') def test_assure_cleanup(self): data = [0] def _enter(): data[...
code_fim
hard
{ "lang": "python", "repo": "emc-openstack/unity-cinder-driver", "path": "/cinder/tests/unit/volume/drivers/dell_emc/unity/test_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: emc-openstack/unity-cinder-driver path: /cinder/tests/unit/volume/drivers/dell_emc/unity/test_utils.py # Copyright (c) 2017 Dell Inc. or its subsidiaries. # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
code_fim
hard
{ "lang": "python", "repo": "emc-openstack/unity-cinder-driver", "path": "/cinder/tests/unit/volume/drivers/dell_emc/unity/test_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> start_time = time.time() orders_analysis = model_inventory.analyse_orders_abcxyz_from_file(file_path="data.csv", z_value=Decimal(1.28), reorder_cost=Decimal(5000), file_type="csv") sim = simulate.run_monte_carlo(orders_ana...
code_fim
hard
{ "lang": "python", "repo": "Jcaffert/supplychainpy", "path": "/supplychainpy/supplychain.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: Jcaffert/supplychainpy path: /supplychainpy/supplychain.py #!/usr/bin/env python3 import os from _decimal import Decimal import time from supplychainpy import simulate from supplychainpy import model_inventory __author__ = 'kevin' def main(): start_time = time.time() orders_analysis...
code_fim
hard
{ "lang": "python", "repo": "Jcaffert/supplychainpy", "path": "/supplychainpy/supplychain.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> train_op = self.get_train_op(loss) return train_op, loss def predict_no_crf(self, xs): feed_dict = self._fill_feed_dict(xs) pred_idxs, mask = self.sess.run([self._y_pred, self.mask_ph], feed_dict) # Filter by sequece length sequence_lengths = np.sum(ma...
code_fim
hard
{ "lang": "python", "repo": "vintagexav/DeepPavlov", "path": "/deeppavlov/models/ner/network.py", "mode": "spm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: vintagexav/DeepPavlov path: /deeppavlov/models/ner/network.py # Copyright 2017 Neural Networks and Deep Learning lab, MIPT # # 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 ...
code_fim
hard
{ "lang": "python", "repo": "vintagexav/DeepPavlov", "path": "/deeppavlov/models/ner/network.py", "mode": "psm", "license": "Python-2.0", "source": "the-stack-v2" }
<|fim_suffix|> try: osutils.remove(os.path.join('c:\\Users\\Hasee\\abaqus_plugins\\Fibre_insert', '_rsgTmp322_DB.py'), force=True ) osutils.remove(os.path.join('c:\\Users\\Hasee\\abaqus_plugins\\Fibre_insert', '_rsgTmp322_DB.pyc'), force=True ) except: pass ...
code_fim
hard
{ "lang": "python", "repo": "ericheshenghao/researh", "path": "/Fibre_insert/_rsgTmp322_Form.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: ericheshenghao/researh path: /Fibre_insert/_rsgTmp322_Form.py from abaqusGui import * from abaqusConstants import ALL import osutils, os ########################################################################### # Class definition ########################################################...
code_fim
medium
{ "lang": "python", "repo": "ericheshenghao/researh", "path": "/Fibre_insert/_rsgTmp322_Form.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: xairy/Facedancer path: /facedancer/backends/MAXUSBApp.py # MAXUSBApp.py # # Contains class definition for MAXUSBApp. import time from ..core import FacedancerApp from ..USB import * from ..USBDevice import USBDeviceRequest class MAXUSBApp(FacedancerApp): reg_ep0_fifo = 0...
code_fim
hard
{ "lang": "python", "repo": "xairy/Facedancer", "path": "/facedancer/backends/MAXUSBApp.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def disconnect(self): self.write_register(self.reg_usb_control, self.usb_control_vbgate) if self.verbose > 0: print(self.app_name, "disconnected device", self.connected_device.name) self.connected_device = None def clear_irq_bit(self, reg, bit): self....
code_fim
hard
{ "lang": "python", "repo": "xairy/Facedancer", "path": "/facedancer/backends/MAXUSBApp.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> signed_angle_degs = Util.Utils().get_signed_angle_between_degs( relative_hinge_reference_axis, this_bone_inner_to_outer_uv, relative_hinge_rotation_axis) ...
code_fim
hard
{ "lang": "python", "repo": "Atiehmerikh/FABRIK_chain_3D", "path": "/fabrik_chain_3d/FABRIK.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Atiehmerikh/FABRIK_chain_3D path: /fabrik_chain_3d/FABRIK.py e == "GLOBAL_HINGE": # Project this bone outer-to-inner direction onto the hinge rotation axis this_bone_outer_to_inner_uv = Util.Utils().project_on_to_plane(this_bone_outer_to_inner_uv, ...
code_fim
hard
{ "lang": "python", "repo": "Atiehmerikh/FABRIK_chain_3D", "path": "/fabrik_chain_3d/FABRIK.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> scale = [i * this_bone_length for i in this_bone_inner_to_outer_uv] start_location = this_bone.get_start_point_position() new_end_location = [x + y for x, y in zip(start_location, scale)] this_bone.set_end_point_position(new_end_location) ...
code_fim
hard
{ "lang": "python", "repo": "Atiehmerikh/FABRIK_chain_3D", "path": "/fabrik_chain_3d/FABRIK.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> X = X.reshape(64,64,3) result = loaded_model.predict(X) confusion_matrix[np.argmax(y), np.argmax(result[0])] += 1 print('Confusion Matrix'+confusion_matrix) # Results Visualization for i, (X, y)in enumerate(zip(X_test, y_test)): plt.imshow(X) plt.show() print('prediction: ', ...
code_fim
hard
{ "lang": "python", "repo": "LilyHeAsamiko/TUT-Advanced-Signal-Processing-Lab", "path": "/4/image_recognition.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>model.add(Conv2D(64, (w, h), activation = 'relu', padding = 'same')) model.add(BatchNormalization()) model.add(MaxPooling2D(pool_size=(2, 2))) model.add(Dropout(0.5)) model.add(Conv2D(128, (w, h), activation = 'relu', padding = 'same')) model.add(BatchNormaliza...
code_fim
hard
{ "lang": "python", "repo": "LilyHeAsamiko/TUT-Advanced-Signal-Processing-Lab", "path": "/4/image_recognition.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: LilyHeAsamiko/TUT-Advanced-Signal-Processing-Lab path: /4/image_recognition.py # -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from __future__ import print_function import keras from keras.application.vgg16 import VGG16 from keras.models import Sequential , Model...
code_fim
hard
{ "lang": "python", "repo": "LilyHeAsamiko/TUT-Advanced-Signal-Processing-Lab", "path": "/4/image_recognition.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_detect_short_sliders_time(self): short_sliders = StdMapPatterns.detect_short_sliders_time(self.map_data, min_time=100) def test_reinterpret_short_sliders(self): map_data = StdMapPatterns.reinterpret_short_sliders(self.map_data, min_time=100, cs_px=4)<|fim_prefix|># repo:...
code_fim
hard
{ "lang": "python", "repo": "abraker95/ultimate_osu_analyzer", "path": "/unit_tests/test_std_map_patterns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_reinterpret_short_sliders(self): map_data = StdMapPatterns.reinterpret_short_sliders(self.map_data, min_time=100, cs_px=4)<|fim_prefix|># repo: abraker95/ultimate_osu_analyzer path: /unit_tests/test_std_map_patterns.py import unittest from osu.local.beatmap.beatmapIO import BeatmapI...
code_fim
hard
{ "lang": "python", "repo": "abraker95/ultimate_osu_analyzer", "path": "/unit_tests/test_std_map_patterns.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: abraker95/ultimate_osu_analyzer path: /unit_tests/test_std_map_patterns.py import unittest from osu.local.beatmap.beatmapIO import BeatmapIO from analysis.osu.std.map_data import StdMapData from analysis.osu.std.map_patterns import StdMapPatterns class TestStdMapPatterns(unittest.TestCase): ...
code_fim
hard
{ "lang": "python", "repo": "abraker95/ultimate_osu_analyzer", "path": "/unit_tests/test_std_map_patterns.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tx = np.genfromtxt(file_x, delimiter = ' ', skip_header = 1) test = np.genfromtxt(file_t, delimiter = ' ', skip_header = 1) ty = tx[:, 0] tx = tx[:, 2:] test = test[:, 2:] #randomly shuffle tx: np.random.shuffle(tx) #Split train and test ind = int(tx.shape[0...
code_fim
hard
{ "lang": "python", "repo": "amirbawab/image_recognition", "path": "/tools/python/cnn_keras2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: amirbawab/image_recognition path: /tools/python/cnn_keras2.py import keras import numpy as np from sklearn.preprocessing import OneHotEncoder from keras.models import Sequential from keras.layers import Dense, Activation, Conv2D, MaxPooling2D, Flatten, Dropout, BatchNormalization from keras.optim...
code_fim
hard
{ "lang": "python", "repo": "amirbawab/image_recognition", "path": "/tools/python/cnn_keras2.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Create a mapping between indice in one hot encoded labels to actual label labels = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 20, 21, 24, 25, 27, 28, 30, 32, 35, 36, 40, 42, 45, 48, 49, 54, 56, 63, 64, 72, 81] ind = [i for i in range(40)] mapping = dict() fo...
code_fim
hard
{ "lang": "python", "repo": "amirbawab/image_recognition", "path": "/tools/python/cnn_keras2.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>def feature_normalize(dataset): ''' TODO: Documentation ''' mu = np.mean(dataset, axis=0) sigma = np.std(dataset, axis=0) return (dataset - mu)/sigma def plot_axis(ax, x, y, title): ''' TODO: Documentation ''' ax.plot(x, y) ax.set_title(title) ax.xaxis.set...
code_fim
hard
{ "lang": "python", "repo": "vixadd/cnn_lab", "path": "/utils.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: vixadd/cnn_lab path: /utils.py # Utility functions meant to aid our convolutional neural network. from scipy import stats import pandas as pb import numpy as np import matplotlib.pyplot as plt import tensorflow as tf <|fim_suffix|> ''' TODO: Documentation ...
code_fim
hard
{ "lang": "python", "repo": "vixadd/cnn_lab", "path": "/utils.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Fruitkwan/fastapi-template path: /application/main/infrastructure/database/mongodb/operations.py from abc import ABC from typing import Dict import motor.motor_asyncio from application.main.config import settings from application.main.infrastructure.database.db_interface import DataBaseOperatio...
code_fim
hard
{ "lang": "python", "repo": "Fruitkwan/fastapi-template", "path": "/application/main/infrastructure/database/mongodb/operations.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def update_multiple_db_record(self, record: Dict): connection_uri = 'mongodb://' + \ str(self.db_config.test.host) + str(self.db_config.test.port) client = motor.motor_asyncio.AsyncIOMotorClient(connection_uri) async def fetch_multiple_db_record(self, unique_id: ...
code_fim
hard
{ "lang": "python", "repo": "Fruitkwan/fastapi-template", "path": "/application/main/infrastructure/database/mongodb/operations.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kymatio/kymatio path: /kymatio/scattering2d/backend/torch_skcuda_backend.py from collections import namedtuple import torch import cupy from string import Template from ...backend.torch_skcuda_backend import TorchSkcudaBackend from .torch_backend import TorchBackend2D # As of v8, cupy.util ha...
code_fim
hard
{ "lang": "python", "repo": "kymatio/kymatio", "path": "/kymatio/scattering2d/backend/torch_skcuda_backend.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> out = out.reshape(batch_shape + out.shape[-3:]) return out class Modulus(object): """This class implements a modulus transform for complex numbers. Usage ----- modulus = Modulus() x_mod = modulus(x) Parameters --------- x : ten...
code_fim
hard
{ "lang": "python", "repo": "kymatio/kymatio", "path": "/kymatio/scattering2d/backend/torch_skcuda_backend.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: izzatum/BoMb-OT path: /DeepGM/experiments.py import torch from torchvision.utils import save_image def reconstruct(filename,input,encoder,decoder,image_size,num_chanel,device): with torch.no_grad(): x_sample = input.to(device) x_reconstruct_mean = decoder(encoder(x_sample)) ...
code_fim
medium
{ "lang": "python", "repo": "izzatum/BoMb-OT", "path": "/DeepGM/experiments.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> save_image(sample.view(num_sample, num_chanel, image_size, image_size), filename,scale_each=True,normalize=True) def sampling_eps(filename,fixednoise,decoder,num_sample,image_size,num_chanel): with torch.no_grad(): sample = decoder(fixednoise) save_image(sample.view(num_samp...
code_fim
medium
{ "lang": "python", "repo": "izzatum/BoMb-OT", "path": "/DeepGM/experiments.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Get an S3 resource reference s3_resource = boto3.resource('s3') # Download/Restore from tsbak if len(tsbaks)>0: # Get the local and remote paths local_backup_path = os.path.join(backup_full_path(tsm=tsm), "backup.tsbak") s3_backu...
code_fim
hard
{ "lang": "python", "repo": "aws-quickstart/quickstart-tableau-server", "path": "/scripts/backup-restore-s3.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aws-quickstart/quickstart-tableau-server path: /scripts/backup-restore-s3.py from ast import arg import boto3 from botocore.exceptions import ClientError import argparse, os, glob, logging, json, sys from subprocess import check_output from datetime import datetime ######################### # ...
code_fim
hard
{ "lang": "python", "repo": "aws-quickstart/quickstart-tableau-server", "path": "/scripts/backup-restore-s3.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: theonaunheim/tutorials path: /python_sessions/202_intro_for_devs_part_2/_07_file_io.py r''' __ _ _ _ / _(_) | ___ (_) ___ | |_| | |/ _ \ | |/ _ \ | _| | | __/ | | (_) | |_| |_|_|\___| |_|\___/ ''' ##================================================...
code_fim
hard
{ "lang": "python", "repo": "theonaunheim/tutorials", "path": "/python_sessions/202_intro_for_devs_part_2/_07_file_io.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Side note, you can nest if absolutely necessary. # Open StringIO with file_like_object_txt as f1: # Open BytesIO with file_like_object_bin as f2: # Read StringIO print(f1.read()) # Write binary data, seek to zero, read data, and print. f2.write(bytearray([1, 1, 2,...
code_fim
hard
{ "lang": "python", "repo": "theonaunheim/tutorials", "path": "/python_sessions/202_intro_for_devs_part_2/_07_file_io.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: graphql-python/graphql-ws path: /examples/django_channels2/django_channels2/settings.py """ Django settings for django_channels2 project. """ SECRET_KEY = "0%1c709jhmggqhk&=tci06iy+%jedfxpcoai69jd8wjzm+k2f0" DEBUG = True INSTALLED_APPS = ["channels", "graphql_ws.django", "graphene_django"] TEM...
code_fim
medium
{ "lang": "python", "repo": "graphql-python/graphql-ws", "path": "/examples/django_channels2/django_channels2/settings.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> CHANNEL_LAYERS = {"default": {"BACKEND": "channels.layers.InMemoryChannelLayer"}} GRAPHENE = {"MIDDLEWARE": [], "SCHEMA": "django_channels2.schema.schema"}<|fim_prefix|># repo: graphql-python/graphql-ws path: /examples/django_channels2/django_channels2/settings.py """ Django settings for django_channels...
code_fim
hard
{ "lang": "python", "repo": "graphql-python/graphql-ws", "path": "/examples/django_channels2/django_channels2/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>MIDDLEWARE = [ 'django.middleware.common.CommonMiddleware', ] ROOT_URLCONF = "django_channels2.urls" ASGI_APPLICATION = "graphql_ws.django.routing.application" CHANNEL_LAYERS = {"default": {"BACKEND": "channels.layers.InMemoryChannelLayer"}} GRAPHENE = {"MIDDLEWARE": [], "SCHEMA": "django_channels2...
code_fim
hard
{ "lang": "python", "repo": "graphql-python/graphql-ws", "path": "/examples/django_channels2/django_channels2/settings.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>a=json.dumps(read_csv(path)) # print a f= open("tripti.json","w") f.write(a) f.close()<|fim_prefix|># repo: mallatripti/Visualization path: /data_filter/data.py #!/usr/bin/env python import json import os import csv import random import string currentdirpath = os.getcwd() filename = 'choices.csv' fil...
code_fim
hard
{ "lang": "python", "repo": "mallatripti/Visualization", "path": "/data_filter/data.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: mallatripti/Visualization path: /data_filter/data.py #!/usr/bin/env python import json import os import csv import random import string currentdirpath = os.getcwd() filename = 'choices.csv' file_path = os.path.join(os.getcwd(), filename) def get_file_path(filename): currentdirpath = os.getcwd...
code_fim
hard
{ "lang": "python", "repo": "mallatripti/Visualization", "path": "/data_filter/data.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: egdeliya/hangman path: /tests/test_hangman.py import sys from hangman import hangman class MyInput: def __init__(self, input_values): self.__input_values = input_values def readline(self): return self.__input_values.pop(0) def test_hangman(capsys): sys.stdin = MyI...
code_fim
hard
{ "lang": "python", "repo": "egdeliya/hangman", "path": "/tests/test_hangman.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> expected = "".join(["Guess a letter:\n", "Missed, mistake 1 out of 5\n", "The word: *****\n", "Guess a letter:\n", "Missed, mistake 2 out of 5\n", "The word: ...
code_fim
hard
{ "lang": "python", "repo": "egdeliya/hangman", "path": "/tests/test_hangman.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert "You won!" in out expected = "".join(["Guess a letter:\n", "Missed, mistake 1 out of 5\n", "The word: *****\n", "Guess a letter:\n", "Missed, mistake 2 out of 5\n", ...
code_fim
hard
{ "lang": "python", "repo": "egdeliya/hangman", "path": "/tests/test_hangman.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Examples:: >>> rnn = nn.SubLSTMCell(10, 20) >>> input = Variable(torch.randn(6, 3, 10)) >>> hx = Variable(torch.randn(3, 20)) >>> cx = Variable(torch.randn(3, 20)) >>> output = [] >>> for i in range(6): ... hx, cx = rnn(input[i], (hx, cx)) ... output.append(hx) """...
code_fim
hard
{ "lang": "python", "repo": "Junaid199f/Testing", "path": "/subLSTM-master/pytorch-sublstm-master/pytorch-sublstm-master/subLSTM/nn/cell.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Junaid199f/Testing path: /subLSTM-master/pytorch-sublstm-master/pytorch-sublstm-master/subLSTM/nn/cell.py #!/usr/bin/env python3 import torch.nn as nn import torch as T import torch.nn.functional as F from torch.nn.modules.rnn import RNNCellBase from subLSTM.functional import SubLSTMCell as Sub...
code_fim
hard
{ "lang": "python", "repo": "Junaid199f/Testing", "path": "/subLSTM-master/pytorch-sublstm-master/pytorch-sublstm-master/subLSTM/nn/cell.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> super(SubLSTMCell, self).__init__() self.input_size = input_size self.hidden_size = hidden_size self.bias = bias self.weight_ih = nn.Parameter(T.Tensor(4 * hidden_size, input_size)) self.weight_hh = nn.Parameter(T.Tensor(4 * hidden_size, hidden_size)) if bias: self.bias_i...
code_fim
hard
{ "lang": "python", "repo": "Junaid199f/Testing", "path": "/subLSTM-master/pytorch-sublstm-master/pytorch-sublstm-master/subLSTM/nn/cell.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>@responses.activate def test_get_all_emoticons(): response = {"emoticons": [example_emote]} responses.add( responses.GET, "{}chat/emoticons".format(BASE_URL), body=json.dumps(response), status=200, content_type="application/json", ) client = TwitchC...
code_fim
hard
{ "lang": "python", "repo": "tsifrer/python-twitch-client", "path": "/tests/api/test_chat.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: tsifrer/python-twitch-client path: /tests/api/test_chat.py import json import responses from twitch.client import TwitchClient from twitch.constants import BASE_URL example_emote = {"code": "TwitchLit", "id": 115390} @responses.activate def test_get_badges_by_channel(): channel_id = 7236...
code_fim
hard
{ "lang": "python", "repo": "tsifrer/python-twitch-client", "path": "/tests/api/test_chat.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: romanalexander/opendota path: /dotastats/exceptions.py class SteamAPIError(Exception): <|fim_suffix|> self.errormessage = value<|fim_middle|> """ Error raised when the Steam API has issues. """ def __init__(self, value):
code_fim
medium
{ "lang": "python", "repo": "romanalexander/opendota", "path": "/dotastats/exceptions.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.errormessage = value<|fim_prefix|># repo: romanalexander/opendota path: /dotastats/exceptions.py class SteamAPIError(Exception): <|fim_middle|> """ Error raised when the Steam API has issues. """ def __init__(self, value):
code_fim
medium
{ "lang": "python", "repo": "romanalexander/opendota", "path": "/dotastats/exceptions.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stack_4_widgets = [] stack_4_widgets.append(get_tooltip('cluster-type')) stack_4_widgets.append(choose_option("process.executor", paths['nf'])) stack_4_widgets.append(filler) stack_4_widgets.append(get_tooltip('cluster-arguments')) stack_4_widgets.append(cluster_arguments("process....
code_fim
hard
{ "lang": "python", "repo": "statisticalbiotechnology/quandenser-pipeline", "path": "/dependencies/ui/tab2/init_tab2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stack_3_widgets = [] stack_3_widgets.append(get_tooltip('cluster-type')) stack_3_widgets.append(choose_option("process.executor", paths['nf'])) stack_3_widgets.append(filler) stack_3_widgets.append(get_tooltip('cluster-arguments')) stack_3_widgets.append(cluster_arguments("process....
code_fim
hard
{ "lang": "python", "repo": "statisticalbiotechnology/quandenser-pipeline", "path": "/dependencies/ui/tab2/init_tab2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: statisticalbiotechnology/quandenser-pipeline path: /dependencies/ui/tab2/init_tab2.py from PySide2 import QtCore from PySide2.QtWidgets import QWidget, QHBoxLayout, QVBoxLayout, QFormLayout, QLabel, QGridLayout, QSizePolicy from PySide2.QtWidgets import QStackedLayout from tab2.workflow import w...
code_fim
hard
{ "lang": "python", "repo": "statisticalbiotechnology/quandenser-pipeline", "path": "/dependencies/ui/tab2/init_tab2.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> # setup origin_text = 'Hola mundo' expected_text = 'Hola ...' # exercise target = get_short_text(origin_text, 8) # verify self.assertEquals(expected_text, target) def test_long_text_retuns_the_shorter_text_if_has_to_cut_words(self): # ...
code_fim
hard
{ "lang": "python", "repo": "gsorianob/excelutils", "path": "/tests_string_utils.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: gsorianob/excelutils path: /tests_string_utils.py # -*- coding: utf-8 -*- from django.test import TestCase from excelutils.string_utils import agregar_espacios_luego_de_cada_coma_y_cada_punto, get_short_text class StringUtilsTest(TestCase): def test_agregar_espacios_en_blanco_a_string_con_c...
code_fim
hard
{ "lang": "python", "repo": "gsorianob/excelutils", "path": "/tests_string_utils.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>if __name__ == "__main__": rect = RectangularArea(10, 12) print(rect.square()) print(rect.perimeter()) dot1 = Dot(20,20) print(dot1.dist_from_zero_version1()) print(dot1.dist_from_zero_version2()) print(dot1.between_two_dots(34.4, 45)) print(dot1.three_dimensional(12))<|fim...
code_fim
hard
{ "lang": "python", "repo": "JuveVR/Homework_5", "path": "/Exercise_2.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }