instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with implementing a generic `TaskType` class template in C++. The `TaskType` class template is used to create task objects that can encapsulate a function or functor and its associated data. The `make_TaskType` function is provided to create instances of the `TaskType` class template. The `TaskType` cla...
codefeedback
You are tasked with creating a Python script to automate the evaluation of natural language processing systems using paired bootstrap resampling. The paired bootstrap resampling technique is commonly used to compare the performance of two systems on a given task, such as part-of-speech tagging or dependency parsing. Y...
codefeedback
You are tasked with creating a Python function that processes a list of dates and generates a payload for querying a repository. The payload should include a search query, sorting criteria, and a date range based on the input dates. Write a function `generate_payload` that takes in two parameters: - `date_list`: a lis...
codefeedback
You are working on a machine learning project and need to implement a cost computation function for a specific algorithm. The given code snippet is a part of the cost computation method in Python, which is used to calculate the cost associated with a particular class in the algorithm. The method takes in the parameter ...
codefeedback
You are tasked with creating a test case for a reactive programming application. The application uses a state machine and streams to handle inbound and outbound data. Your goal is to write a JUnit test case that ensures the proper termination of execution when an error occurs in the streams. Given the provided code sn...
codefeedback
You are tasked with creating a program that processes a list of email addresses and identifies any illegal characters present in the usernames. An illegal character is defined as any character that is not allowed in an email username, with the "@" symbol being a prime example. Your program should take a list of email a...
codefeedback
You are tasked with implementing a simple class in Swift to manage a list of tasks. The class should allow adding tasks, marking tasks as completed, and listing all tasks. Each task should have a description and a completion status. You need to implement the `TaskManager` class with the following requirements: 1. The ...
codefeedback
You are working on a build system for a software project and need to write a script to manage the generated images. The script needs to move certain files to a designated directory based on specific conditions. Your task is to implement a function that performs the required file operations based on the given conditions...
codefeedback
You are tasked with implementing a file synchronization system for a distributed file storage service. The system consists of a client application that interacts with a remote server to upload and download files. The client application uses a `FileSynchronizer` struct, which provides methods for writing files to the se...
codefeedback
You are working on a bioinformatics project and need to develop a program to process peptide-spectrum matches (PSMs) from a mass spectrometry experiment. Each PSM represents a match between an observed spectrum and a peptide sequence. Your task is to write a function that reads PSMs from a file and performs validation ...
codefeedback
You are tasked with creating a function that extracts the text content within the HTML tags of a given string. The function should return a list of all the text content found within the tags. For example, given the following HTML snippet: ``` <div class="container"> <div class="row"> <div class="col-xl-12"...
codefeedback
You are working on a serverless application using AWS SAM (Serverless Application Model) and need to automate the deployment process using AWS CLI commands. Your task is to create a script that automates the deployment of a serverless application to AWS using the provided code snippet as a reference. The deployment pr...
codefeedback
You are tasked with implementing a simple neural network model for classifying handwritten digits using the MNIST dataset. The MNIST dataset consists of 28x28 pixel grayscale images of handwritten digits (0-9). Your goal is to create a Python class, `MNISTModel`, that can train on the MNIST dataset and make predictions...
codefeedback
You are tasked with implementing a function to expand predicates with requirements into concrete lists of predicates. Predicates are defined in a permission map, and some predicates may reference other predicates using the `@requires` annotation. The goal is to convert each predicate clause to include its parent predic...
codefeedback
You are tasked with implementing a text rendering function for a user interface. The function should conditionally display the name and intensity of a data point based on the zoom level and other settings. The function should also handle multi-line rendering and adapt to the current theme. You are given the following ...
codefeedback
You are tasked with designing a C++ program that simulates a simple HTTP server request handler. The program should be able to handle incoming HTTP requests and process them based on a predefined configuration. Your task is to implement the `HttpServerRequestHandlerBase` class, which will serve as the base class for h...
codefeedback
You are tasked with creating a custom component for a web application that generates action buttons for different entities. The provided code snippet is a part of a Laravel Blade template, where the `@component` directive is used to include the custom component `admin.partials._action_buttons`. This component takes in ...
codefeedback
You are tasked with creating a program that will analyze a given text file to determine the frequency of each word in the file. Your program should read the text file, tokenize the words, and then count the occurrences of each word. Additionally, the program should ignore any punctuation marks and consider words in a c...
codefeedback
You are tasked with implementing a function that takes a string as input and returns the count of each unique word in the string. A word is defined as a sequence of characters separated by spaces. The function should ignore punctuation and treat uppercase and lowercase letters as equivalent. Additionally, the function ...
codefeedback
You are tasked with creating a Python function that takes a list of datetime objects and returns the average time of day across all the datetime objects in the list. The average time of day should be rounded to the nearest minute. The function should have the following signature: ```python def average_time_of_day(date...
codefeedback
You are tasked with implementing a data processing algorithm for analyzing animal behavior. The algorithm needs to crop specific time intervals around behavioral bouts detected in the data. The time intervals are defined by the parameters `PRE_INT_BT_S` and `POST_INT_BT_S`, which represent the duration in seconds befor...
codefeedback
You are working on a large-scale application that uses namespaces and imports various classes from different namespaces. Your task is to create a function that will analyze the given namespace and return the count of imported classes from a specific namespace. You are given a code snippet that represents the namespace...
codefeedback
You are working on a data processing system that involves mapping identifiers from one study to another. The system uses a function to determine whether an identifier should be modified based on a given mapping. The function takes an identifier object and a dictionary representing the mapping. The identifier object has...
codefeedback
You are tasked with implementing a function that processes a given JSON object and returns the value associated with a specific key. The JSON object may contain nested objects and arrays, and the key may be present at any level within the JSON structure. Your task is to write a function that can handle this complexity ...
codefeedback
You are tasked with creating a program that parses a given HTML snippet and extracts the contact information present in the "Contact Us" section. The contact information includes the email address, phone number, and any social media links. The HTML snippet is structured as follows: ```html <div> <h4>Contact Us</h4...
codefeedback
You are tasked with creating a custom Unity Visual Scripting node to calculate the factorial of a given number. 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. Your custom node should ...
codefeedback
You are tasked with implementing a retry policy for error message handling in a message consumer system. The system uses a consumer object with a channel for message processing. The consumer object has pre-defined methods for handling messages, including pre_handle, handle, and post_handle. Additionally, the consumer o...
codefeedback
You are working on a system that involves managing input/output (I/O) ports for a development board. The function `pt_dev_io_port_passthrough` is responsible for handling the passthrough of I/O ports between different components of the system. The function takes three parameters: `board_etree`, `scenario_etree`, and `a...
codefeedback
You are tasked with implementing a Python function to calculate the semi-major axis of a binary star system and the semi-major axis of a neutron star orbiting the binary system. The function `aNSeq` takes three parameters: `Mbh` (mass of the black hole), `Mns` (mass of the neutron star), and `Pb` (orbital period of the...
codefeedback
You are tasked with implementing a simple text-based menu system for a restaurant ordering application. The menu system should allow the user to view the menu, add items to their order, view their current order, and place the order. The menu items and their prices are predefined and should be displayed to the user. The...
codefeedback
You are tasked with implementing a class that manages file I/O operations and provides a callback mechanism upon completion. The class, `FileCallbackTest`, has a virtual method `OnFileIOComplete` that is called when a file I/O operation is finished. Additionally, the class has private member variables `id_`, `helper_`,...
codefeedback
You are tasked with implementing a graph constructor module for a machine learning library. The module should be capable of constructing graphs using various methods such as random walks, percentage-based connections, k-nearest neighbors (KNN), spatial relationships, and threshold-based connections. Each method has its...
codefeedback
You are tasked with implementing a custom Mean Squared Error (MSE) loss function in PyTorch. The Mean Squared Error is a common loss function used in regression problems to measure the average of the squares of the errors or residuals. Your task is to create a custom PyTorch module that computes the MSE loss given the ...
codefeedback
You are tasked with implementing a token parser for SPDX (Software Package Data Exchange) spreadsheet format. The SPDX format is used to document information on the origin and licensing of software packages. Your task is to create a Python class that can parse tokens from SPDX data and perform assertions on the tokens....
codefeedback
You are tasked with implementing a function to resize images and track the resizing process. The function `ResizeImage._resize_image` is used to resize an image to a specified size and then store the details of the resizing operation in a database. The code snippet provided includes a test case that verifies the correc...
codefeedback
You are tasked with implementing a Python module that provides functionality for working with IP addresses. The module should include a class called `IP` that allows for the manipulation and validation of IP addresses. The class should support the following operations: 1. Initialization with an IP address in the form o...
codefeedback
You are tasked with implementing a function to test a class that involves interacting with render frame hosts and render process hosts in a browser environment. The code snippet provided contains partial implementations of two functions: `CreateTab` and `GetMockRenderProcessHost`. Your task is to complete the implement...
codefeedback
You are tasked with creating a custom subclass of a UIView in Swift that incorporates a specific feature. Your custom view should display a series of concentric circles, each with a different color and radius. The number of circles and their properties should be customizable. Additionally, the view should be able to an...
codefeedback
You are tasked with implementing a Python class that performs image segmentation using a Fully Convolutional Network (FCN) with a ResNet backbone. The FCN_ResNet class should inherit from the nn.Module class in the PyTorch library and should have the ability to process input images using the specified ResNet backbone. ...
codefeedback
You are tasked with creating a Python program to monitor environmental conditions using sensors. The program should read data from UV, visible light, infrared, temperature, and humidity sensors and display the readings in a specific format. You have access to the following sensor readings and functions: - UV sensor: `...
codefeedback
You are tasked with implementing a function that processes memory-mapped I/O (MMIO) writes based on a given code snippet. The code snippet provided is a part of a larger program that performs MMIO writes to a hardware device. Your task is to create a function that simulates the behavior of the `dispatchWrite` function ...
codefeedback
You are tasked with implementing a class method for closing a purchase in an e-commerce system. The `closePurchase` method takes an array of conditions as input and updates the status of the purchase to indicate closure. Your task is to complete the `closePurchase` method in the `Purchase` class. The `closePurchase` m...
codefeedback
You are given a Python code snippet that initializes two variables `i` and `j`. Your task is to write a function that takes in a list of integers `nums` and returns the sum of all the elements in the list from index `i` to index `j-1`. If `i` is greater than or equal to `j`, the function should return 0. If `j` is grea...
codefeedback
You are tasked with implementing a function to validate email addresses according to a set of rules. An email address is considered valid if it meets the following criteria: - It is not null. - It may contain alphanumeric characters, dots, and the '@' symbol. - The local part (before the '@' symbol) must contain at lea...
codefeedback
You are tasked with creating a Rust program that handles file operations using asynchronous I/O. Your program should open a file, read its contents, and then print the contents to the console. You need to implement the necessary code to achieve this functionality. Your program should use the `async-io` feature, which ...
codefeedback
You are tasked with implementing a function to determine legal moves in a game. The game is played on a board of size `BOARD_SIZE` by `BOARD_SIZE`. The function `legalMove` takes in three parameters: `legalMove`, `qiAfterMove`, and `len`. The `legalMove` array stores the indices of legal moves, the `qiAfterMove` array ...
codefeedback
You are tasked with implementing a simple tokenization system for a programming language. The given code snippet represents a mapping of certain character sequences to token types. Each key-value pair in the snippet represents a character sequence and its corresponding token type. The token types are represented by the...
codefeedback
You are tasked with implementing a simple routing system for a web application using Python and FastAPI. The given code snippet is a part of the main application file and shows the inclusion of two separate routers, `admins_router` and `users_router`, into the main `router`. Each router is prefixed with a specific path...
codefeedback
You are tasked with creating a script that modifies a JavaScript file based on command-line arguments. The script should take in three arguments: service host and port, UI host, and UI port. It should then update a JavaScript file with the provided host and port information. The script should also validate the input ar...
codefeedback
You are tasked with implementing a function that calculates the total price of items in a shopping cart, taking into account any discounts that may apply. The function should accept a list of tuples, where each tuple represents an item in the cart. Each tuple contains the item name (a string) and its price (a float). A...
codefeedback
You are tasked with creating a Python function that processes and uploads a MaxMind DB file to an Amazon S3 bucket. The function receives a filename as input and is responsible for extracting the contents of a .tar.gz file, locating the .mmdb file within it, and then uploading the .mmdb file to the specified S3 bucket....
codefeedback
You are tasked with implementing a statistical hypothesis test for comparing two receiver operating characteristic (ROC) curves. The null hypothesis is that the two ROC curves are identical, while the alternative hypothesis is that one ROC curve is greater than the other. Your goal is to write a function that performs ...
codefeedback
You are tasked with creating a program that processes data from a CSV file containing information about employees. Each row in the CSV file represents an employee and contains the following fields: employee ID, name, department, and salary. Your program needs to handle cases where the department field is empty and perf...
codefeedback
You are tasked with creating a Python script that injects code from a shell script file into a pickle file. The script should take two command-line arguments: the path to the pickle file and the path to the shell script file. The injected code should be appended to the pickle file without altering its existing content....
codefeedback
You are tasked with implementing a custom error-handling mechanism for a simple calculator program. The calculator should support addition, subtraction, and multiplication operations on 8-bit signed integers. However, due to the limited range of 8-bit integers, overflow and underflow errors may occur during these opera...
codefeedback
You are tasked with creating a Python function that processes a list of fees and updates their status in a database. The function should take in a list of fees, each represented as a dictionary with the following keys: "name", "company", and "status". The function should update the status of each fee in the database to...
codefeedback
You are tasked with implementing a program to manage different encryption schemes. Each encryption scheme has a unique name and properties associated with it. Your task is to create a Rust program that allows users to add new encryption schemes, retrieve the properties of a specific scheme, and list all available schem...
codefeedback
You are tasked with creating a Python class that manages environment variables and provides methods to manipulate and retrieve them. Your task is to implement the `EnvironmentManager` class with the following specifications: - The class should have an `__init__` method that initializes an empty dictionary to store env...
codefeedback
You are tasked with creating a program to analyze the results of a series of AI vs. human games. The program should read a CSV file containing the game results and calculate statistics based on the data. Each row in the CSV file represents a game and contains the following columns: 'AI' (the name of the AI), 'win' (ind...
codefeedback
You are tasked with creating a program to manage a database of vaccinated individuals. The program should allow users to add new vaccinated individuals, remove existing records, and display the total number of vaccinated individuals. To achieve this, you need to implement a class called `VaccinationDatabase` with the f...
codefeedback
You are tasked with creating a server monitoring system that updates the state of a server based on the termination status of a ping operation. The termination status is represented by an integer value, and the server state is updated according to the following rules: - If the termination status is 0, the server state ...
codefeedback
You are tasked with creating a Python program that simulates a simple game of rock-paper-scissors. The program should prompt the user to input their choice (rock, paper, or scissors), and then randomly generate a choice for the computer. After both choices are made, the program should determine the winner based on the ...
codefeedback
You are tasked with creating a program that compares two files and identifies the differences between them. The program should take two file names as input and output the differences between the files in a human-readable format. Write a function `file_diff` that takes two file names as input and prints the differences...
codefeedback
You are tasked with implementing a Python class that generates unique sequential numbers for different categories. The class should allow for the creation of multiple instances, each responsible for numbering a specific category. The numbering should start from 1 for each category and increment by 1 for each subsequent...
codefeedback
You are tasked with creating a Python function that disassembles a given code object and returns a dictionary containing the line numbers for each bytecode instruction. The disassembled code object will be provided as an argument to the function. The bytecode instructions will be represented as strings, and the line nu...
codefeedback
You are given two binary strings, `a` and `b`, which represent non-negative integers. Your task is to write a function to return the sum of these two binary strings as a new binary string. For example, given `a = "11"` and `b = "1"`, the function should return `"100"`, as `11 + 1 = 100` in binary representation. Writ...
codefeedback
You are tasked with designing a URL routing system for a web application using Python's Django framework. The application needs to handle different types of requests for text and audio processing. Your task is to create a set of URL patterns that map to specific views for text analysis, translation, audio analysis, and...
codefeedback
You are tasked with implementing a simple coordinator pattern in Swift. The coordinator pattern is commonly used in iOS applications to handle navigation and flow control. A coordinator is responsible for managing the navigation and presentation of view controllers, allowing for better separation of concerns and improv...
codefeedback
You are tasked with writing a program to analyze a given HTML file and count the occurrences of specific HTML tags within it. The HTML file contains a series of nested `div` elements, and you need to count the occurrences of the `div` tags with specific class names. Write a function `countDivOccurrences(html, classNam...
codefeedback
You are tasked with implementing a class method to compute the Gamow factor for a nuclear reaction. The Gamow factor is a crucial parameter in nuclear astrophysics, representing the probability of two atomic nuclei overcoming the Coulomb barrier and undergoing a nuclear reaction. The formula for the Gamow factor involv...
codefeedback
You are tasked with implementing a Python function that processes a given manifest file and performs various operations based on the attributes specified in the manifest. The function should handle attribute validation, database interaction, cleanup operations, and key string processing. Additionally, it should check f...
codefeedback
You are given a Python function that takes in two input parameters: `m1` and `m2`. The function is supposed to perform a specific operation and return a result. However, the given code snippet is incomplete and contains a bug. Your task is to understand the intended functionality of the code, identify the bug, and fix ...
codefeedback
You are tasked with implementing a class that manages intervals and wait periods for a recurring task. The class should provide methods to set the interval and wait period, and handle the execution of the task at regular intervals. The provided code snippet is part of the class and includes a method to set the interval...
codefeedback
You are tasked with implementing a Python class that manages live game data and timestamps for game patches. The class should provide methods to update the game data and timestamps, as well as retrieve the latest game data and timestamp. You are given a code snippet that initializes two class attributes: `liveGameDiff...
codefeedback
You are working on a project to analyze and visualize waveforms using Python's matplotlib library. As part of this project, you need to create a program that generates and saves a plot comparing two normalized waveforms. The code snippet provided is a part of this program and includes the plotting and saving functional...
codefeedback
You are tasked with creating a script to automate the installation process of a C++ logging library called g3log. The script should perform the following steps: 1. Remove the directories named "g3log-install" and "g3log" if they exist. 2. Create a new directory named "g3log-install" and navigate into it. 3. Clone the g...
codefeedback
You are tasked with implementing a Python function to perform a merge sort on a given list of integers. Merge sort is a divide-and-conquer algorithm that recursively divides the input list into smaller sublists until each sublist contains only one element. It then merges these sublists in a sorted manner to produce the...
codefeedback
You are tasked with creating a custom test attribute system for a testing framework. The framework should allow developers to annotate their test classes and methods with custom attributes to provide additional metadata and behavior for the tests. Your task is to implement a custom test attribute called `SystemTestAtt...
codefeedback
You are tasked with implementing a subscription management system for a streaming service. The system should allow users to subscribe to various content categories and receive notifications when new content is added to those categories. You are provided with a code snippet for the `SubscriptionManager` class, which inc...
codefeedback
You are tasked with implementing a Hierarchical State Machine (HSM) in Python. A Hierarchical State Machine is a design pattern used to model the behavior of an entity that can be in one of a number of distinct states, and can transition between those states based on certain events. The provided code snippet is a part ...
codefeedback
You are working on a compiler optimization tool for a parallel computing framework. One of the optimizations you are implementing is vectorization, which aims to improve the performance of tasklets within a map by aligning memory accesses with the inner-most loop variable. The vectorization matches when all the input a...
codefeedback
You are tasked with creating a script that processes a list of GitHub repositories and retrieves their star counts within a specified range. Your script should output the repositories along with their star counts that fall within the given range. Write a Python script that accomplishes the following: 1. Accepts a rang...
codefeedback
You are tasked with implementing a simplified version of a Python interpreter for a custom programming language. The given code snippet is part of a larger interpreter implementation and contains methods for converting various operations on objects. Your task is to implement the `convert_method_call` method, which tak...
codefeedback
You are tasked with creating a user interface management system for a software application. The system should handle different states and adjust the visibility and titles of various views accordingly. You are given a code snippet that demonstrates the behavior for three different states: `UserManagement`, `PluginManage...
codefeedback
You are tasked with developing a Python script to automate the computation of coverage in bigWig and/or bedGraph format from an input BAM file. The script should utilize the argparse module to handle command-line arguments and provide flexibility in specifying input parameters. The coverage computation will involve gen...
codefeedback
You are working on a data processing script that involves writing data to a CSV file. The script uses the `csv` module in Python to write a dictionary of data to a CSV file. However, you notice that the script seems to be taking longer than expected to complete the writing process. You suspect that the `csv.DictWriter`...
codefeedback
You are working on a game development project and need to write a script to handle game level configuration and file management. The game has multiple levels, each with different capabilities and templates. Your task is to create a Python function that performs the following tasks: 1. Iterates through the first 20 gam...
codefeedback
You are given a string containing a software license text. Your task is to write a program to extract the URL of the license from the given text. Write a function `extract_license_url` that takes a string `license_text` as input and returns the URL of the license if found, or an empty string if no URL is present. The...
codefeedback
You are tasked with implementing a Python function that processes a list of test results and aggregates them based on certain criteria. The function should take into account the possibility of reruns for failed tests and should aggregate the results accordingly. You are given a code snippet from a test suite that uses...
codefeedback
You are tasked with creating a program that simulates a simple game of rock-paper-scissors. The game should allow a user to input their choice (rock, paper, or scissors), and then randomly generate a choice for the computer. The program should then determine the winner based on the standard rules of rock-paper-scissors...
codefeedback
You are given a string `s` consisting of lowercase English letters. Your task is to write a function `countConsecutiveChars` that counts the number of consecutive characters in the string and returns a list of tuples where each tuple contains a character and its consecutive count. The function signature is: ```python ...
codefeedback
You are tasked with implementing a conflict detection algorithm for horizontal line segments in a routing system. The system has a set of parameters that influence the conflict detection process. The conflict penalty for overlapping line segments is defined as CONFLICT_PENALTY = 16. The parameters include: - routingStr...
codefeedback
You are tasked with implementing a Prolog program to manage a database of people and their ages. The program should allow for the addition of new people and their ages, as well as the ability to query and update the ages of existing people. The program should also provide a way to display the log of all operations perf...
codefeedback
You are tasked with creating a program that extracts Python method definitions from a given source file and generates a new file based on a set of inclusion and exclusion rules. The program should read a configuration file that specifies which files to include, as well as a whitelist and blacklist for method definition...
codefeedback
You are tasked with creating a Python script that simulates a simplified version of a file system. Your script should implement a basic web-based file server using the ASGI protocol. The server will allow users to interact with files and directories through web-based Distributed Authoring and Versioning (WebDAV) method...
codefeedback
You are tasked with implementing a downloader program that interacts with a user prompt for solving captchas. The provided code snippet sets up the downloader and registers a signal handler for interrupt signals. Your task is to create a class for the downloader and implement the necessary methods to handle captcha sol...
codefeedback
You are tasked with creating a program that simulates a simple multi-threading scenario. The program should create a specified number of threads, each of which will perform a specific task. Once all the threads have completed their tasks, the main program should print a message indicating that the threads have finished...
codefeedback
You are tasked with creating a Bash script that processes a list of files and performs specific operations on them. Your script should handle potential errors during file processing and provide appropriate error messages. Your script should accept a list of file paths as command-line arguments. For each file, it shoul...
codefeedback
You are tasked with creating a command-line tool for sending test emails to check email templates. The tool should be able to send test emails using different email templates to ensure that they are rendering correctly. Your task is to implement the `TestEmailsCommand` class, which will handle the sending of test email...
codefeedback
You are tasked with implementing a custom safe floating-point arithmetic library using C++ and the Boost library. The library should handle various policies for checking addition operations, such as overflow, underflow, inexact results, and invalid results. Your goal is to create a class that encapsulates the safe floa...
codefeedback