instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a custom React component called `Tag` that allows users to create and display tags with customizable text. The `Tag` component should be able to render the provided text and match a predefined snapshot.
Your task is to complete the implementation of the `Tag` component and ensure that ... | codefeedback |
You are tasked with creating a program to perform multilingual named entity recognition using XLM-RoBERTa models. Named entity recognition (NER) is a natural language processing task that involves identifying and classifying named entities in text into predefined categories such as names of persons, organizations, loca... | codefeedback |
You are tasked with implementing a genetic algorithm for evolving neural networks. In this scenario, the genetic algorithm is used to create new neural networks by combining the weights and biases of two parent networks. The crossover operation is performed on the weights and biases of the neural network layers to prod... | codefeedback |
You are tasked with creating a Python function that simulates a simple game of rock-paper-scissors. The function should take two arguments, representing the choices of two players, and return the result of the game based on the standard rules:
- Rock beats scissors
- Scissors beats paper
- Paper beats rock
The functi... | codefeedback |
You are tasked with creating a program that organizes a list of file paths into a hierarchical structure based on their directory paths. Each file path is represented as a string, and the directory structure is delimited by forward slashes ("/"). Your program should group the file paths based on their directory structu... | codefeedback |
You are working on a backup script that is designed to run on a Linux system. The script is responsible for configuring the AWS CLI and setting up a scheduled backup using cron jobs. Your task is to write a Bash script that automates this process.
Your script should perform the following tasks:
1. Check if the environ... | codefeedback |
You are tasked with implementing a class for autoregressive (AR) sequence modeling in C++. The autoregressive sequence is defined by a set of lag coefficients and a bias term. The class should support updating the sequence with new values and predicting the next value based on the current sequence.
You are given a cod... | codefeedback |
You are tasked with implementing a function to calculate the integration of angular velocities using quaternions. Quaternions are a mathematical concept used to represent rotations in 3D space. The function `quaternion_integrate` takes in a list of angular velocities and a time step `dt`, and returns a list of quaterni... | codefeedback |
You are tasked with implementing a PHP trait that provides functionality for interacting with the filesystem using the Laravel framework's filesystem abstraction layer. The trait should encapsulate methods for performing common filesystem operations such as reading, writing, and deleting files.
Your task is to complet... | codefeedback |
You are tasked with implementing a circular buffer data structure in Python. A circular buffer is a fixed-size buffer that overwrites the oldest data with new data when the buffer is full. Your task is to create a class `CircularBuffer` that supports the following operations:
1. `__init__(self, size: int)`: Initialize... | codefeedback |
You are tasked with implementing a game of Connect Four. The game is played on a 6x7 grid, where two players take turns dropping colored discs into the grid. The discs fall straight down, occupying the lowest available space within the chosen column. The objective of the game is to be the first to form a horizontal, ve... | codefeedback |
You are tasked with creating a Python function that generates an HTML report for a specific employee based on their ID. The function should retrieve data from a MySQL database and use a Jinja2 template to format the report. Your task is to complete the implementation of the `print_report` function by writing the necess... | codefeedback |
You are tasked with implementing a password validation function for a user authentication system. The function should validate the user's password based on a set of predefined rules and return a boolean value indicating whether the password is valid or not.
You are given the following rules for password validation:
1.... | codefeedback |
You are tasked with creating a Python function that parses a given text file to extract the license information and the module name. The license information is denoted by the comment block containing the license text, and the module name is the first non-comment line after the license block. Your function should return... | codefeedback |
You are tasked with implementing a simplified task management system using Rust. The system should allow users to create, retrieve, update, and delete tasks. To achieve this, you need to define a `TaskManager` struct and implement several methods for task management.
You are provided with a code snippet that defines a... | codefeedback |
You are tasked with implementing a configuration manager for network settings in a Python application. The configuration manager should provide default values for network settings and allow users to override these defaults. The network settings include the number of retry times for network requests, proxy enablement, p... | codefeedback |
You are tasked with creating a program that counts the occurrences of specific characters in a given string. Your program should take a string and a list of characters as input and return the count of each character in the string. The program should ignore case sensitivity, meaning 'A' and 'a' should be considered the ... | codefeedback |
You are tasked with implementing a Python class that represents a 2D grid. The grid will be used to store and manipulate data in a two-dimensional space. Your task is to create a class called `Grid` with the following functionalities:
- Initialize the grid with a specified size or a default size of 50x50.
- Set a value... | codefeedback |
You are tasked with implementing a function to parse and process POST request data in a Python web application. The function should handle cases where the request data is a dictionary with empty string values.
Write a Python function `parse_post_data(request_data: dict) -> dict` that takes a dictionary `request_data`... | codefeedback |
You are tasked with implementing a Python function that calculates the coefficients for a family of embedded Runge-Kutta formulae based on the research paper "A family of embedded Runge-Kutta formulae" by <NAME> and <NAME> (1980). The coefficients are used for solving ordinary differential equations numerically. The fa... | codefeedback |
You are tasked with implementing a custom data loader class for the CIFAR-10 dataset using PyTorch. The CIFAR-10 dataset consists of 60,000 32x32 color images in 10 classes, with 6,000 images per class. The dataset is divided into 50,000 training images and 10,000 testing images. Your custom data loader class should in... | codefeedback |
You are tasked with implementing a function that checks whether a given string is a valid palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, disregarding spaces, punctuation, and capitalization. For example, "A man, a plan, a canal, Panama" is a... | codefeedback |
You are working on a 2D texture mapping system for a game engine. The code snippet provided is a part of the texture mapping process. The `textureMapper` object contains a mapping of texture IDs to texture maps. Each texture map contains information about the front face of the texture, including UV coordinates for mapp... | codefeedback |
You are tasked with implementing a function that takes in a string representing a mathematical expression and evaluates it. The expression will consist of integers, the four basic arithmetic operators (+, -, *, /), and parentheses. The expression will be properly formatted and will not contain any spaces.
Your task is... | codefeedback |
You are tasked with implementing a function that converts a given color in hexadecimal format to a UIColor object in Swift. The function should take into account the red, green, blue, and alpha components of the color and return the corresponding UIColor object.
The function signature is as follows:
```swift
func hexT... | codefeedback |
You are tasked with implementing a simple task scheduler in Rust. The scheduler should allow users to schedule tasks to run at specific times and execute them in a concurrent manner. Your task is to implement the `Scheduler` struct and its associated methods to achieve this functionality.
The `Scheduler` struct should... | codefeedback |
You are given a list of integers representing the daily stock prices of a company. Your task is to write a function to calculate the maximum profit that can be obtained by buying and selling the stock at most once. If it is not possible to make any profit, the function should return 0.
Write a function `maxProfit(pric... | codefeedback |
You are tasked with implementing a rendering system for a particle simulation. The simulation consists of different types of particles that need to be rendered in a specific order to achieve the desired visual effect. The rendering order is determined by the "pass" number associated with each particle type.
Each parti... | codefeedback |
You are tasked with creating a Python decorator that logs the execution time of a function and prints it to the console. Your decorator should also have an option to include the function's docstring in the log output.
Your task is to implement the `log_execution_time` decorator with the following specifications:
- Th... | codefeedback |
You are tasked with implementing a Python function that takes in a list of geographical coordinates and their corresponding values, and returns a smoothed interpolation of the values using the Inverse Distance Weighting (IDW) method. The IDW method calculates the value at any location by averaging the values of the sur... | codefeedback |
You are tasked with implementing a custom asynchronous command execution framework in C#. The framework should allow the execution of commands in a non-blocking manner, enabling the system to continue processing other tasks while the commands are being executed. Your task is to create a class that encapsulates the func... | codefeedback |
You are tasked with implementing a custom animation transition in an iOS app. The given code snippet is a part of an animation transition implementation using the UIKit framework in Swift. The `fromView` is a reference to the view being transitioned from, and the code sets its alpha value to 1.0. The `transitionContext... | codefeedback |
You are tasked with analyzing the performance of a Python program using the `pstats` module. The `pstats` module provides a convenient interface for retrieving and analyzing statistics from Python's `cProfile` module, which is used for profiling Python programs. Your goal is to write a program that reads a profile data... | codefeedback |
You are tasked with implementing a dependency graph data structure in JavaScript. The graph should support adding dependencies between nodes and detecting circular dependencies.
You need to implement the `DependencyGraph` class with the following methods:
1. `addNode(id)`: Adds a node with the given id to the graph.
2... | codefeedback |
You are tasked with creating a Python program to parse a given text file and extract specific information from it. The text file contains a list of contacts in the following format:
```
Name: John Doe
Email: johndoe@example.com
Phone: (123)4567890
Name: Jane Smith
Email: janesmith@example.com
Phone: (987)6543210
```
... | codefeedback |
You are tasked with simulating a text-based adventure game where the player navigates through a cave system, encountering various hazards and creatures. The game is driven by a series of events and actions, and the player's objective is to survive and reach the end of the cave.
The game is represented by a series of i... | codefeedback |
You are tasked with implementing a function that generates a unique class identifier (ClassId) based on the level and primitive type provided. The ClassId is constructed by concatenating a prefix derived from the primitive type and a sequence of array brackets based on the level.
You are given the following Rust code ... | codefeedback |
You are tasked with implementing a C++ template structure that handles the end directive for a parser. The given code snippet provides a partial implementation of the `end_director_base` template structure. Your task is to complete the implementation by defining the `attribute` structure within the `end_director_base` ... | codefeedback |
You are working on a data management system that involves renaming dataset files and dumping data into fixtures. Your task is to implement a Python function that renames dataset files and then dumps the data into fixtures using the Django framework.
You are given a partial code snippet from the data management system:... | codefeedback |
You are tasked with creating a program that processes a list of layout data for different GUI components. Each layout data entry consists of a group name, layout type, and parent component. The layout type can be one of the following: `SWT.SHADOW_NONE`, `SWT.SHADOW_IN`, or `SWT.SHADOW_OUT`. Your goal is to write a func... | codefeedback |
You are tasked with implementing a custom control system for a virtual machine using C#. The virtual machine has a set of control instructions that need to be executed based on the control signals received. Your task is to implement the control system using the provided code snippet as a starting point.
The `Jsm` clas... | codefeedback |
You are tasked with creating a Python class that simulates a simple banking system. The class should have methods for depositing funds, withdrawing funds, and checking the current balance. Additionally, the class should log all transactions using a logger instance.
Your task is to implement the `BankAccount` class wit... | codefeedback |
You are tasked with creating a Python class that manages a library of API views for a web application. The class should handle the registration and retrieval of different types of API views, such as base views, generic views, and mixins.
Your task is to implement the `APIViewManager` class with the following requireme... | codefeedback |
You are tasked with implementing a function that performs a specific mathematical operation on a list of values and returns the result. Additionally, you need to write tests to ensure that the function behaves as expected.
You are given the following code snippet as a reference:
```python
test_values = get_standard_v... | codefeedback |
You are tasked with creating a program to manage a robot's movements and Easter egg actions using Python's tkinter library. The program should include functionality for setting the target position of the robot's body and triggering various Easter egg actions. Additionally, the program should display the robot's statist... | codefeedback |
You are tasked with implementing a function to calculate the refund contributions for a group of individuals. The function `get_refund_contribs` takes no parameters and is a method of a class. The class maintains a list of individual contributions made towards a refund. The contributions are represented as a list of po... | codefeedback |
You are tasked with creating a Python class that utilizes the provided code snippet to interact with the Sherlock and LCBuilder libraries. Your class should be able to perform the following functionalities:
1. Initialize an object with the necessary input parameters.
2. Retrieve information about a celestial object usi... | codefeedback |
You are tasked with writing a Python function to validate a JSON payload received from an API. The payload contains information about streaming data and must adhere to specific criteria. Your function should assert the presence of certain keys and their corresponding values within the JSON payload. Additionally, it sho... | codefeedback |
You are tasked with implementing a user authentication system for a web application. The system should allow users to register, login, and obtain an access token for subsequent authenticated requests. You are provided with a code snippet from a test suite for the authentication system, written in Python using the Djang... | codefeedback |
You are working on a project management system that involves storing and managing various project-related data in a relational database. The given code snippet represents a part of the database schema using SQLAlchemy, a popular Python ORM (Object-Relational Mapping) library.
Your task is to create a Python class that... | codefeedback |
You are tasked with implementing a function that processes a list of clusters and returns a modified version of the list based on certain criteria. Each cluster is represented as a DOM element with the class structure `.body .clusters .cluster.selector.option`. Your task is to filter the clusters based on specific cond... | codefeedback |
You are tasked with creating a Python function that utilizes the Shapely and Geopandas libraries to determine the country of a given latitude and longitude tuple offline. The function should take in the latitude and longitude as input parameters and return the corresponding country name.
Create a function called `get_... | codefeedback |
You are tasked with creating a PHP class that implements a simple file management system. The class should provide methods for adding, removing, and retrieving nodes from a file system tree structure.
Your task is to implement the `FileSystem` class with the following requirements:
- The class should have a constructo... | codefeedback |
You are tasked with implementing a function to encode a given input stream to a base64-encoded output stream. Base64 encoding is a method of encoding binary data into ASCII string format. The provided code snippet contains a test function `test_encode_stream_to_stream` that tests the encoding functionality. Your task i... | codefeedback |
You are given a code snippet representing a set of assignments to an array `JB` using indices calculated from arithmetic operations and array elements. Your task is to write a function that takes in the arrays `JB`, `w`, `p`, `x`, and `dwdx` and returns the resulting array `JB` after applying the given assignments.
Th... | codefeedback |
You are given a scenario where a vector `v` is obtained by applying the hyperbolic tangent function (`tanh`) to a set of input values. Subsequently, for each timestamp, the vector of size A from `v` is reduced with a vector `u`. Your task is to implement a function that performs this reduction operation for a given set... | codefeedback |
You are tasked with creating a program that can efficiently determine the dependencies between different software packages. Each package can have a list of dependencies, and these dependencies can have their own dependencies, forming a hierarchical structure. Your task is to implement a function that takes in a list of... | codefeedback |
You are given a 2D array representing a maze. The maze consists of cells, some of which are blocked and others are open. The objective is to find the shortest path from the top-left corner to the bottom-right corner of the maze, moving only through open cells. You can move in four directions: up, down, left, and right.... | codefeedback |
You are tasked with implementing a LikeFilter class in Java that can evaluate whether a given string matches a specified pattern. The LikeFilter class should take an IdentityExtractor and a pattern string as input and return true if the input string matches the pattern, and false otherwise.
The pattern string follows ... | codefeedback |
You are tasked with implementing a custom error type and associated functionality in Rust. Your goal is to create a custom error type that can represent different error cases and implement the necessary traits to work with the Rust error handling system.
Your custom error type should be named `CustomError` and should ... | codefeedback |
You are tasked with implementing a function to determine whether a given integer is a prime number. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Your task is to create a Python function `es_primo` that takes an integer as input and returns `True` if the number... | codefeedback |
You are tasked with implementing a custom tokenizer for a natural language processing (NLP) model. The tokenizer should adhere to specific configuration parameters and tokenization rules. The provided code snippet outlines some of the key parameters and settings for the tokenizer.
Your task is to create a Python class... | codefeedback |
You are tasked with implementing a simplified version of a tray management system for a warehouse. The system should support adding and removing trays, as well as checking the availability of a specific tray.
You are given a partial implementation of the `TrayManager` class in Kotlin. The `TrayManager` class has the f... | codefeedback |
You are tasked with implementing a file compression and decompression utility using the Brotli compression algorithm. Brotli is a generic-purpose lossless compression algorithm that compresses data using a combination of a modern variant of the LZ77 algorithm, Huffman coding, and 2nd order context modeling.
Your task ... | codefeedback |
You are working on a security module for a software application that involves encrypting and decrypting data using the Windows Cryptography API. The code snippet provided is a part of the encryption and decryption functions using the `CryptEncrypt` and `CryptDecrypt` functions from the `advapi32` library in Windows.
Y... | codefeedback |
You are tasked with creating a web application for a blogging platform using Flask and WTForms. Your goal is to implement a form for users to subscribe to the platform and a form for creating new blog posts. The provided code snippet includes the initial form definitions for the subscriber and blog post creation.
Your... | codefeedback |
You are tasked with creating a JUnit test suite for a simple Java class that represents a basic calculator. The calculator class has methods for addition, subtraction, multiplication, and division. Your goal is to write test cases to ensure that each method in the calculator class works as expected.
The calculator cla... | codefeedback |
You are tasked with creating a Python program that reads data from a file, manipulates it, and then performs an assertion test using the `unittest` module. Your program should read the contents of a file, modify the data, and then compare the modified data with an expected output using the `assertEqual` method. Finally... | codefeedback |
You are tasked with implementing a card management system using Java interfaces and classes. The provided code snippet includes a `CardFactory` class with two methods: `openSession()` and `initMethod()`. Your task is to extend this code to create a complete card management system.
Your system should include the follow... | codefeedback |
You are tasked with creating a script to launch a Java application using the command line. The script should set the classpath, specify system properties, and launch the application using the `sun.tools.jconsole.JConsole` class. Your task is to write a shell script that accomplishes this.
Your script should set the cl... | codefeedback |
You are tasked with creating a script that processes a list of parameters and performs a specific action on each parameter. Your script should take the following form:
```bash
#!/bin/bash
# Iterate through the parameters and perform an action
for param in "$@"
do
echo "${param}"
done
```
Your task is to extend t... | codefeedback |
You are tasked with creating a Python class that processes data from a master file and extracts specific data based on keys provided in a separate file. Your task is to implement the `DataExtractor` class, which should have the following functionality:
- Initialize with the path to the master file and a list of tuples ... | codefeedback |
You are tasked with creating a Python class that can store data to an Excel file and load data from an Excel file. Your class should provide methods for adding data, saving the data to an Excel file, and loading data from an existing Excel file. The class should also support specifying the sheet name for storing and lo... | codefeedback |
You are tasked with implementing a program to manage employee information using a custom data structure. The `EmployeeInfo` structure holds an employee's data, including their name, employee ID, and salary. Your task is to create a program that allows users to perform various operations on this employee information, su... | codefeedback |
You are tasked with creating a Python function that parses a list of strings representing metadata for software packages. Each string contains information about the operating system, programming language, and topic associated with a particular package. Your goal is to extract this information and organize it into a str... | codefeedback |
You are tasked with implementing a function to handle the asynchronous login process for a gaming platform. The provided code snippet is part of a larger system that interacts with a game server to obtain login tokens for players. Your task is to complete the implementation of the `handle_login` function, which takes i... | codefeedback |
You are tasked with implementing a settings module for a web application. The module should allow the application to read various configuration settings from environment variables or use default values if the environment variables are not set. Your task is to write a function `setting` that takes a setting name and a d... | codefeedback |
You are working on a deep learning project and have encountered a bug in the code related to loading model states and handling input data. Your task is to identify the issue and fix it to ensure the smooth execution of the program.
Given the provided code snippet, you notice that there are potential issues with loadin... | 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 defined as follows: F(0) = 0, F(1) = 1, and F(n) = F(n-1) + F(n-2) for n > 1. For example, the first few Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on.
Your ta... | codefeedback |
You are tasked with creating a Python function that automates the process of uploading a file to a web application using Selenium. The function should take in the file path and the web application URL as input and should use Selenium to interact with the web page, locate the file upload input, and submit the file for u... | codefeedback |
You are tasked with implementing a simple program management system in C++. The system should allow the creation, deletion, and execution of programs. Each program has a name and a set of instructions to be executed. You are provided with a partial code snippet that declares a pointer to a `Program` object.
Your task ... | codefeedback |
You are tasked with implementing a text processing algorithm that involves applying a specific style to a range of text in a document. The algorithm should take into account the existing style of the text and the range to be styled. The code snippet provided is a method call that applies a text substyle to a given rang... | codefeedback |
You are tasked with implementing a Python class that simulates a simplified version of a configuration object. The class should be able to convert a given protocol buffer (proto) configuration into an object, allowing for the overwriting of repeated fields.
Your task is to complete the implementation of the `ConfigObj... | codefeedback |
You are tasked with implementing a function to calculate the sediment flux at nodes in a river network simulation. The sediment flux is a crucial parameter in understanding the dynamics of sediment transport in river systems. In this problem, you are given a code snippet that includes a test for the sediment flux calcu... | codefeedback |
You are tasked with implementing a Python class that can handle the decoding of WebP images. The given code snippet is a part of a class method that opens and decodes a WebP image file. Your task is to complete the implementation of the class by adding the missing methods and attributes to support the functionality of ... | codefeedback |
You are tasked with implementing a function to manage a currency exchange system. The function should handle the exchange of a specified amount of currency and provide the ability to stop the exchange action if it has not already been completed.
You are provided with a code snippet that includes a partial implementati... | codefeedback |
You are tasked with creating a function that processes a given Swift code file and extracts the titles of all the view controllers that inherit from a specific superclass. The superclass name and the file content will be provided as input to your function.
Write a function `extractViewControllerTitles` that takes in t... | codefeedback |
You are given a list of strings, each representing a word. Your task is to implement a function that returns the longest common prefix among all the strings. If there is no common prefix, the function should return an empty string.
Create a function `longestCommonPrefix(words: List[str]) -> str` where:
- `words`: a li... | codefeedback |
You are tasked with creating a custom exception class and implementing error handling for a command-line utility. The utility runs external processes and needs to handle non-zero exit codes by raising a custom exception. Your task is to write a Python class that encapsulates this functionality.
Your class should be na... | codefeedback |
You are tasked with developing a Python program to process data from a database and perform specific operations on the retrieved information. The program should collect group information and process events for each group. The code snippet provided gives a glimpse of the program's functionality, but it requires completi... | codefeedback |
You are tasked with creating a Python function that handles database connections and disconnections based on different data sources. Your task is to implement a function that connects to a MySQL database via SSH tunneling or reads data from a file, and ensures that the database connection is properly closed in both cas... | codefeedback |
You are tasked with implementing a Swift data structure to represent file permissions. The file permissions are represented by a set of options, each with a corresponding textual description. Your goal is to create a `FilePermission` structure that can store and manipulate these permissions.
Your task is to implement ... | codefeedback |
You are tasked with implementing a function to calculate the total number of occurrences of a specific word in a given C++ source code file. The function should take the file path and the target word as input and return the count of occurrences of the word in the file. The source code file may contain comments and the ... | codefeedback |
You are tasked with implementing a search and replace functionality for anchor names in a font editing software. The font editing software provides a macro window where users can execute predefined scripts to automate tasks. The given code snippet is a part of a Python script that is intended to perform a search and re... | codefeedback |
You are tasked with implementing a text scrolling and clearing functionality for a text-based user interface. The provided code snippet is part of a larger program that manages a window displaying text. The `clear` function is responsible for clearing the main display area within the window, while the `scroll` function... | codefeedback |
You are tasked with creating a program that simulates a simple command-line parser. The parser should be able to handle a set of predefined commands and their associated arguments. Your task is to implement the logic for parsing the command-line arguments and executing the corresponding commands.
You are given a code ... | codefeedback |
You are tasked with creating a Python script that processes a given Markdown file to extract specific information related to a software package. The script should read the content of the Markdown file, search for the relevant details, and then output the extracted information in a structured format.
Your script should... | codefeedback |
You are tasked with implementing a thread-safe singleton class in C#. The class should ensure that only one instance is created and provide a global point of access to that instance.
Your task is to complete the implementation of the `KeyValueCollection` class as a thread-safe singleton. The `KeyValueCollection` class... | codefeedback |
You are tasked with implementing a function that calculates the logarithm of an unsigned 8-bit integer. The function should take an unsigned 8-bit integer as input and return the logarithm of that number. You should handle the case where the input is zero and return a special value for that case.
Your task is to imple... | codefeedback |
You are tasked with implementing a class that represents a data buffer with a flushing mechanism. The class should have an `__init__` method that takes an interval (in seconds) and a flush function as parameters. The buffer should accumulate data and automatically flush it by calling the provided flush function at regu... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.