instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a simple color conversion library in Rust. The library should provide a public interface for color operations and expose functionality for working with different color spaces. The code snippet provided indicates that the library should re-export all items from the modules `color` and `c... | codefeedback |
You are tasked with creating a Python program that reads an RSS feed from a given URL, decodes the content using base64, and then saves the decoded content to a file. Your program should handle any errors that may occur during the process and provide appropriate error messages.
Your program should perform the followin... | codefeedback |
You are tasked with creating a program that analyzes a given text file to count the occurrences of each unique word. Your program should ignore punctuation and consider words regardless of their case (i.e., "Hello" and "hello" should be considered the same word). Additionally, the program should output the top N most f... | codefeedback |
You are tasked with implementing a command-line argument parser for a Python server application. The application is designed to accept various command-line arguments to configure its behavior. Your task is to create a Python function that parses the command-line arguments and sets the corresponding configuration option... | codefeedback |
You are tasked with implementing a function that finds the maximum value among two given integers. However, there's a catch - you are not allowed to use any comparison operators (e.g., >, <, ==) or ternary operators (e.g., a ? b : c) in your solution. Your task is to devise an algorithm that can determine the maximum v... | codefeedback |
You are tasked with creating a Python program that organizes and manages the import statements for a machine learning library. The library consists of various modules and submodules, and the program needs to ensure that the imports are correctly structured and organized. The program should also define a class called `p... | codefeedback |
You are tasked with creating a Python function that simulates a simplified version of a debugger communication system. The function will take in a list of integers representing debugger pipes and a list of strings representing debugger arguments. The function should execute the debugger command using the provided pipes... | codefeedback |
You are tasked with implementing a simplified version of a memory management system. The system should support allocating and freeing memory blocks, and it should also be able to defragment the memory to ensure efficient memory usage.
You are given a class `MemoryManager` with the following methods:
- `allocate(size)`... | codefeedback |
You are tasked with implementing a class that manages file snapshots and provides methods for manipulating and retrieving snapshot information. The class should support adding, removing, and retrieving file snapshots, as well as calculating the hash of a list of file snapshots.
You are given a partial implementation o... | codefeedback |
You are given a code snippet from a file named `keywords.gperf` which appears to be a part of a lexical analyzer or parser generator. The snippet contains a list of keywords along with their associated tokens and syntax properties. Each keyword is followed by its associated token and syntax properties, separated by com... | codefeedback |
You are tasked with implementing a custom error handling mechanism for a Python bot application. The bot has a function that takes in arguments with annotations, and it needs to raise a specific error if any argument is not annotated. Your task is to create a function that checks if the function arguments have annotati... | codefeedback |
You are tasked with implementing a program that processes a given license agreement text and extracts the permissions granted within it. The license agreement text is a string containing a series of permissions separated by commas. Each permission is a combination of verbs and nouns, representing actions and objects, r... | codefeedback |
You are tasked with creating a custom loss function for a neural network model using TensorFlow and Keras. The loss function should be a modified version of the mean squared error (MSE) loss, incorporating an additional parameter to adjust the loss calculation. Your task is to implement the custom loss function and tes... | codefeedback |
You are tasked with creating a Python program that utilizes sockets to implement a simple network time protocol (NTP) client. The NTP client will connect to a specified NTP server and retrieve the current time from the server. The program should then calculate and display the round-trip time (RTT) for the NTP request a... | codefeedback |
You are working on a project that involves integrating a third-party SMS service into a Python application. The third-party service provider offers an SDK called `ronglian_sms_sdk` for sending SMS messages. Additionally, the project uses Celery for asynchronous task processing, and the main Celery app is defined in `ce... | codefeedback |
You are working for a financial institution that deals with a large volume of financial data. Your task is to create a Python function that calculates the Black-Scholes option pricing model for European call and put options. The Black-Scholes model is a mathematical model used for pricing options contracts, and it take... | codefeedback |
You are tasked with implementing a function to generate unique sample IDs for a research project. The sample IDs follow a specific format: "YYYY-GCRSR-XXXX", where "YYYY" is the year, "GCRSR" is a project code, and "XXXX" is a unique 4-digit identifier. The function should generate a specified number of unique sample I... | codefeedback |
You are tasked with implementing a TCP gender changer tool in Rust. The tool should be able to connect to a local server and a Listen/Listen server, and it should have the ability to automatically reconnect to the local server. The tool should also support debug logging.
Your task is to implement the main functionalit... | codefeedback |
You are tasked with implementing a simplified version of a symbol table for a programming language compiler. The symbol table is used to store information about variables and their corresponding values within a specific scope. Your task is to create a data structure and methods to manage this symbol table.
You are giv... | codefeedback |
You are tasked with implementing a Python class for configuring email settings. Your task is to complete the `MailConfig` class by adding the necessary methods and attributes to handle email configuration.
The `MailConfig` class should have the following attributes and methods:
- Attributes:
- `_mfrom`: A string rep... | codefeedback |
You are tasked with implementing a custom navigation system for a mobile application. The system should handle the preparation before navigating from one view controller to another. Specifically, you need to implement the `prepare(for segue: UIStoryboardSegue, sender: Any?)` method in a Swift view controller.
The `pre... | codefeedback |
You are tasked with creating a script to automate the setup of a Kubernetes cluster and the installation of Helm on a Linux system. The script should perform the following tasks:
1. Copy the Kubernetes admin configuration file from `/etc/kubernetes/admin.conf` to the user's home directory at `$HOME/.kube/config`.
2. A... | codefeedback |
You are tasked with implementing a function that processes and submits Iroha Special Instructions to Iroha peers. The function should handle the submission of multiple instructions and allow the specification of metadata for the transaction. Your task is to design and implement the function according to the given requi... | codefeedback |
You are tasked with implementing a function that identifies independent types within a given array of types. Independent types are those that do not depend on any other type within the array. In this context, a type is considered to be dependent on another type if it directly references it in some way.
You are provide... | codefeedback |
You are tasked with creating a utility function to merge and export all the functions and variables from multiple modules in a specific directory. The function should take the directory path as input and export all the contents of the modules within that directory.
Write a function `mergeAndExportModules` that takes a... | codefeedback |
You are tasked with creating a Python script that automates the process of downloading and installing Android Studio and the Android SDK. Your script should be able to handle the entire process, including downloading the necessary files, installing the software, and setting up the environment variables.
Your script sh... | codefeedback |
You are tasked with creating a custom React hook that fetches BOS (Balance of Satoshis) score history for a given node. The BOS score is a metric used to evaluate the economic health of a Lightning Network node. The provided code snippet is a part of this custom hook and uses Apollo Client for GraphQL queries.
The `us... | codefeedback |
You are tasked with creating a Python program to draw a colorful geometric pattern using the turtle graphics library. The program should utilize the provided code snippet as a starting point and extend it to produce the desired pattern.
Your program should draw a series of nested polygons, each with a different color ... | codefeedback |
You are working on a speech recognition project and need to fine-tune a pre-trained model for your specific use case. You have come across the `wav2vec2_hug_base_960` function, which is used to load a pre-trained model for fine-tuning. The function takes variable positional and keyword arguments and sets the `ckpt` key... | codefeedback |
You are tasked with creating a Python program that interacts with the Wikipedia API to retrieve and display random articles. Your program should prompt the user for input to determine whether they want to open the random article in a web browser. If the user chooses to do so, the program should use the `webbrowser` mod... | codefeedback |
You are tasked with creating a program that processes and validates XML annotations in a given PHP class. The program should be able to identify and extract specific information from the annotations, and then perform validation checks based on the extracted data.
You are given a PHP class with XML annotations, as show... | codefeedback |
You are given an array of integers of length N, where the elements are in the range from 1 to N. There are exactly two elements that appear once and all the other elements appear exactly twice. You need to find the two elements that appear only once.
Write a function `findMissingAndRepeating` that takes in an array of... | codefeedback |
You are tasked with implementing a unit testing framework for a lease management system. The system includes different concrete lease managers, such as `MySqlLeaseMgr`. However, there are currently no unit tests for these lease managers because the only testable method, `parse`, has been moved to its own class called `... | codefeedback |
You are tasked with implementing a routing system for a web application that allows users to interact with Hitori puzzle boards. Hitori is a logic puzzle that involves shading cells in a grid such that no number appears more than once in any row or column, and no shaded cells are adjacent to each other, even diagonally... | codefeedback |
You are given a code snippet that appears to be a part of a programming language interpreter or compiler. Your task is to analyze the given code and identify the specific programming language constructs and operations being performed. Based on this analysis, you need to determine the purpose and functionality of the co... | codefeedback |
You are tasked with implementing a simplified file management system in Python. Your goal is to create a class that manages a collection of files, allowing for the creation, retrieval, and deletion of files. The class should also keep track of the number of files and the keys associated with each file.
Your task is to... | codefeedback |
You are tasked with creating a program that simulates a simple game of dice. The game involves rolling two dice and summing the values. The program should allow the user to input the number of times they want to roll the dice and then simulate the rolls accordingly. After simulating the rolls, the program should displa... | codefeedback |
You are tasked with implementing a function to efficiently copy a portion of an image from a source buffer to a destination buffer. The source image is represented by the `src` object, which contains configuration information such as horizontal and vertical resolutions. The destination buffer is represented by the `dst... | codefeedback |
You are given a snippet of code that appears to be incomplete. Your task is to complete the code by implementing a function that calculates the sum of all even numbers in a given array. The incomplete code snippet is as follows:
```java
public class ArraySum {
public static void main(String[] args) {
int[]... | codefeedback |
You are tasked with implementing a logging utility for a software build system. The provided code snippet is a part of a test suite for this logging utility. The utility is expected to log messages and handle debug mode, where debug messages are only printed when debug mode is enabled.
Your task is to write a function... | codefeedback |
You are tasked with implementing a custom reporter for a diagnostic runner in PHP. The diagnostic runner is responsible for running a series of checks to ensure the health and functionality of a system. Your custom reporter will be responsible for reporting the results of these checks.
Your custom reporter should exte... | codefeedback |
You are tasked with implementing a command pattern for a mock boat racing simulation. The provided code snippet is the beginning of a command factory package for creating commands to control mock boats in a mock race.
The `MockBoat` class represents a boat participating in the race, and the `MockRace` class represents... | codefeedback |
You are tasked with implementing a class hierarchy for representing Swagger schema components in a PHP application. The provided code snippet is a partial implementation of a class representing a path parameter in the Swagger schema. Your task is to complete the implementation of the `PathParameter` class and its relat... | codefeedback |
You are given a class with two properties: `Int` and `String`. The `Int` property is an array of integers, and the `String` property is an array of strings. The class also contains a method that populates the `String` array based on the values in the `Int` array. The method iterates through the `Int` array and construc... | codefeedback |
You are working on a continuous integration (CI) pipeline for a web application hosted on Vercel. The CI pipeline is triggered whenever a new commit is made to the repository. You need to ensure that the pipeline only runs when the commit is made to a specific branch called "stream-data". To achieve this, you decide to... | codefeedback |
You are tasked with implementing a program to parse and analyze a series of nested status messages. Each status message is represented by the keywords "The status should be" followed by a status value, and ends with the keyword "End". The status value can be one of the following: "success" or "failure". The program sho... | codefeedback |
You are tasked with creating a simple user authentication system using PHP. Your goal is to implement a User class that extends the Authenticatable class and utilizes the Notifiable trait for notifications. Additionally, you need to incorporate the Auth facade for user authentication.
Your task is to complete the User... | codefeedback |
You are tasked with creating a function to calculate the percentage change between two sets of benchmark results. Each benchmark result consists of a benchmark name and a numeric value. The function should take in two arrays of benchmark results, where each result is represented as an object with properties `benchmarkN... | codefeedback |
You are tasked with implementing a simple game using C++. The game involves a player navigating through a maze to reach the end point. The maze is represented as a 2D grid, where the player starts at a designated starting point and must navigate through the maze to reach the end point. The player can move in four direc... | codefeedback |
You are working on a seismic data processing application and need to implement a function to process seismic observations. The function receives a list of seismic observations `st_obs`, an event `event`, and a boolean `noise` indicating whether to process noise data. The seismic observations are represented as a list o... | codefeedback |
You are tasked with implementing a resource management system for file operations in C++. The system should handle file creation, writing, and automatic cleanup upon exiting the scope. Your task is to create a class that manages file resources and provides a mechanism for writing to these files.
You are provided with ... | codefeedback |
You are tasked with implementing a file adapter in Rust that can be used in both native and web assembly (WASM) environments. The file adapter should provide a unified interface for reading and writing files, and it should be able to handle the differences in file system access between native and web assembly environme... | codefeedback |
You are given a string containing parentheses and other characters. Your task is to write a function that determines whether the parentheses in the string are balanced. A string is considered balanced if it consists of pairs of opening and closing parentheses, with each opening parenthesis having a corresponding closin... | codefeedback |
You are tasked with creating a custom validation rule for Laravel's Eloquent models. The rule should ensure that a given attribute's value is unique among rows where a specific column has a certain value. For example, you may want to ensure that a user's email is unique among all users with a specific role.
Your task ... | codefeedback |
You are working on a project that involves optimizing the performance of a computational task. The task involves performing a large number of floating-point operations, and you have a constraint on the maximum number of floating-point operations per second (FLOPS) that your system can handle. Additionally, you have a l... | codefeedback |
You are tasked with creating a Python program that simulates a simple text-based game. The game involves a player navigating through a series of rooms, each with its own description and potential actions. The player can move between rooms, interact with objects, and make decisions that affect the outcome of the game.
... | codefeedback |
You are tasked with implementing a class method for handling message deletion in a Discord bot. The method should take in several parameters and perform the necessary actions to delete a message. Below is the code snippet for the method signature:
```python
MESSAGE_DELETE = 72
def __init__(self, client_bind: DiscordC... | codefeedback |
You are tasked with creating an AI agent to navigate a simulated environment using reinforcement learning. The environment is represented by a grid, and the agent can move in four directions: up, down, left, and right. The agent receives a reward for reaching a goal state and incurs a penalty for hitting obstacles. The... | codefeedback |
You are tasked with implementing a generic function in Swift that calculates the product of two numbers using a custom multiplication operation. The custom multiplication operation is defined as follows:
```swift
func customMultiply<T>(_ a: T, _ b: T) -> T {
// Your implementation of custom multiplication goes her... | codefeedback |
You are tasked with implementing a function to reverse the order of directories found in a given list and then delete the directories in the reversed order. The function should take a list of directories as input and return the list of directories in reverse order. Additionally, it should print each directory in the re... | codefeedback |
You are tasked with creating a script to automate the setup process for a data science environment using Anaconda and Python. Your script should activate a specific conda environment and then install the required Python packages from a given requirements file.
Write a Python script that takes two command-line argument... | codefeedback |
You are tasked with creating a program that simulates a simple text-based game. The game involves a player navigating through a grid-based world, collecting items, and avoiding obstacles. The player's goal is to reach the exit point while collecting as many items as possible.
The grid-based world is represented by a 2... | codefeedback |
You are tasked with implementing a function that calculates the volumes of hexahedral elements in a finite element analysis. The function takes in the coordinates of the element nodes, performs Gaussian quadrature to integrate over the element, and returns the volumes of the hexahedral elements.
The code snippet provi... | codefeedback |
You are tasked with creating a Python class that simulates a spectral synthesis wrapper for astronomical data analysis. The class should be able to retrieve and process spectral data based on input parameters such as effective temperature (teff), surface gravity (logg), and wavelength range (wstart and wend). Additiona... | codefeedback |
You are tasked with implementing a function that calculates the sum of all even Fibonacci numbers up to a given limit. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. For example, the first few numbers in the Fibonacci sequence are ... | codefeedback |
You are tasked with implementing a context manager in Python to manage terminal settings for a command-line interface (CLI) application. The context manager should handle the following operations:
1. Set the terminal to use an alternate screen buffer.
2. If the terminal is not echoing input and the operating system is... | codefeedback |
You are tasked with simulating the configuration of a virtual tunnel endpoint (VTEP) for a software-defined networking (SDN) environment. The VTEP is responsible for managing logical switches, binding virtual machines to these switches, and setting up remote connections for inter-host communication.
Your task is to wr... | codefeedback |
You are tasked with implementing a custom exception class and using it within a Python program. Your task is to create a class called `MethodNotImplementedException` that inherits from the built-in `Exception` class. This custom exception will be raised when a method is called that has not been implemented in a subclas... | codefeedback |
You are tasked with implementing a UML (Unified Modeling Language) modeling system that supports various UML elements such as stereotypes, behaviors, data types, associations, interfaces, and deployments. The provided code snippet includes the necessary header files and a namespace declaration for the UML library.
You... | codefeedback |
You are tasked with creating a function that retrieves a list of users from a Firebase authentication service and returns a specific subset of user data. The function should handle the asynchronous nature of the data retrieval and ensure that the response is formatted correctly.
Write a function `retrieveUsers` that t... | codefeedback |
You are tasked with implementing a function that processes pattern mappings in a Rust program. The function takes in a list of pattern mappings and processes them according to certain rules. Each pattern mapping can be of three types: `Exact`, `SubPattern`, or `Default`. The function should handle these mappings as fol... | codefeedback |
You are tasked with implementing a generic class that selects the output of a BizTalk transform for unit testing purposes. The class should be able to work with any transform derived from the `TransformBase` class.
Your task is to complete the implementation of the `TransformFixtureOutputSelector<TTransform>` class. T... | codefeedback |
You are working on a robotics project and need to implement a function to calculate the inverse kinematics for a robotic arm. The function should take in the robot model, data, initial joint configuration `q0`, and a frame identifier `fid`. The code snippet provided is a part of the implementation using the Pinocchio l... | codefeedback |
You are tasked with implementing a parallelized job execution function that takes a list of jobs and their corresponding durations as input and returns a pandas DataFrame or Series containing the job names and their respective completion times. The function should utilize parallel processing to execute the jobs concurr... | codefeedback |
You are tasked with implementing a function that generates a set of evenly spaced numbers within a given range, but with a twist. The function should create two sets of numbers, each with a different number of elements, and then combine them into a single array. The first set should contain a specified number of elemen... | codefeedback |
You are tasked with implementing a program to manage a collection of geometric shapes using object-oriented programming in C++. The program should support the creation and manipulation of various geometric shapes, including circles, rectangles, and triangles. Each shape should have methods to calculate its area and per... | codefeedback |
You are tasked with implementing a class to manage time-series data insertion. The class should support adding data points with timestamps and values, and provide a method to retrieve the average value for a given time range.
You need to implement the following methods for the `TestTimeseriesDataInsert` class:
1. `ad... | codefeedback |
You are tasked with creating a function to analyze network connection data and generate a message for each network device based on the duration of connection gaps. The function should take in a pandas DataFrame `network_tests` containing network connection test results and a string `flxbx` representing the hostname of ... | codefeedback |
You are tasked with creating a Swift function that processes bill payments using the BPAY system. The function should handle the payment process and error handling based on the provided code snippet.
Your task is to implement the `bpayPayment` function that takes in the payment details and a completion handler. The co... | codefeedback |
You are tasked with creating a program that reads a file and counts the number of lines containing a specific word. The program should take a file path and a target word as input, and then output the count of lines containing the target word.
You are provided with a code snippet that opens a file and reads its content... | codefeedback |
You are working on a meteorological data processing system that includes a class `echo_classifn` with methods for applying various convective criteria to radar reflectivity data. One such method is `apply_convective_criterion1`, which takes in radar reflectivity data, parameters, and grid metadata to produce a flag mat... | codefeedback |
You are tasked with creating a class that calculates the scaling factor for a given DPI (dots per inch) value. The DPI scaling factor is used to adjust the size of graphical elements on a display based on the screen's DPI setting. Your task is to implement a method that takes a DPI value as input and returns the corres... | codefeedback |
You are working on an image processing application that involves loading input images and applying a mask to them. The given code snippet is a part of this application and involves processing the input images and creating a masked input for further processing.
Your task is to implement a function that takes an origina... | codefeedback |
You are tasked with implementing a sparse gamma list data structure in C#. A sparse gamma list is a data structure that represents a list of non-negative integers in a memory-efficient manner. It is particularly useful when dealing with large lists containing mostly small integers.
The sparse gamma list is initialized... | codefeedback |
You are tasked with implementing a Python function that processes a list of application command interaction data options and returns the count of each type of option present in the list. The interaction data options are represented by the following classes: `_ApplicationCommandInteractionDataOptionString`, `_Applicatio... | codefeedback |
You are tasked with creating a Swift program to process and display stock search results obtained from an API. The provided code snippet includes a Swift struct `SearchResults` that conforms to the `Decodable` protocol. It contains a property `bestMatches` which is an array of `AssetModel` instances. Each `AssetModel` ... | codefeedback |
You are tasked with implementing a function to perform arithmetic operations on a specific type of field used in elliptic curve cryptography. The field in question is the X448 field, which is used in the RFC 7748 standard for Diffie-Hellman key exchange.
Your task is to implement a function `x448FieldAdd` that takes t... | codefeedback |
You are tasked with creating a program that simulates the behavior of a simplified shell script interpreter. The interpreter will process a given script and execute the commands based on the defined conditions. The script contains a conditional statement that checks the value of the variable `servname` and sets the var... | codefeedback |
You are tasked with creating a YouTube video downloader web application using Python and Flask. The application should allow users to input a YouTube video URL and download the corresponding video. To achieve this, you need to implement the `download_video` function in the Flask application. The function should handle ... | codefeedback |
You are tasked with creating a program to manage and display the URLs of various services in a system. The program should allow users to add, update, and retrieve the URLs of different services. Each service is identified by a unique key, and the program should support optional URLs for certain services.
You are given... | codefeedback |
You are tasked with implementing a function to calculate the scaled L2 distance between two sets of vectors. The scaled L2 distance is defined as the L2 norm of the element-wise differences between the vectors, where each dimension of the difference is scaled by a corresponding scaling factor. The problem involves crea... | codefeedback |
You are tasked with creating a Python program to implement a simple spam filter using the Naive Bayes algorithm. The program should take two command-line arguments: `--train_set` for the path to the training dataset and `--test_set` for the path to the test dataset. The training dataset contains labeled email data, whe... | codefeedback |
You are tasked with implementing a program to process images for a Braille printer's OCR (Optical Character Recognition) system. The program should utilize the Python Imaging Library (PIL) to perform image enhancement and prepare the image for OCR processing.
Your task is to complete the `process_image` function in th... | codefeedback |
You are tasked with implementing a convolutional neural network (CNN) layer using Python. Your goal is to create a class that performs the convolution operation on input images using a set of learnable filters (also known as kernels). The class should support both single and batch input images and should handle the cal... | codefeedback |
You are tasked with implementing a Texture class for a game engine. The class should have a method `LoadTexture` that loads a texture from a file and sets its parameters. The method should use OpenGL calls to generate and configure the texture. Your task is to complete the `LoadTexture` method to ensure that the textur... | codefeedback |
You are tasked with implementing a Python class that generates a sequence of dates based on a given start year. The class should have a method to initialize a dictionary with specific key-value pairs and another method to generate dates based on the start year.
You need to implement the following class:
```python
cla... | codefeedback |
You are tasked with creating a program that parses and extracts information from a string containing metadata about a GitHub repository. The metadata string contains the repository name, the username of the owner, and the number of stars the repository has received. Your program should extract this information and form... | codefeedback |
You are tasked with implementing a function that simulates a simple version control system. The function will take in a series of work functions, each representing a change to be committed. The function should return an object representing the state of the system after all the changes have been applied.
The function s... | codefeedback |
You are tasked with creating a Rust macro that reads data from a file and initializes a static array with the read values. The macro should be able to handle different data types and array sizes. Your task is to implement the `lazy_static_include_array!` macro to achieve this functionality.
The macro should take the f... | codefeedback |
You are given a tree with n nodes, where each node has a non-negative integer weight associated with it. The tree is rooted at node 1 and the nodes are numbered from 1 to n. Your task is to find the maximum sum of weights of two non-adjacent nodes in the tree.
You are provided with a code snippet that performs a depth... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.