text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|># Area to define Main def main(): print("Hello fellow user! Please provide your input when prompted.\n\n\tSPECIAL NOTE!\n\nWhen done providing input, please type, \"QUIT\" to end capture of input.") # Special thanks to Thomas Streets Module 4 in developing my thoughts and decreasing my written code ...
code_fim
hard
{ "lang": "python", "repo": "rfiorenzano/ITS320_CSU_FiorenzanoRogelio", "path": "/ITS320_CTA5.Option1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|># Area to define String Reversal def str_reversal(): # Special thanks to our LinkedIn video with kittens and reminding us to "return variable" for later use usr_strings.reverse() return usr_strings str_reversal() # Area to define Main def main(): print("Hello fellow user! Please provide your inp...
code_fim
hard
{ "lang": "python", "repo": "rfiorenzano/ITS320_CSU_FiorenzanoRogelio", "path": "/ITS320_CTA5.Option1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: rfiorenzano/ITS320_CSU_FiorenzanoRogelio path: /ITS320_CTA5.Option1.py # python3 (3.6) # Coded on iPad Pro 2020 4th Generation # Pythonista an Apple iPad App # MIT License Copyright (c) 2020 Rogelio Fiorenzano # # ITS320: Basic Programming # Colorado State University Global # Dr. Joseph Turano <...
code_fim
medium
{ "lang": "python", "repo": "rfiorenzano/ITS320_CSU_FiorenzanoRogelio", "path": "/ITS320_CTA5.Option1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MarcusMendes81/Python path: /Ex067 - Tabuada 3.0.py print('-'*10, 'Tabuada 3.0', '-'*10) while True: num = int(input('Digite qua<|fim_suffix|> break for cont in range(1, 11): mult = num * cont print(f'{cont} x {num} = {mult}') print('Programa de Tabuada encerrad...
code_fim
medium
{ "lang": "python", "repo": "MarcusMendes81/Python", "path": "/Ex067 - Tabuada 3.0.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>nt(f'{cont} x {num} = {mult}') print('Programa de Tabuada encerrada com sucesso!')<|fim_prefix|># repo: MarcusMendes81/Python path: /Ex067 - Tabuada 3.0.py print('-'*10, 'Tabuada 3.0', '-'*10) while True: num = int(input('Digite qua<|fim_middle|>l o valor da tabuada que voce deseja: ')) print...
code_fim
medium
{ "lang": "python", "repo": "MarcusMendes81/Python", "path": "/Ex067 - Tabuada 3.0.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: demartinofra/aws-parallelcluster path: /cli/tests/pcluster/createami/test_pcluster_createami.py """This module provides unit tests for (portions of) the `pcluster createami` code.""" import os import pytest from assertpy import assert_that from recordclass import recordclass import pcluster.cr...
code_fim
hard
{ "lang": "python", "repo": "demartinofra/aws-parallelcluster", "path": "/cli/tests/pcluster/createami/test_pcluster_createami.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mocker, base_ami_id, instance_type, base_ami_os, base_ami_architecture, supported_instance_archs, supported_os ): """Verify that parameter validation works as expected in the function that implements the createami command.""" base_ami_name = "ami-x" mocker.patch("pcluster.createami.utils.g...
code_fim
hard
{ "lang": "python", "repo": "demartinofra/aws-parallelcluster", "path": "/cli/tests/pcluster/createami/test_pcluster_createami.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> createami.utils.get_info_for_amis.assert_called_with([base_ami_id]) if instance_type is None: createami._get_default_createami_instance_type.assert_called_with(base_ami_architecture) else: createami.utils.get_supported_architectures_for_instance_type.assert_called_with(instanc...
code_fim
hard
{ "lang": "python", "repo": "demartinofra/aws-parallelcluster", "path": "/cli/tests/pcluster/createami/test_pcluster_createami.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: ismarou/pyBulletIntro path: /turtleKeyboardMove.py import pybullet as p import time # open the GUI p.connect(p.GUI) # load files and place them at the offsets turtle = p.loadURDF("urdf/most_simple_turtle.urdf",[0,0,0]) plane = p.loadURDF("urdf/plane_box.urdf") box1 = p.loadURDF("urdf/box.urdf"...
code_fim
medium
{ "lang": "python", "repo": "ismarou/pyBulletIntro", "path": "/turtleKeyboardMove.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> rightWheelVelocity+= (forward+turn)*speed leftWheelVelocity += (forward-turn)*speed p.setJointMotorControl2(turtle,0,p.VELOCITY_CONTROL,targetVelocity=leftWheelVelocity,force=1000) p.setJointMotorControl2(turtle,1,p.VELOCITY_CONTROL,targetVelocity=rightWheelVelocity,force=1000)<|fim_prefix|># repo: ...
code_fim
hard
{ "lang": "python", "repo": "ismarou/pyBulletIntro", "path": "/turtleKeyboardMove.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: takabayashi/lit path: /test/test_basic.py #!/usr/bin/env python3 # Copyright (c) 2017 The lit developers # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. """Test basic lit functionality - start coin node - st...
code_fim
hard
{ "lang": "python", "repo": "takabayashi/lit", "path": "/test/test_basic.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> litnode0_channel = self.litnodes[0].ChannelList()['result']['Channels'][0] litnode1_channel = self.litnodes[1].ChannelList()['result']['Channels'][0] assert_equal(litnode0_channel['MyBalance'], 950000000) assert_equal(litnode1_channel['MyBalance'], 50000000) self.l...
code_fim
hard
{ "lang": "python", "repo": "takabayashi/lit", "path": "/test/test_basic.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: KamalDGRT/ProgrammingPractice path: /LeetCode/Merge_Interval/solution.py # intervals = [[1,6],[2,3],[8,10],[15,18]] # start = 1 # end = 3 # next_start = 2 # next_end = 6 # if next_start less than or equal to end, # then, # new_end = max(end, next_end) # merged_list = [start...
code_fim
hard
{ "lang": "python", "repo": "KamalDGRT/ProgrammingPractice", "path": "/LeetCode/Merge_Interval/solution.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> current_start = intervals[pair][0] current_end = intervals[pair][1] print("index = ", pair) print("current_start = ", current_start) print("current_end = ", current_end) next_pair = intervals[pair + 1] next_start = next_pair[0] next_end = next_pair[1] print(next_pair, ...
code_fim
medium
{ "lang": "python", "repo": "KamalDGRT/ProgrammingPractice", "path": "/LeetCode/Merge_Interval/solution.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # The HEATER is the Receiver HEATER = Heater() # Create Commands SLIDER_MAX = SliderMaxCommand(HEATER) SLIDER_PERCENT = SliderPercentCommand(HEATER) SLIDER_OFF = SliderOffCommand(HEATER) # Register the commands with the invoker (Switch) SLIDER = Slider() SLIDER.regist...
code_fim
hard
{ "lang": "python", "repo": "lentiummmx/Design-Patterns-In-Python", "path": "/command/slider_command.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lentiummmx/Design-Patterns-In-Python path: /command/slider_command.py """The Command Design Pattern in Python The command pattern is a behavioural design pattern, in which an abstraction exists between an object that invokes a command, and the object that performs it. This is part 2 of the Comma...
code_fim
hard
{ "lang": "python", "repo": "lentiummmx/Design-Patterns-In-Python", "path": "/command/slider_command.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def close(self): if self.handle: xrt.xclClose(self.handle) self.handle = None def get_memory(self, desc): if desc["streaming"]: if desc["idx"] not in self._streams: self._streams[desc["idx"]] = XrtStream(self, desc) retur...
code_fim
hard
{ "lang": "python", "repo": "schelleg/PYNQ", "path": "/pynq/pl_server/xrt_device.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: schelleg/PYNQ path: /pynq/pl_server/xrt_device.py f.base_address = desc["base_address"] self.desc = desc self.device = device def allocate(self, shape, dtype, **kwargs): """Create a new buffer in the memory bank Parameters ---------- shape : ...
code_fim
hard
{ "lang": "python", "repo": "schelleg/PYNQ", "path": "/pynq/pl_server/xrt_device.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: schelleg/PYNQ path: /pynq/pl_server/xrt_device.py ar = PynqBuffer( shape, dtype, bo=bo, device=device, buffer=buf, device_address=device_address, coherent=False, ) if pointer is not None: weakref.finalize(buf, _free_bo, ...
code_fim
hard
{ "lang": "python", "repo": "schelleg/PYNQ", "path": "/pynq/pl_server/xrt_device.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: BlueJayADAL/SCARP2020-ML path: /old/matt/models/ANN.py import tensorflow as tf from sklearn import preprocessing from sklearn.model_selection import train_test_split from old.matt.utils.helper import get_training_data class ANN: def __init__(self, training_set, training_anno_file, test_se...
code_fim
hard
{ "lang": "python", "repo": "BlueJayADAL/SCARP2020-ML", "path": "/old/matt/models/ANN.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> return X_train_scaled, X_test_scaled, y_train, y_test def train_model(self): X_train, X_test, y_train, y_test = self.prep_training_data() # Create ANN classifier model = tf.keras.models.Sequential() model.add(tf.keras.layers.Flatten()) model.add(tf.ker...
code_fim
hard
{ "lang": "python", "repo": "BlueJayADAL/SCARP2020-ML", "path": "/old/matt/models/ANN.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.parseVitoria(bot, message) : self.nivelMaxLimit = self.nivelMaxLimit + 0.9 bot.stamina = bot.stamina - 1 #self.limitLvlRnkThreshold = 0.0 self.feedback = True def act(self, bot): print("Act Batalhaarena ...") if ...
code_fim
hard
{ "lang": "python", "repo": "fefurst/NotSoIdleTown", "path": "/states/batalhaarena.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: fefurst/NotSoIdleTown path: /states/batalhaarena.py from .state import State import re import constantes class Batalhaarena(State): """ Comportamento associado à tela Menu. """ __instance = None def __new__(cls): if Batalhaarena.__instance is None: Batal...
code_fim
hard
{ "lang": "python", "repo": "fefurst/NotSoIdleTown", "path": "/states/batalhaarena.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: icgood/pymap path: /test/server/test_store.py from .base import TestBase from pymap.imap import IMAPServer class TestStore(TestBase): async def test_store(self, imap_server: IMAPServer) -> None: transport = self.new_transport(imap_server) transport.push_login() tr...
code_fim
hard
{ "lang": "python", "repo": "icgood/pymap", "path": "/test/server/test_store.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async def test_store_remove_recent(self, imap_server: IMAPServer) -> None: transport = self.new_transport(imap_server) transport.push_login() transport.push_select(b'INBOX') transport.push_readline( b'store1 STORE * -FLAGS (\\Recent)\r\n') transport....
code_fim
hard
{ "lang": "python", "repo": "icgood/pymap", "path": "/test/server/test_store.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from . import error_handler # bind error handler with newly created flask application error_handler.init_app(app) from . import api # bind api with newly created flask application app.register_blueprint(api.bp) from . import engine # bind engine with newly created flask a...
code_fim
medium
{ "lang": "python", "repo": "randilfernando/bot", "path": "/bot/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> from . import engine # bind engine with newly created flask application engine.init_app(app) # initialize engine with app.app_context(): engine.init_bot() return app<|fim_prefix|># repo: randilfernando/bot path: /bot/__init__.py import os from builtins import KeyError, O...
code_fim
hard
{ "lang": "python", "repo": "randilfernando/bot", "path": "/bot/__init__.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: randilfernando/bot path: /bot/__init__.py import os from builtins import KeyError, OSError from flask import Flask def create_app(test_config=None): # create and configure the bot app = Flask(__name__, instance_relative_config=True) # ensure the instance folder exists try: ...
code_fim
hard
{ "lang": "python", "repo": "randilfernando/bot", "path": "/bot/__init__.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: mlbench/mlbench-benchmarks path: /pytorch/nlp/translation/wmt16-gnmt-all-reduce/main.py """Training GNMT for WMT16 Dataset This implements the Machine Translation task 4b see https://mlbench.readthedocs.io/en/latest/benchmark-tasks.html#a-lstm-wmt16-en-de for more details. Model and training ta...
code_fim
hard
{ "lang": "python", "repo": "mlbench/mlbench-benchmarks", "path": "/pytorch/nlp/translation/wmt16-gnmt-all-reduce/main.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fp_optimizer, optimizer, model = build_optimizer( model=model, math=math_mode, loss_scaling=loss_scaling, use_cuda=use_cuda, use_horovod=use_horovod, **optimizer_args ) # Create a learning rate scheduler for an optimizer scheduler = Exponent...
code_fim
hard
{ "lang": "python", "repo": "mlbench/mlbench-benchmarks", "path": "/pytorch/nlp/translation/wmt16-gnmt-all-reduce/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> metrics_values, loss = validation_round( val_loader, metrics, model, criterion, update_freq, translator, use_cuda=use_cuda, ) is_best = record_validation_sta...
code_fim
hard
{ "lang": "python", "repo": "mlbench/mlbench-benchmarks", "path": "/pytorch/nlp/translation/wmt16-gnmt-all-reduce/main.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: aroden-crowdstrike/eamcsv2json path: /eamcsv2json/eamcsv2dict.py """ Converts EAM CSV to python dictionaries """ import collections import csv import logging logger = logging.getLogger(__name__) class EamCsv2Dict(object): """ Handles converting from an input file to generator of dicti...
code_fim
hard
{ "lang": "python", "repo": "aroden-crowdstrike/eamcsv2json", "path": "/eamcsv2json/eamcsv2dict.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> def convert(self): self._running = True with self._file_reader as r: csv_reader = ( csv.reader( r, delimiter=',', doublequote=False, escapechar='\\', quotecha...
code_fim
hard
{ "lang": "python", "repo": "aroden-crowdstrike/eamcsv2json", "path": "/eamcsv2json/eamcsv2dict.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> add_liked_songs(track_object,x) likedSong.append(track_object) @staticmethod def prepare_image(filename, size): icon = Image.open('images/'+filename) icon = icon.resize((size, size), Image.ANTIALIAS) icon = ImageTk.PhotoImage(icon) return icon<|fim...
code_fim
hard
{ "lang": "python", "repo": "yportne8/TK-Player", "path": "/Pages/SearchPage/Components/LikeButton.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: yportne8/TK-Player path: /Pages/SearchPage/Components/LikeButton.py import tkinter as tk from PIL import Image, ImageTk class LikeButton(tk.Button): def __init__(self, master, *args, **kwargs): self.title = kwargs.pop('title') self.album = kwargs.pop('album') self.ur...
code_fim
hard
{ "lang": "python", "repo": "yportne8/TK-Player", "path": "/Pages/SearchPage/Components/LikeButton.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return # if liked self['image'] = self.filled_heart self.liked = False from Database.Database import add_liked_songs track_object = { 'title': self.title, 'genre': self.album, 'artist': self.artist, 'locati...
code_fim
hard
{ "lang": "python", "repo": "yportne8/TK-Player", "path": "/Pages/SearchPage/Components/LikeButton.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Make coordinates along each axis x = ox + np.cumsum(self.tensor_u) x = np.insert(x, 0, ox) y = oy + np.cumsum(self.tensor_v) y = np.insert(y, 0, oy) z = oz + np.cumsum(self.tensor_w) z = np.insert(z, 0, oz) # If axis orientations are stand...
code_fim
hard
{ "lang": "python", "repo": "banesullivan/omf", "path": "/omf/volume.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def toVTK(self): """Convert the 3D gridded volume to a ``vtkStructuredGrid`` (or a ``vtkRectilinearGrid`` when apprropriate) object contatining the 2D surface. """ import vtk from vtk.util import numpy_support as nps self._validate_mesh() ...
code_fim
hard
{ "lang": "python", "repo": "banesullivan/omf", "path": "/omf/volume.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: banesullivan/omf path: /omf/volume.py """volume.py: Volume element and geometry""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import numpy as np import properties from .base import ProjectE...
code_fim
hard
{ "lang": "python", "repo": "banesullivan/omf", "path": "/omf/volume.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: t-zhong/WaPIRL path: /models/head.py # -*- coding: utf-8 -*- import collections import torch import torch.nn as nn from models.base import HeadBase from layers.core import Flatten from utils.initialization import initialize_weights class LinearHead(HeadBase): def __init__(self, in_channe...
code_fim
hard
{ "lang": "python", "repo": "t-zhong/WaPIRL", "path": "/models/head.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def __init__(self, in_channels: int, num_features: int): """ Arguments: in_channels: int, number of input feature maps. num_features: int, number of output units. """ super(MLPHead, self).__init__(num_features) self.in_channels = in_chan...
code_fim
hard
{ "lang": "python", "repo": "t-zhong/WaPIRL", "path": "/models/head.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>class LinearClassifier(LinearHead): def __init__(self, in_channels: int, num_classes: int, dropout: float = 0.): """ Arguments: in_channels: int, number of input feature maps. num_classes: int, number of classes. """ super(LinearClassifier, self)...
code_fim
hard
{ "lang": "python", "repo": "t-zhong/WaPIRL", "path": "/models/head.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Pr0Ger/SGSB path: /plugins/Zombie_Driver.py import os from lib.base_plugin import BasePlugin class ZombieDriverPlugin(BasePlugin): Name = "Zombie Driver" support_os = ["Windows"] <|fim_suffix|> if os.path.isdir(os.path.join(os.environ['APPDATA'], 'ZombieDriver')): re...
code_fim
hard
{ "lang": "python", "repo": "Pr0Ger/SGSB", "path": "/plugins/Zombie_Driver.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _.restore_files('Saves', os.path.join(os.environ['APPDATA'], 'ZombieDriver'), [ 'controller.cfg', 'Ogre17.cfg', 'ZombieDriver.cfg', ]) _.restore_folder('Saves', os.path.join(os.environ['APPDATA'], 'ZombieDriver'), 'Save') def detect(self): ...
code_fim
hard
{ "lang": "python", "repo": "Pr0Ger/SGSB", "path": "/plugins/Zombie_Driver.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def pycallback(): return True if __name__ == "__main__": b = BetterChrome('C:/selenium/chromedriver.exe') b.get('http://www.google.com') #b.set_script_timeout(5) # apparently loading jquery requires a page # load timeout AND async script execution ...
code_fim
hard
{ "lang": "python", "repo": "lochnessduck/Browser_Automatron", "path": "/python/BetterChrome.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: lochnessduck/Browser_Automatron path: /python/BetterChrome.py from __future__ import print_function from selenium.webdriver import Chrome from js import js # from module js (js.py) import class js. class BetterChrome(Chrome): <|fim_suffix|>if __name__ == "__main__": b = BetterChrome('C:/se...
code_fim
hard
{ "lang": "python", "repo": "lochnessduck/Browser_Automatron", "path": "/python/BetterChrome.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>x1 = Variable('x1', lb=0) x2 = Variable('x2', lb=0) x3 = Variable('x3', lb=0) c1 = Constraint(x1 + x2 + x3, ub=100) c2 = Constraint(10 * x1 + 4 * x2 + 5 * x3, ub=600) c3 = Constraint(2 * x1 + 2 * x2 + 6 * x3, ub=300) obj = Objective(10 * x1 + 6 * x2 + 4 * x3, direction='max') model = Model(name='Simple mo...
code_fim
medium
{ "lang": "python", "repo": "opencobra/optlang", "path": "/examples/simple.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: opencobra/optlang path: /examples/simple.py # Copyright 2013 Novo Nordisk Foundation Center for Biosustainability, # Technical University of Denmark. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may ob...
code_fim
medium
{ "lang": "python", "repo": "opencobra/optlang", "path": "/examples/simple.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Ujinjinjin/lars path: /tests/test_lars.py from pytest import raises from lars.main import LarsTest def test_lars(): # test lars without any subcommands or arguments with LarsTest() as app: app.run() assert app.exit_code == 0 <|fim_suffix|> # test apps list with argum...
code_fim
hard
{ "lang": "python", "repo": "Ujinjinjin/lars", "path": "/tests/test_lars.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # test apps list with arguments argv = ['apps', 'list', '-e'] with LarsTest(argv=argv) as cli: cli.run() data, output = cli.last_rendered assert cli.pargs.extended is True assert data is not None, data assert len(data['items']) == 1 app = data['i...
code_fim
hard
{ "lang": "python", "repo": "Ujinjinjin/lars", "path": "/tests/test_lars.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: stscicrawford/test_jwst_rtd path: /jwst/tests_nightly/general/nirspec/test_detector1.py import pytest from astropy.io import fits from jwst.pipeline.calwebb_detector1 import Detector1Pipeline pytestmark = [ pytest.mark.usefixtures('_jail'), pytest.mark.skipif(not pytest.config.getoption(...
code_fim
hard
{ "lang": "python", "repo": "stscicrawford/test_jwst_rtd", "path": "/jwst/tests_nightly/general/nirspec/test_detector1.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Compare countrate image product n_cr = 'jw84600007001_02101_00001_nrs1_rate.fits' h = fits.open( n_cr ) n_ref = _bigdata+'/pipelines/jw84600007001_02101_00001_nrs1_rate_ref.fits' href = fits.open( n_ref ) newh = fits.HDUList([h['primary'],h['sci'],h['err'],h['dq']]) newhref =...
code_fim
hard
{ "lang": "python", "repo": "stscicrawford/test_jwst_rtd", "path": "/jwst/tests_nightly/general/nirspec/test_detector1.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: kartikprabhu/hfeed2atom path: /hfeed2atom/templates.py from string import Template from . import __about__ GENERATOR = Template("""<generator uri="${uri}" version="${version}">${name}</generator>""").substitute(uri = __about__.URL['self'], version = '.'.join(map(str, __about__.VERSION[0:3])) + '...
code_fim
hard
{ "lang": "python", "repo": "kartikprabhu/hfeed2atom", "path": "/hfeed2atom/templates.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ID = Template("""<id>${uid}</id>""") AUTHOR = Template("""<author><name>${name}</name></author>""") FEATURED = Template("""&lt;img src="${featured}"/&gt;""") POST_SUMMARY = Template("""&lt;p&gt;${post_summary}&lt;/p&gt;""") MORELINK = Template("""&lt;span&gt;Full post: &lt;a href="${url}"&gt;${name}&l...
code_fim
medium
{ "lang": "python", "repo": "kartikprabhu/hfeed2atom", "path": "/hfeed2atom/templates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>POST_SUMMARY = Template("""&lt;p&gt;${post_summary}&lt;/p&gt;""") MORELINK = Template("""&lt;span&gt;Full post: &lt;a href="${url}"&gt;${name}&lt;/a&gt;&lt;/span&gt;""") SUMMARY = Template("""<summary type="html">${featured}${summary}${morelink}</summary>""") CONTENT = Template("""<content type="html">...
code_fim
medium
{ "lang": "python", "repo": "kartikprabhu/hfeed2atom", "path": "/hfeed2atom/templates.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: AngelBrisco/SubPixelConvolution-in-Keras path: /TF 1 legacy model/Custom upsample layers.py import numpy as np from tensorflow.keras.layers import * from tensorflow.keras import backend as K import tensorflow as tf __all__ =["SubpixelLayer2D","conv_up","SubpixelLayer2D_log"] class SubpixelLayer...
code_fim
hard
{ "lang": "python", "repo": "AngelBrisco/SubPixelConvolution-in-Keras", "path": "/TF 1 legacy model/Custom upsample layers.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.kernel = self.add_weight(shape=(self.ksz,self.ksz,cin.value,self.out_channels), initializer=self.kinit, name='kernel') super(SubpixelLayer2D, self).build(input_shape) def call(self,input): y = K....
code_fim
hard
{ "lang": "python", "repo": "AngelBrisco/SubPixelConvolution-in-Keras", "path": "/TF 1 legacy model/Custom upsample layers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #Multiplica el kernel para evitar efecto tablero. Aunque no lo creas lo entendiste y=tf.initializers.variance_scaling()(shape=(h,w,cin,cout)) y=tf.tile(y,[1,1,1,self.prime_scale**2]) sp_weights=tf.Variable(y, dtype=dtype, ...
code_fim
hard
{ "lang": "python", "repo": "AngelBrisco/SubPixelConvolution-in-Keras", "path": "/TF 1 legacy model/Custom upsample layers.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert LifReader(resources_dir / filename).get_physical_pixel_size( scene ) == pytest.approx(expected, rel=0.001) # Check that there are no open file pointers assert str(f) not in [f.path for f in proc.open_files()] @pytest.mark.parametrize( "filename, s, t, c, z, y, x", ...
code_fim
hard
{ "lang": "python", "repo": "fabian19941220-gmail-com/aicsimageio", "path": "/aicsimageio/tests/readers/test_lif_reader.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: fabian19941220-gmail-com/aicsimageio path: /aicsimageio/tests/readers/test_lif_reader.py #!/usr/bin/env python # -*- coding: utf-8 -*- from io import BytesIO import numpy as np import pytest from psutil import Process from aicsimageio.readers.lif_reader import LifReader @pytest.mark.parametr...
code_fim
hard
{ "lang": "python", "repo": "fabian19941220-gmail-com/aicsimageio", "path": "/aicsimageio/tests/readers/test_lif_reader.py", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> # Get file f = resources_dir / filename # Check that there are no open file pointers proc = Process() assert str(f) not in [f.path for f in proc.open_files()] # Init reader img = LifReader(f) # Check that there are no open file pointers after init proc = Process() ...
code_fim
hard
{ "lang": "python", "repo": "fabian19941220-gmail-com/aicsimageio", "path": "/aicsimageio/tests/readers/test_lif_reader.py", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|># repo: lili2311/sentry path: /tests/sentry/integrations/gitlab/test_webhook.py from __future__ import absolute_import from sentry.testutils import APITestCase import pytest class WebhookTest(APITestCase): url = '/extensions/gitlab/webhook' @pytest.mark.incomplete def test_get(self): ...
code_fim
hard
{ "lang": "python", "repo": "lili2311/sentry", "path": "/tests/sentry/integrations/gitlab/test_webhook.py", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> @pytest.mark.incomplete def test_merge_event_create_commits(self): pass @pytest.mark.incomplete def test_merge_event_create_commits_more_than_20(self): pass @pytest.mark.incomplete def test_merge_event_link_author(self): pass<|fim_prefix|># repo: lili2311/...
code_fim
medium
{ "lang": "python", "repo": "lili2311/sentry", "path": "/tests/sentry/integrations/gitlab/test_webhook.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pass @pytest.mark.incomplete def test_push_event_suspect_commit(self): pass @pytest.mark.incomplete def test_merge_event_create_repo(self): pass @pytest.mark.incomplete def test_merge_event_create_commits(self): pass @pytest.mark.incomplete ...
code_fim
medium
{ "lang": "python", "repo": "lili2311/sentry", "path": "/tests/sentry/integrations/gitlab/test_webhook.py", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pos_outputs: torch.Tensor, neg_outputs: torch.Tensor, mask: torch.Tensor = None) -> torch.Tensor: r"""feed forward of pointwise logistic ranking loss by calculating :math:`\text{loss} = (1.0 - \sigma (y_{pos})) + \sigma (y_{neg})` ...
code_fim
medium
{ "lang": "python", "repo": "zwcdp/torecsys", "path": "/torecsys/losses/ltr/pointwise_ranking_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zwcdp/torecsys path: /torecsys/losses/ltr/pointwise_ranking_loss.py r"""torecsys.models.ltr.losses.pointwise_ranking_loss is a sub module of algorithms of pointwise ranking loss """ import torch from . import _RankingLoss from .functional import apply_mask, pointwise_logistic_ranking_loss cl...
code_fim
medium
{ "lang": "python", "repo": "zwcdp/torecsys", "path": "/torecsys/losses/ltr/pointwise_ranking_loss.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> class PointwiseLogisticLoss(_PointwiseRankingLoss): r"""pointwise logistic loss """ def __init__(self): super(PointwiseLogisticLoss, self).__init__() def forward(self, pos_outputs: torch.Tensor, neg_outputs: torch.Tensor, mask: tor...
code_fim
medium
{ "lang": "python", "repo": "zwcdp/torecsys", "path": "/torecsys/losses/ltr/pointwise_ranking_loss.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: MLStruckmann/tensorflow-templates path: /preprocessing/preprocessing-nlp.py import tensorflow as tf from tensorflow import keras vocab = ["<1H OCEAN", "INLAND", "NEAR OCEAN", "NEAR BAY", "ISLAND"] indices = tf.range(len(vocab), dtype=tf.int64) table_init = tf.lookup.KeyValueTensorInitialize...
code_fim
hard
{ "lang": "python", "repo": "MLStruckmann/tensorflow-templates", "path": "/preprocessing/preprocessing-nlp.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>regular_inputs = keras.layers.Input(shape=[8]) categories = keras.layers.Input(shape=[], dtype=tf.string) cat_indices = keras.layers.Lambda(lambda cats: table.lookup(cats))(categories) cat_embed = keras.layers.Embedding(input_dim=6, output_dim=2)(cat_indices) encoded_inputs = keras.layers.concatenate(...
code_fim
medium
{ "lang": "python", "repo": "MLStruckmann/tensorflow-templates", "path": "/preprocessing/preprocessing-nlp.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: Roberto-Sartore/Python path: /exercicios/PythonExercicios/ex051.py num = int(input('Primeiro termo:')) razao = int(input('Razão:')) decimo = num + (10 - 1) * razao <|fim_suffix|>print('{} '.format(c), end='-> ') print('Acabou')<|fim_middle|>for c in range(num, decimo + razao, razao):
code_fim
easy
{ "lang": "python", "repo": "Roberto-Sartore/Python", "path": "/exercicios/PythonExercicios/ex051.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>print('{} '.format(c), end='-> ') print('Acabou')<|fim_prefix|># repo: Roberto-Sartore/Python path: /exercicios/PythonExercicios/ex051.py num = int(input('Primeiro termo:')) razao = int(input('Razão:')) decimo = num + (10 - 1) * razao <|fim_middle|>for c in range(num, decimo + razao, razao):
code_fim
easy
{ "lang": "python", "repo": "Roberto-Sartore/Python", "path": "/exercicios/PythonExercicios/ex051.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def __enter__(self) -> 'Popen': ... def __exit__(self, type, value, traceback) -> bool: ... def getstatusoutput(cmd: str) -> Tuple[int, str]: ... def getoutput(cmd: str) -> str...
code_fim
hard
{ "lang": "python", "repo": "Vedenin/intellij-community", "path": "/python/helpers/typeshed/stdlib/2/subprocess.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: Vedenin/intellij-community path: /python/helpers/typeshed/stdlib/2/subprocess.pyi # Stubs for subprocess # Based on http://docs.python.org/2/library/subprocess.html and Python 3 stub from typing import Sequence, Any, AnyStr, Mapping, Callable, Tuple, IO, Union, Optional _FILE = Union[int, IO[A...
code_fim
hard
{ "lang": "python", "repo": "Vedenin/intellij-community", "path": "/python/helpers/typeshed/stdlib/2/subprocess.pyi", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> def wait(self) -> int: ... def communicate(self, input: Optional[AnyStr] = ...) -> Tuple[Optional[bytes], Optional[bytes]]: ... def send_signal(self, signal: int) -> None: ... def terminate(self) -> None: ... def kill(self) -> None: ... def __enter__(self) -> 'Popen': ... def _...
code_fim
hard
{ "lang": "python", "repo": "Vedenin/intellij-community", "path": "/python/helpers/typeshed/stdlib/2/subprocess.pyi", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: lanking520/djl-demo path: /aws/inferentia/trace.py import torch import os import torch_neuron from torchvision import models import logging # Enable logging so we can see any important warnings logger = logging.getLogger('Neuron') logger.setLevel(logging.INFO) # An example input you would norma...
code_fim
hard
{ "lang": "python", "repo": "lanking520/djl-demo", "path": "/aws/inferentia/trace.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Export to saved model os.makedirs("models/inferentia/resnet50", exist_ok=True) model_neuron.save("models/inferentia/resnet50/resnet50.pt") print("Compile success")<|fim_prefix|># repo: lanking520/djl-demo path: /aws/inferentia/trace.py import torch import os import torch_neuron from torchvision import ...
code_fim
hard
{ "lang": "python", "repo": "lanking520/djl-demo", "path": "/aws/inferentia/trace.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|># Save the Regular TorchScript model for benchmarking os.makedirs("models/djl/resnet50", exist_ok=True) djl_traced_model.save("models/djl/resnet50/resnet50.pt") # Analyze the model - this will show operator support and operator count torch.neuron.analyze_model(model, example_inputs=[image]) # Now compil...
code_fim
hard
{ "lang": "python", "repo": "lanking520/djl-demo", "path": "/aws/inferentia/trace.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: liuzhennn/Ryu_SDN_Controller path: /build/lib.linux-x86_64-2.7/ryu/app/DB2SDN/test.py import userDao def test(): # userDao.Dbutil().insert(1,'10.1.0.2','10.3.0.1','g-g-g-g') <|fim_suffix|>0.3.0.1') print(result) test() print 1*None<|fim_middle|> result=userDao.Dbutil().select('10.1...
code_fim
easy
{ "lang": "python", "repo": "liuzhennn/Ryu_SDN_Controller", "path": "/build/lib.linux-x86_64-2.7/ryu/app/DB2SDN/test.py", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> result=userDao.Dbutil().select('10.1.0.1','10.3.0.1') print(result) test() print 1*None<|fim_prefix|># repo: liuzhennn/Ryu_SDN_Controller path: /build/lib.linux-x86_64-2.7/ryu/app/DB2SDN/test.py import userDao def test(): # userDao.Dbu<|fim_middle|>til().insert(1,'10.1.0.2','10.3.0.1','g-...
code_fim
easy
{ "lang": "python", "repo": "liuzhennn/Ryu_SDN_Controller", "path": "/build/lib.linux-x86_64-2.7/ryu/app/DB2SDN/test.py", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|># repo: jtraver/dev path: /python3/matplotlib/plot1.py #!/usr/bin/env python3 #!/usr/bin/python <|fim_suffix|>import numpy import matplotlib.pyplot as plt from numpy.random import rand a = rand(100) b = rand(100) plt.scatter(a, b) plt.show()<|fim_middle|># https://en.wikipedia.org/wiki/Matplotlib
code_fim
easy
{ "lang": "python", "repo": "jtraver/dev", "path": "/python3/matplotlib/plot1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: jtraver/dev path: /python3/matplotlib/plot1.py #!/usr/bin/env python3 #!/usr/bin/python # https://en.wikipedia.org/wiki/Matplotlib import numpy import matplotlib.pyplot as plt <|fim_suffix|>a = rand(100) b = rand(100) plt.scatter(a, b) plt.show()<|fim_middle|>from numpy.random import rand
code_fim
easy
{ "lang": "python", "repo": "jtraver/dev", "path": "/python3/matplotlib/plot1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>from numpy.random import rand a = rand(100) b = rand(100) plt.scatter(a, b) plt.show()<|fim_prefix|># repo: jtraver/dev path: /python3/matplotlib/plot1.py #!/usr/bin/env python3 #!/usr/bin/python <|fim_middle|># https://en.wikipedia.org/wiki/Matplotlib import numpy import matplotlib.pyplot as plt
code_fim
medium
{ "lang": "python", "repo": "jtraver/dev", "path": "/python3/matplotlib/plot1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Returns ------- lats : 2d array latitudes lons : 2d array longitudes Usage ----- lats,lons = readPiomas(directory,years,threshold) """ print '\n>>> Using readGrid25 function!' ### Import modules import numpy as np ### Read bin...
code_fim
hard
{ "lang": "python", "repo": "zmlabe/SeaIceVariability", "path": "/Scripts/calc_grid25.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: zmlabe/SeaIceVariability path: /Scripts/calc_grid25.py """ Script reads Sea Ice Concentrations from Nimbus-7 SMMR and DMSP SSM/I-SSMIS Passive Microwave Data, Version 1 binary files for select variables and regrids according to selected grid style (e.g., NSIDC EASE grid data). Notes ----- ...
code_fim
hard
{ "lang": "python", "repo": "zmlabe/SeaIceVariability", "path": "/Scripts/calc_grid25.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: terpyPy/ButtonBox path: /boardStateDriver/boardFunc/redrawBoard.py def redrawBoard(theBoard, event): # # dict that contains the button numbers and corresponding neighbor cells neighbors = { 0:[4, 1], 1:[5, 2, 0], 2:[1, 6, 3], ...
code_fim
hard
{ "lang": "python", "repo": "terpyPy/ButtonBox", "path": "/boardStateDriver/boardFunc/redrawBoard.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>value of each neighbor cell and turn it on if theBoard[neighbors[keyPressed][i]] == 0: newBoard[neighbors[keyPressed][i]] = 1 elif theBoard[neighbors[keyPressed][i]] == 1: newBoard[neighbors[keyPressed][i]] = 0 print(event.number) # return the new board ...
code_fim
hard
{ "lang": "python", "repo": "terpyPy/ButtonBox", "path": "/boardStateDriver/boardFunc/redrawBoard.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def test_blacklist_file_only_comments(self): self.write_blacklist_file( "# wumbo", "# mini", ) results = run_nose( '--with-blacklist', '--blacklist-file=%s' % self.blacklist_filepath, ) expected_test_list = set([ ...
code_fim
hard
{ "lang": "python", "repo": "kse201/nose-blacklist", "path": "/tests/test_blacklist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: kse201/nose-blacklist path: /tests/test_blacklist.py import os import unittest import uuid from utils import run_cmd, Results, TEST_DIR, rm_file def run_nose(*args): """Run nose against our sample dir of tests.""" cmd = ['nosetests'] + list(args) + ['-v', TEST_DIR] _, err, _ = run_...
code_fim
hard
{ "lang": "python", "repo": "kse201/nose-blacklist", "path": "/tests/test_blacklist.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> def write_blacklist_file(self, *lines): with open(self.blacklist_filepath, 'w') as f: f.write("\n".join(lines)) def test_empty_blacklist_file(self): self.write_blacklist_file("") results = run_nose( '--with-blacklist', '--blacklist-file=...
code_fim
hard
{ "lang": "python", "repo": "kse201/nose-blacklist", "path": "/tests/test_blacklist.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>with open('捉鬼实习生.txt', 'w') as of: for i in range(1,8): url = base_url%i req = requests.get(url) content = req.content.decode('gbk') soup = BeautifulSoup(content) chapters = soup.find(class_='chapter') # import pdb;pdb.set_trace() for chapter in...
code_fim
hard
{ "lang": "python", "repo": "R11happy/misc", "path": "/download_book.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> content = req.content.decode('gbk') soup = BeautifulSoup(content) chapters = soup.find(class_='chapter') # import pdb;pdb.set_trace() for chapter in chapters.find_all('li'): chaptername = chapter.find('a') if not chaptername: ...
code_fim
hard
{ "lang": "python", "repo": "R11happy/misc", "path": "/download_book.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: R11happy/misc path: /download_book.py #!usr/bin/env python #encoding=utf-8 import requests from bs4 import BeautifulSoup # 捉鬼实习生 site_url = 'http://m.ybdu.com' base_url = 'http://m.ybdu.com/xiaoshuo/8/8438_%d/' <|fim_suffix|>with open('捉鬼实习生.txt', 'w') as of: for i in range(1,8): u...
code_fim
hard
{ "lang": "python", "repo": "R11happy/misc", "path": "/download_book.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thdb-theo/Board-Games path: /NaC/difs/dif1.py import random def completely_random(*args): common_board = args[0] available_moves<|fim_suffix|>ot x] return random.choice(available_moves)<|fim_middle|> = [i for i, x in enumerate(common_board) if n
code_fim
easy
{ "lang": "python", "repo": "thdb-theo/Board-Games", "path": "/NaC/difs/dif1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: thdb-theo/Board-Games path: /NaC/difs/dif1.py import random def completely_random(*args): <|fim_suffix|>ot x] return random.choice(available_moves)<|fim_middle|> common_board = args[0] available_moves = [i for i, x in enumerate(common_board) if n
code_fim
medium
{ "lang": "python", "repo": "thdb-theo/Board-Games", "path": "/NaC/difs/dif1.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> = [i for i, x in enumerate(common_board) if not x] return random.choice(available_moves)<|fim_prefix|># repo: thdb-theo/Board-Games path: /NaC/difs/dif1.py import random def completely_random(*args): <|fim_middle|> common_board = args[0] available_moves
code_fim
easy
{ "lang": "python", "repo": "thdb-theo/Board-Games", "path": "/NaC/difs/dif1.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Act runner.invoke(post_upcoming_cfps) # Assert assert patched_slack.mock.call_count == 2 @pytest.mark.unit @pytest.mark.vcr def test_post_no_open_cfps_found(): """When there are no open CFPs, let the user know)""" # Act result = OpenCFPPost._generate_conference_text(confer...
code_fim
hard
{ "lang": "python", "repo": "busy-beaver-dev/busy-beaver", "path": "/tests/apps/call_for_proposals/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> # Assert assert patched_slack.mock.call_count == 2 @pytest.mark.unit @pytest.mark.vcr def test_post_no_open_cfps_found(): """When there are no open CFPs, let the user know)""" # Act result = OpenCFPPost._generate_conference_text(conference_cfps=[]) # Assert assert "No upcomi...
code_fim
hard
{ "lang": "python", "repo": "busy-beaver-dev/busy-beaver", "path": "/tests/apps/call_for_proposals/test_cli.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: busy-beaver-dev/busy-beaver path: /tests/apps/call_for_proposals/test_cli.py import pytest from busy_beaver.apps.call_for_proposals.cli import OpenCFPPost, post_upcoming_cfps from tests._utilities import FakeSlackClient MODULE_TO_TEST = "busy_beaver.apps.call_for_proposals.cli" @pytest.fixtur...
code_fim
hard
{ "lang": "python", "repo": "busy-beaver-dev/busy-beaver", "path": "/tests/apps/call_for_proposals/test_cli.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|># repo: meqash/mcmcplot path: /mcmcplot/mcseaborn.py #!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on August 5, 2018 @author: prmiles """ import pandas as pd import seaborn as sns from .utilities import generate_names, check_settings from .utilities import setup_subsample def plot_joint_...
code_fim
hard
{ "lang": "python", "repo": "meqash/mcmcplot", "path": "/mcmcplot/mcseaborn.py", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Kwargs: * **names** (:py:class:`list`): List of strings - name \ of each parameter. Default: `None` * **settings** (:py:class:`dict`): Settings for features \ of this method. Default: `None` * **index** (:py:class:`list`): Category for each row of \ chai...
code_fim
hard
{ "lang": "python", "repo": "meqash/mcmcplot", "path": "/mcmcplot/mcseaborn.py", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }