instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with implementing a version control system for a software development project. The system should support the following features: 1. Saving and persisting ban.mask and ban.hostmask across system reloads. 2. Allowing the override of the quiet command for quiet with ChanServ. 3. Supporting bans with channe...
codefeedback
You are tasked with implementing a file caching mechanism that stores file hashes based on their modification dates. The provided code snippet outlines a function that takes a file path, computes its modification date and hash, and interacts with a local storage system to either retrieve a stored hash or compute and st...
codefeedback
You are tasked with implementing a CycleSweep class that performs a specified number of passes across a Timeline until a stop signal is given. The CycleSweep class should be designed to work with Subscriber and Timeline classes, and it should utilize the Sweepline class as a base. Your task is to implement the CycleSw...
codefeedback
You are tasked with creating a custom validation annotation for a Java web application framework. The annotation should validate that a given input field is a valid email address. You will need to implement the custom validation annotation and ensure that it can be used on input fields within the web application. Your...
codefeedback
You are tasked with creating a Python program that simulates a simple text-based game. The game involves a player navigating through a grid-based world, collecting treasures, and avoiding obstacles. The player can move up, down, left, or right within the grid, and the game ends when the player either collects all the t...
codefeedback
You are tasked with creating a Python class that manages release notes for a software project. The class, `ReleaseLogIt`, should provide methods to store and retrieve release notes based on version numbers. The release notes are stored in a TOML file format, and the class should be able to read and write to this file. ...
codefeedback
You are tasked with creating a program to visualize different types of waveforms on a graphical user interface. The program should allow the user to select between three types of waveforms (square, sawtooth, and triangle) and adjust the number of terms and speed of the wave. Your task is to implement the functionality...
codefeedback
You are given a Python function that manipulates a binary tree. Your task is to understand the given code and implement a function to construct the binary tree based on the given manipulations. The given code snippet is part of a Python function that takes a binary tree node `root` as input and performs the following ...
codefeedback
You are tasked with creating a program that validates IPv4 addresses using regular expressions. An IPv4 address is a 32-bit number typically represented in dotted-decimal notation, consisting of four decimal numbers separated by periods. Each decimal number must be between 0 and 255, inclusive. For example, "192.168.1....
codefeedback
You are working on a data processing pipeline for analyzing Twitter data. As part of this pipeline, you need to split a large CSV file into smaller chunks for efficient processing. The provided code snippet is a part of this process. The `cd` command is used to change the directory to `tweet_tokens/subsample/tweet_tok...
codefeedback
You are tasked with implementing a simple Maybe type, which represents an optional value. The Maybe type can either hold a value (Just) or be empty (Nothing). Your goal is to create a C++ class `PtrMaybe` that mimics this behavior for a pointer to a dynamically allocated object. The class should support the following o...
codefeedback
You are tasked with implementing a debugger model in Java for a specific debugging tool. The provided code snippet is a partial implementation of a GdbModelTargetSession class, which is part of a larger debugger model framework. Your task is to complete the implementation of this class by adding necessary methods and f...
codefeedback
You are tasked with implementing a Python function that processes a list of migration operations and applies them to a database. Each migration operation is represented as a dictionary containing the details of the operation. The operations can be of different types, such as renaming a model, adding a field, or alterin...
codefeedback
You are tasked with creating a program that generates a series of geometric figures based on the input provided. The program should be able to print figures such as squares, rectangles, and triangles based on the dimensions specified in the input. You are given a Python function `print_figures()` that needs to be comp...
codefeedback
You are tasked with implementing a simplified version control system in Java. Your goal is to create a class that parses the status of a Git repository and returns a representation of the repository's status. You are provided with a partial implementation of the `SpringGitStatusParser` class, which implements the `Git...
codefeedback
You are working on a program to calculate the change to be given back to customers in a retail store. The program takes the total change amount and an array representing the available quantities of different denominations of coins. The denominations are 1 cent, 5 cents, 20 cents, 50 cents, and 1 dollar. The program sho...
codefeedback
You are tasked with creating a Python function that simulates the deployment of a smart contract on a blockchain network. The function will take two parameters: `client`, representing the blockchain client, and `hex_accounts`, a list of hexadecimal account addresses. The function should calculate the change in balance ...
codefeedback
You are tasked with creating a Python class that implements a simple machine learning model training process. The class should have a method for training the model using a provided dataset split and returning the trained model. Your task is to complete the implementation of the `train` method in the given class. You a...
codefeedback
You are tasked with implementing a custom table class in Python that can be used to display data in a tabular format. The table will have columns with customizable headers and data accessors. Your task is to create a class called `CustomTable` that extends the provided `Table` class and allows for the creation of table...
codefeedback
You are tasked with implementing a specific likelihood class for Gaussian Process regression. The likelihood class is responsible for defining the probabilistic model that relates the observed data to the latent function values in the Gaussian Process framework. Your goal is to create a new likelihood class that inheri...
codefeedback
You are tasked with implementing a custom decorator in Python that logs the execution time of a function. The decorator should log the start and end time of the function execution, along with the function name and its arguments. Additionally, the decorator should handle both positional and keyword arguments. Your task...
codefeedback
You are tasked with creating a program to analyze VPN login data and generate a report of the login counts sorted by username. Additionally, you need to create a graphical representation of the login data. You are given a log file containing VPN login records in the following format: ``` username,timestamp user1,2022-...
codefeedback
You are tasked with creating a Python function that generates a unique username based on a given name. The function should take into account the maximum length of the username and ensure that the generated username is unique within a given list of existing usernames. Write a function `generate_unique_username(name, ex...
codefeedback
You are tasked with implementing an upsample function for 2D images using Python. The function should take a batch of 2D images and upsample them with the given filter. The function should accept various parameters such as the upsampling factor, gain, data format, and implementation method. You need to implement the `...
codefeedback
You are tasked with implementing a DynamicXmlBuilder class that can generate XML documents dynamically. The DynamicXmlBuilder class should support methods for creating XML declarations, elements, attributes, and nested elements. Your goal is to implement the DynamicXmlBuilder class and use it to generate an XML documen...
codefeedback
You are tasked with implementing a class for handling validation warnings in a key-value database library. The code snippet provided is a part of a unit test for the validation warning classes. The test checks the properties of a `ValidationSyntacticWarning` object and an incomplete `ValidationSemanticWarning` object. ...
codefeedback
You are tasked with implementing a class hierarchy in Swift. Your goal is to create a base class with a method that is then overridden in a subclass. However, due to a versioning issue, a crash occurs during compilation. Your task is to identify the cause of the crash and resolve the issue. Given the following code sn...
codefeedback
You are tasked with creating a script to automate the installation and configuration of CUDA (Compute Unified Device Architecture) on a Linux system. CUDA is a parallel computing platform and programming model developed by NVIDIA for general computing on GPUs. The provided code snippet is a part of such a script and co...
codefeedback
You are tasked with implementing a custom iterator trait in Rust that can iterate over a collection with a specific context. The trait `ContextIterator` has an associated type `Item` representing the type of items yielded by the iterator. It also has a method `next` that takes a reference to the context and returns an ...
codefeedback
You are given a list of strings representing patterns and a list of strings representing texts. Your task is to implement a function `pattern_matcher(patterns, texts)` that returns a list of lists. Each inner list contains the indices of the texts that match the corresponding pattern. If a pattern does not match any te...
codefeedback
You are working on a web application that displays scorecards for different types of sports matches. The code snippet provided is a part of the HTML template used to render a single scorecard. The PHP variable `$panel_color` is assigned the result of a function `panelColor()` that takes two parameters: `$scorecard` and...
codefeedback
You are tasked with implementing a function that filters out data to show information for the selected node only in a tree-like data structure. The tree is represented using a list of dictionaries, where each dictionary represents a node and contains the node's information along with a key for its children. The struct...
codefeedback
You are tasked with implementing a function that calculates the roots of a quadratic equation. The function should take three input parameters representing the coefficients of the quadratic equation (a, b, and c) and return the two roots (x_c and x_d) as a tuple. The quadratic equation is of the form ax^2 + bx + c = 0,...
codefeedback
You are tasked with creating a Python function that emulates the behavior of the `lsd` alias in the given shell script. The `lsd` alias is designed to list only directories in a directory listing, excluding files and other types of entries. Your Python function, `list_directories`, should take a directory path as inpu...
codefeedback
You are tasked with implementing a Python class that handles asynchronous HTTP requests using the `aiohttp` library. The class should have a method for creating a session and another method for fetching the bytes of an image from a given URL. Additionally, the class should handle various exceptions related to HTTP requ...
codefeedback
You are tasked with implementing a Python function that interacts with a version control system using the Git command-line interface. The function, `git_config`, takes a configuration parameter and returns a dictionary containing the configuration settings. However, the provided code snippet is incomplete and contains ...
codefeedback
You are working on a data processing pipeline for astronomical observations. As part of the pipeline, you need to verify the integrity of FITS (Flexible Image Transport System) files by checking their checksums. FITS files are commonly used in astronomy to store images, tables, and metadata. You have a Python script t...
codefeedback
You are tasked with implementing a Python class for managing secret chats in a messaging application. The class should have attributes for the chat's ID, user ID, state, outbound status, time-to-live (TTL), key hash, and layer. Your task is to create the `SecretChat` class with appropriate attribute types and a method ...
codefeedback
You are tasked with creating a Python program that interacts with the Telegram API and the pytube library to download YouTube videos based on user input. Your program should handle user commands, message inputs, and callback queries to facilitate the video download process. Your program should include the following co...
codefeedback
You are tasked with creating a Python function that validates and processes database configuration settings for a Django application. The function should take a dictionary representing the database configuration and perform the following tasks: 1. Check if the 'ENGINE' key exists and its value is 'django.db.backends.sq...
codefeedback
You are given the inorder and postorder traversal sequences of a binary tree. Your task is to construct the binary tree from these traversal sequences and return the root node of the tree. The inorder and postorder traversal sequences are represented as lists of integers. The inorder traversal sequence represents the ...
codefeedback
You are tasked with implementing a class to manage cloud images for different types of agents. The provided code snippet is part of a method that adds images to a list based on a target agent type key. Your task is to create a Java class that encapsulates this functionality and provides methods to add images for specif...
codefeedback
You are tasked with creating a Python function that converts a given Keras model into a C code representation using the `keras2c` library. The `keras2c` library provides a way to convert Keras models into C code for deployment on embedded systems. Your function should take a Keras model as input and return the equivale...
codefeedback
You are tasked with implementing a command-line interface (CLI) for managing port forwarding actions. The CLI should support commands for starting, stopping, and outputting port forwarding configurations. The provided code snippet is a part of the CLI implementation and contains a closure that handles the execution of ...
codefeedback
You are tasked with implementing a custom data structure in C# that represents a const-terminated auto string pointer. The struct LPCTSTR is defined with the StructLayout attribute set to LayoutKind.Sequential and implements the IConstTerminatedAutoStringPointer interface. Your goal is to create a C# class that uses LP...
codefeedback
You are tasked with creating a Python function that utilizes the `archivy` library to search for specific content within an archive. The `archivy` library provides functionality for managing and searching through personal knowledge bases. Your function should take in a search query and return a list of results containi...
codefeedback
You are tasked with implementing a custom operator for the RxSwift framework that extends the functionality of the `Observable` type. The operator should be designed to detect when a `UIScrollView` has been scrolled to its bottom. Your task is to create a custom RxSwift operator, `reachedBottom`, which will be an exte...
codefeedback
You are tasked with implementing a debug tree builder for a SwiftUI-like framework. The provided code snippet is a part of an extension for the `VStack` view, which conforms to the `ViewBuildable` protocol. The `buildDebugTree` function is responsible for constructing a debug tree that represents the hierarchy of views...
codefeedback
You are tasked with creating a program that simulates a simplified version of a job scheduler used in a distributed system. The system consists of multiple nodes, each capable of running various tasks. The tasks are defined in a job specification file, and the scheduler is responsible for assigning these tasks to avail...
codefeedback
You are tasked with implementing a monitoring system for a client that senses various events and reports them. The client provides a method `begin_monitoring` that takes in three parameters: a mutable boolean `encountered_error`, an `Arc<Mutex<DateTime<Utc>>>` named `utc`, and an `Arc<Mutex<i8>>` named `times_sensed`. ...
codefeedback
You are tasked with implementing a Python module that provides access to geographical data from the Natural Earth dataset. The Natural Earth dataset is a public domain map dataset available at 1:10m, 1:50m, and 1:110 million scales. Your goal is to create a function that retrieves specific geographical data from this d...
codefeedback
You are tasked with implementing a Python class to represent a person, with specific methods and attributes. Your class should be named `Persona` and should have the following functionalities: - The constructor should take a single argument, `nombre`, which initializes the person's name. - The method `hola()` should pr...
codefeedback
You are given a binary tree represented as a collection of nodes. Each node has a value and may have up to two children, which are also nodes. The tree is not necessarily balanced or sorted. Your task is to implement a method to calculate the maximum depth of the tree. The maximum depth is defined as the number of node...
codefeedback
You are tasked with creating a function that validates and processes a given data object based on a predefined schema. The schema is defined using a specific structure, and the function should ensure that the input data conforms to this schema. The schema is represented as a JavaScript object with the following struc...
codefeedback
You are tasked with creating a program to parse and organize a list of configuration settings for a software application. Each setting is represented as a string in the format "Category-setting_name-setting_property", where "Category" is the general category of the setting, "setting_name" is the specific name of the se...
codefeedback
You are tasked with implementing a class that represents HTTP methods. The class should provide a set of predefined constants for commonly used HTTP methods and allow for the addition of custom methods. Additionally, the class should support the retrieval of the method name based on its constant or vice versa. Your ta...
codefeedback
You are tasked with implementing a class for creating a simple encryption algorithm called MS_Cipher. The MS_CipherBuilder class is provided to assist in constructing the MS_Cipher object. The MS_Cipher class should have methods for encrypting and decrypting messages using a specific algorithm. The MS_CipherBuilder cl...
codefeedback
You are tasked with creating a Python class that manages a collection of images and provides functionality to filter images based on their location. Your task is to implement the `Image` class with the following requirements: 1. The `Image` class should have a class method `location_filter` that takes a location as in...
codefeedback
You are tasked with implementing a custom button class in Swift that allows for easy customization of its appearance and behavior. The button should support setting a main tint color and an image size, and it should also have a lazy initialization for efficient memory usage. Your task is to create a Swift class called...
codefeedback
You are tasked with implementing a class for managing embeddings in a natural language processing (NLP) system. The class, `EmbeddingsMachine`, is responsible for initializing and working with word embeddings derived from a given corpus representation, word2vec representation, and key-value store representation. The `...
codefeedback
You are tasked with simulating the movement of a robot in a 2D space using the bicycle model. The bicycle model is a simplified representation of a vehicle's motion, where the robot moves based on its velocity, yaw rate, and time increment. The robot's position and orientation are represented by its x and y coordinates...
codefeedback
You are tasked with implementing a function that processes reservations for a hotel management system. The function should take a request object as input and return the reservations manager. The request object contains information about the reservations to be managed. You are provided with a partial code snippet that ...
codefeedback
You are tasked with implementing a method to extract the name of a property from a lambda expression in C#. Given the following code snippet as a starting point, create a method that takes a lambda expression representing a property and returns the name of that property as a string. ```csharp using System; using Syste...
codefeedback
You are tasked with implementing a utility class for handling parameterized SQL statements. The class should support setting various types of parameters (such as integers, strings, booleans, doubles, floats, and dates) to a prepared SQL statement. Additionally, it should handle setting byte arrays and input streams for...
codefeedback
You are tasked with creating a program to manage the layout of UI elements in a mobile application. The program should utilize the SnapKit library, which provides a DSL for Auto Layout in iOS and macOS development. The code snippet provided is a part of the program that sets up the constraints for UI elements. Your ta...
codefeedback
You are working on a software project that involves text rendering using the HarfBuzz library. The code snippet provided is a part of the project and involves setting a message function for a buffer. Your task is to implement a class method that will be used as the message function and ensure that it meets the requirem...
codefeedback
You are tasked with implementing a function to retrieve information about connected devices using the FTDI library in Python. The FTDI library provides functions for interfacing with FTDI devices such as USB-to-serial converters. The code snippet provided is a part of the function `get_device_info_list()` which is inte...
codefeedback
You are tasked with implementing a simple expression evaluator for a custom programming language. The language supports the declaration of enum types with optional initializers. An enum member declaration consists of a name, a type, and an optional initializer expression. The initializer expression can be used to assig...
codefeedback
You are tasked with creating a Python class that manages server connections and settings for a custom asynchronous socket I/O core. Your task is to implement the `ASockIOCore` class, which will handle server connections and settings based on the provided code snippet. The `ASockIOCore` class should have the following ...
codefeedback
You are tasked with creating a Python script that processes a file containing information about custom components for a media player application. Each line in the file represents a custom component and contains the following fields separated by a delimiter: 1. File path: The path to the Python file containing the custo...
codefeedback
You are tasked with creating a program that parses a given PHP license header and extracts specific information from it. The PHP license header follows a specific format, and your program should be able to identify and extract the relevant details. Your program should extract the following information from the PHP lic...
codefeedback
You are tasked with implementing a custom HTML table generator in PHP. Your task is to create a class `CustomTable` with the following functionalities: 1. The class should have a constructor that takes in the number of rows and columns for the table. 2. It should have a method `setHeader` that takes an array of string...
codefeedback
You are tasked with implementing a Python class for controlling airpads, which are devices that use air to hover or levitate objects. The class, named `HoveringAxis`, is a subclass of `SequencerMixin` and `Axis`. It is responsible for managing the air supply to the airpads and interacting with a switch device to contro...
codefeedback
You are working on a project that involves reading and processing files in a specific format. The project uses TypeScript and has two functions defined in an external module: `readVueFiles` and `readLangFiles`. These functions are responsible for reading files from a given source directory and returning an array of `Si...
codefeedback
You are tasked with implementing a quicksort algorithm for sorting an array of integers. Quicksort is a comparison-based sorting algorithm that uses a divide-and-conquer strategy to sort the elements. The algorithm works by selecting a 'pivot' element from the array and partitioning the other elements into two sub-arra...
codefeedback
You are tasked with implementing a Python class that authenticates users against an LDAP (Lightweight Directory Access Protocol) server. The provided code snippet defines the `LDAPAuthenticator` class as the only public interface for this functionality. Your task is to complete the implementation of the `LDAPAuthentica...
codefeedback
You are tasked with implementing a time conversion function for a music player application. The application uses a beat-based time system for synchronization with music playback. The provided code snippet includes a function `modTime` that calculates the modulus of a given time with respect to the length of a musical p...
codefeedback
You are tasked with creating a password validation function for a web application. The function should take a password as input and return True if the password meets the specified criteria, and False otherwise. The password criteria are as follows: 1. The password must be at least 8 characters long. 2. The password mu...
codefeedback
You are tasked with implementing a Java method to calculate the factorial of a given non-negative integer. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is 5 * 4 * 3 * 2 * 1 = 120. You need to implement the fol...
codefeedback
You are working on a robotics project that involves processing lidar data to detect obstacles. The lidar sensor provides a list of distances from the sensor to obstacles at various angles. Your task is to write a function that takes the lidar data and identifies the angle at which the closest obstacle is located. You ...
codefeedback
You are tasked with implementing a custom data structure in Rust that combines the functionality of a set and a mutable reference. Your task is to create a `MutSet` type that allows mutable access to a set of indexed values. The `MutSet` type should implement the `Deref` trait to provide a reference to the underlying s...
codefeedback
You are tasked with implementing a TypeScript module that generates shades of a given color. The module exports a function `GenerateShades` and several interfaces and types from an `interface` module. Your goal is to create the `GenerateShades` function and ensure that it adheres to the provided interfaces and types. ...
codefeedback
You are tasked with creating a Python class to manage Telnet connections to a network controller. The class, `BlackholeTelnetManager`, is a subclass of `ExpectManager` and is responsible for establishing and managing Telnet connections to the controller. The `get_new_expect_connection` method is used to create a new Te...
codefeedback
You are tasked with implementing a function that processes SVG files and creates a PNG image from them. The function `create_png_from_svg` takes in the filepath of the SVG file, the width and height for the exported PNG, and the destination filepath for the PNG image. After creating the PNG, the code snippet demonstrat...
codefeedback
You are tasked with implementing a Python class that interacts with a REST API to manage DPI (Deep Packet Inspection) restriction group apps. The class should provide methods to enable and disable these apps using asynchronous requests. You are provided with a partial code snippet of the class, which includes two asyn...
codefeedback
You are tasked with creating a web form for selecting a service from a dropdown list. The form is to be implemented using Laravel's Blade templating engine. The code snippet provided is a part of the form creation process. The `Form::label` and `Form::select` functions are used to generate the label and the dropdown se...
codefeedback
You are tasked with creating a Python function that processes a given text and returns a list of unique emojis present in the text. An emoji is defined as any Unicode character that represents an emoji. You should use the `emoji` library to achieve this. Write a function `extract_unique_emojis(text)` that takes a stri...
codefeedback
You are given a code snippet written in Swift. Your task is to analyze the code and identify the syntax error or issue causing the compilation to fail. Once you have identified the issue, provide the corrected code that resolves the compilation error. Code snippet for analysis: ```swift // RUN: not --crash %target-swi...
codefeedback
You are tasked with implementing a simple slider component for a web page. The slider should allow users to click and drag to scroll through its content. You are given a code snippet that includes event handler functions for handling mouse events related to the slider. Your task is to complete the implementation of the...
codefeedback
You are tasked with implementing a Python function to optimize a given objective function using the conjugate gradient method. The conjugate gradient method is an iterative optimization algorithm used to solve unconstrained optimization problems. Your task is to create a function that takes the objective function, its ...
codefeedback
You are tasked with implementing a function to parse a README file for a given application. The README file contains various sections of text, and your function should extract specific information based on the application's requirements. You are given the following function signature: ```python def parse_readme(app, t...
codefeedback
You are tasked with implementing a function that performs a specific operation on a given input tensor using PyTorch. The function takes in a tensor `Z` and performs a series of mathematical operations to compute a new tensor `W`. Your task is to understand the given code snippet and write a function that accomplishes ...
codefeedback
You are tasked with implementing a Swift function that processes an array of integers and returns the sum of all the even numbers in the array. Additionally, you need to handle the scenario where the input array is empty. You are given the following code snippet as a starting point: ```swift func sumOfEvenNumbers(_ n...
codefeedback
You are tasked with implementing a function to generate a 10-byte length ByteList containing time-based bytes as described in RFC4122 for the UUID V1. The UUID V1 (Version 1) is a universally unique identifier that includes a timestamp and the MAC address of the computer that generated the UUID. Your task is to create ...
codefeedback
You are tasked with implementing a parallelized log probability calculation function using CUDA in Python. The provided code snippet includes a function `logp` from the `warprnnt_numba.rnnt_loss.utils.cuda_utils.gpu_rnnt_kernel` module, which is used for computing log probabilities in the context of the RNN-T (Recurren...
codefeedback
You are tasked with implementing a simple text-based game where the player navigates through a maze. The maze is represented as a 2D grid, where each cell can be either empty (denoted by '.') or blocked (denoted by '#'). The player starts at the top-left corner of the maze and must reach the bottom-right corner. The pl...
codefeedback
You are tasked with implementing a configuration system for managing blockchain networks. The configuration system should allow users to define and store configurations for different blockchain networks. Each network configuration consists of a unique name and a set of parameters specific to that network. To achieve t...
codefeedback
You are tasked with implementing a macro in Rust that generates a range of Unicode code points for private use. The Unicode standard reserves a range of code points for private use, which can be used for internal purposes without conflicting with standard character assignments. The specific range for private use code p...
codefeedback
You are tasked with implementing a custom data loader class in Python for a machine learning project. The data loader is responsible for yielding batches of data during the training process. However, the current implementation seems to have some issues with the iteration process. Your task is to identify and fix the pr...
codefeedback
You are tasked with implementing a simplified version of a task execution system using Python's gevent library. The system will involve creating a custom executor class and managing a queue of tasks to be executed asynchronously. Your task is to create a Python class called `TaskExecutor` that extends the `BaseExecuto...
codefeedback