instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a Python function that processes a FASTA file containing DNA sequences and generates a BED file with information about the gaps in the sequences. The function should take the input FASTA file path and the output BED file path as arguments. The BED file should contain the genomic coordinates... | codefeedback |
You are tasked with creating a script to manage environment variables for the WESTPA (Weighted Ensemble Simulation Toolkit for Parallel Algorithms) package within a Conda environment. The script should set up environment variables when the Conda environment is activated and clean up the environment variables when the C... | codefeedback |
You are given a 10x10 grid representing a game board. Each cell in the grid can contain one of the following characters: '+', 'K', 'P', '#', 'D', '$', or a color code escape sequence. The color code escape sequences are represented as '\033[Xm', where X is a number representing a color. The grid is printed using the Py... | codefeedback |
You are working on a query strategy module for a machine learning system. The module uses a settings dictionary to determine the query strategy and its parameters. The code snippet provided is a part of the method that handles the query strategy settings. The method checks the query strategy specified in the settings a... | codefeedback |
You are tasked with implementing a function that processes different types of arguments based on their data type. The function takes in a list of arguments and their corresponding types, and based on the type, it performs specific operations to extract the argument value.
The function processes two types of arguments:... | codefeedback |
You are working on a deployment script for a cloud-based application. As part of the deployment process, you need to ensure that a private SSH key is securely copied to the appropriate directory, set with the correct permissions, and added to the SSH agent for authentication. Your task is to write a Bash script that ac... | codefeedback |
You are tasked with creating a program that manages dependencies for a package manager. The package manager uses a configuration file to define the products and dependencies of various packages. Each product can be a library or an executable, and it can have dependencies on other packages.
Your task is to implement a ... | codefeedback |
You are given a function that takes an integer `x` as input and returns a boolean value. The function is designed to check if the input integer `x` is a palindrome. A palindrome is a number that remains the same when its digits are reversed. For example, 121 is a palindrome, but 123 is not.
The function uses a while l... | codefeedback |
You are tasked with implementing a Python function that validates whether a given dictionary matches a specified pattern. The pattern is represented by another dictionary, where the keys represent the expected keys in the input dictionary, and the values represent the expected value types for those keys. Your task is t... | codefeedback |
You are tasked with implementing a comment classification system for a website. The system should be able to classify comments into different categories based on their content. You are provided with a code snippet that includes a method signature for classifying comments and a method signature for retrieving statistics... | codefeedback |
You are tasked with implementing a C++ template specialization for a type conversion utility. The given code snippet provides a partial implementation of a type conversion system using C++ templates. Your task is to complete the implementation by adding the necessary code to handle the conversion of specific types.
Yo... | codefeedback |
You are given a directed graph represented as an adjacency list and a starting node. Your task is to implement a breadth-first search (BFS) algorithm to traverse the graph and print the nodes in the order they were visited.
The graph is represented as a dictionary where the keys are the nodes and the values are lists ... | codefeedback |
You are tasked with creating a Python class that manages the installation of web drivers for different browsers. Your task is to implement the `EdgeDriverManager` class, which is a subclass of a base driver manager class. The `EdgeDriverManager` class should handle the installation of the Microsoft Edge web driver.
Th... | codefeedback |
You are working on a security system that manages access levels for different users. The code snippet provided is a part of a function that processes and validates input data related to access levels. The function takes a list `val` as input, where `val[1]` is a string representing a username and `val[2]` is the access... | codefeedback |
You are tasked with creating a program to generate a bar chart representing the sales statistics of different fruits. The program should use JFreeChart, a popular Java library for creating charts and graphs. The chart should be created in 3D and display the sales of various fruits. Additionally, the program should enco... | codefeedback |
You are given a Python code snippet that is part of a sliding window pattern matching algorithm. The algorithm is used to find all the starting indices of an anagram of a given pattern in a given string. The code snippet is responsible for updating the window's start and end positions and maintaining a character freque... | codefeedback |
You are tasked with creating a Python script that migrates bookmarks from a legacy system to a new system. The legacy system stores bookmarks in a text file, where each line represents a bookmark in the format "url|title|description". The new system requires the bookmarks to be stored in a JSON file with the following ... | codefeedback |
You are tasked with implementing a module resolution algorithm for a hypothetical JavaScript module system. The system uses a specific set of rules to resolve module imports and exports. Given a set of module import and export statements, you need to write a function that resolves the final set of exported modules base... | codefeedback |
You are tasked with implementing a Python class that simulates a simple client-server communication system. The provided code snippet includes a part of the client-side code, which attempts to receive a message from the server and handle potential errors. Your task is to complete the implementation of the `Client` clas... | codefeedback |
You are working on a program to generate reports for invoices. The code snippet provided is a part of the program that writes data to an Excel file. The program uses the `write` method of the `ws1` object to write data to specific cells in the Excel file. The code snippet contains conditional logic and involves writing... | codefeedback |
You are tasked with creating a Python function that handles HTTP requests and responses using the `requests` library and Flask. Your function should take in a Flask `request` object and a dictionary of HTTP methods and their corresponding functions. The function should make an HTTP request using the appropriate method ... | codefeedback |
You are tasked with creating a C# class that manages a simple inventory system for a small retail store. The class should allow adding, removing, and updating products in the inventory, as well as retrieving information about specific products.
Your task is to implement the `InventoryManager` class with the following ... | codefeedback |
You are tasked with implementing a class to represent a geometric shape called `SampleHolder`. The `SampleHolder` class should have a method `load_geometry` that takes in the dimensions of the shape and updates its internal state accordingly. Additionally, you need to write a test case to ensure that loading geometry t... | codefeedback |
You are tasked with creating a shell script to manage configuration files. The script should allow users to add or update key-value pairs in a configuration file. The script should handle both adding new key-value pairs and updating existing ones.
Your task is to complete the `add_config_value` function in the given s... | codefeedback |
You are given a Python code snippet that implements the merge sort algorithm. Your task is to complete the implementation by defining the `merge` function and then use the completed merge sort algorithm to sort a given list of integers.
Your task is to:
1. Complete the `merge` function to merge two subarrays of `arr`.... | codefeedback |
You are tasked with creating a program that analyzes a given text to check if it complies with a set of distribution conditions. The conditions are as follows:
1. Redistributions of source code must retain the copyright notice, list of conditions, and a specific disclaimer.
2. Redistributions in binary form must reprod... | codefeedback |
You are tasked with creating a Django view that displays a list of news articles along with their associated categories. The provided code snippet includes a partial implementation of the `NewsListView` class, which is intended to be a subclass of `ListView` and display a list of news articles with their associated cat... | codefeedback |
You are tasked with creating a Python program that parses a given Debian sources.list file and extracts relevant information from it. The sources.list file contains a list of package repositories and their corresponding configurations. Each line in the file represents a repository configuration in the format:
```
deb ... | codefeedback |
You are working on a computer vision project and need to implement a non-maximum suppression (NMS) algorithm for object detection. The NMS algorithm is used to filter out redundant bounding boxes based on their intersection over union (IoU) with respect to each other. You are given a code snippet that processes the out... | codefeedback |
You are tasked with creating a Python class that interacts with the LeetCode website to retrieve information about problems. Your class should be able to fetch the problem titles and difficulty levels from the website and store them for further processing.
Your task is to complete the `LeetcodeProblems` class by imple... | codefeedback |
You are tasked with implementing a generic function that takes a tuple and returns a new tuple containing the elements of the original tuple in reverse order. You are provided with a code snippet that defines a generic type `Tuple` and associated constants and traits.
Your task is to implement the function `reverse_tu... | codefeedback |
You are tasked with implementing a function that extracts and counts the occurrences of all unique classNames from a given JavaScript code snippet. The classNames are defined within the `className` attribute of JSX elements. The function should return an object mapping each unique className to its count.
For example, ... | codefeedback |
You are tasked with implementing a matrix factorization algorithm using Python and NumPy. The algorithm aims to factorize a given matrix `v` into the product of two matrices `w` and `h`, such that `v ≈ w * h`. The provided code snippet demonstrates the iterative update process for the feature matrix `h` and the weights... | codefeedback |
You are tasked with implementing a card game system that includes a class for watching the arena and tracking the hero's player class. The provided code snippet is a part of the system and sets the `hero` property of the `ArenaWatcher` class to the `playerClass` of a card.
Your task is to complete the implementation o... | codefeedback |
You are tasked with implementing a custom TensorFlow layer that performs a specific operation on two input tensors. The layer takes two input tensors, `left` and `right`, and a keyword argument `batch_size`. Your task is to create a custom layer that concatenates the input tensors along a new dimension and then reshape... | codefeedback |
You are tasked with implementing a simple caching mechanism using Python. Your task is to create a `Cache` class that stores key-value pairs and supports the `get` and `put` operations. The cache should have a maximum capacity and should evict the least recently used item when the capacity is exceeded.
You should impl... | codefeedback |
You are tasked with implementing a function that processes product IDs and generates corresponding file paths based on certain rules. The function should take into account the base IDs and utilize a utility function to fetch additional IDs if necessary. Your task is to complete the implementation of the function `gener... | codefeedback |
You are tasked with implementing a data structure called SmoothNumber that maintains a smooth average of the numbers it receives. The smooth average is calculated by taking the average of the last N numbers received, where N is a parameter provided during the initialization of the SmoothNumber.
You need to implement t... | codefeedback |
You are tasked with implementing a function that performs a specific operation on a table of cells. The table is represented as a two-dimensional array, and each cell contains a value. The function should take a table and a specific cell as input, and then perform a multiplication operation using the value of the cell ... | codefeedback |
You are tasked with implementing a Python function that converts a given JSON object into a backward-compatible format. The function should handle nested dictionaries and perform specific transformations on the keys. The transformation rules are as follows:
1. If a key's value is a dictionary, the key should be convert... | codefeedback |
You are tasked with implementing a sampling algorithm for a Bayesian Variational Autoencoder (B-VAE). The B-VAE model requires a proper mean code representation, but due to the unavailability of factor-pairs during lock-sampling, a new approach is needed. Additionally, you need to build a "sampled list" to keep track o... | codefeedback |
You are given a function `binary_operation` that takes a string `binary_string` as input. The function performs a series of operations on the input string and returns the result.
The function `binary_operation` processes the input string as follows:
1. It iterates through each character in the input string and counts ... | codefeedback |
You are tasked with creating a program that analyzes a given text to identify and count the occurrences of specific keywords. The program should read a text file and count the occurrences of each keyword in the file. Keywords are defined as specific words or phrases that are of interest for analysis.
Write a function ... | codefeedback |
You are tasked with creating a Python program to process a folder of images using an object detection model. The program should utilize the YOLO (You Only Look Once) object detection algorithm to detect objects within the images and create a new folder containing the processed images.
Your program should take the foll... | codefeedback |
You are given a Python code snippet that appears to be part of a machine learning algorithm. The code snippet includes a function `pla` which seems to implement the Perceptron Learning Algorithm (PLA) for binary classification. The function takes input data `x`, corresponding labels `y`, and an optional parameter `epoc... | codefeedback |
You are tasked with implementing a function to detect whether a given string represents a valid mathematical operation in a specific format. The format for a valid mathematical operation is defined as follows:
- The operation is enclosed within parentheses.
- The operation consists of an operator followed by operands, ... | codefeedback |
You are tasked with implementing a simplified version of a SlothComputation class in Python. The SlothComputation class is responsible for performing a computation loop based on the Sloth algorithm. The provided code snippet initializes the SlothComputation object and starts the computation loop. Your task is to create... | codefeedback |
You are tasked with creating a Python decorator that logs the execution time of a function. Your decorator should be able to handle both synchronous and asynchronous functions. You should also write a unit test to ensure that the decorator works as expected.
Your decorator should log the execution time of the function... | codefeedback |
You are given a string `s` consisting of uppercase English letters, where each letter represents a digit in base-26 numbering system. The mapping is such that 'A' represents 1, 'B' represents 2, and so on up to 'Z' representing 26. Your task is to write a function to convert the given string `s` into its corresponding ... | codefeedback |
You are tasked with implementing a class factory in Python that dynamically creates a new class based on an existing class. The class factory should take the existing class as a parameter and return a new class with additional functionality.
Your task is to create a Python function that takes the existing class and a ... | codefeedback |
You are tasked with creating a Python program to automate the process of scraping and processing lecture links from a specific webpage. The program should use the Selenium library to interact with a web browser and extract the lecture links from the page. Additionally, the program should print the processing status for... | codefeedback |
You are tasked with implementing a key-value store class in TypeScript. The class should provide methods for inserting, updating, selecting, checking existence, and deleting key-value pairs, as well as bulk operations for inserting, updating, and inserting or updating multiple key-value pairs.
Your task is to implemen... | codefeedback |
You are tasked with creating a Discord bot command that takes a code snippet as input, creates a new sourcebin, and sends the sourcebin URL back to the user. You will need to use the discord.js library to interact with the Discord API and the sourcebin library to create the sourcebin.
Your task is to complete the `cre... | codefeedback |
You are tasked with implementing a function to compare the values of pointers and return a specific result based on the comparison. The function should take in multiple pointers and compare their values with corresponding target pointers. If all comparisons are successful, the function should set two offset variables a... | codefeedback |
You are given a code snippet that involves the manipulation of mathematical expressions using variables and operations. Your task is to create a Python function that can evaluate a given mathematical expression represented as a nested structure of operations and variables.
You need to implement a function `evaluate_ex... | codefeedback |
You are tasked with implementing a class that manages friend presence and profile information in a social networking application. The class provides several methods for interacting with friend data. Your task is to create a method that retrieves the profile image of a friend and to implement a class that uses this meth... | codefeedback |
You are tasked with implementing a custom list adapter in Android that extends the `BaseAdapter` class. The provided code snippet serves as a starting point for the custom adapter. Your task is to complete the implementation of the `ListAdapter` class by adding necessary methods and functionality to support the display... | codefeedback |
You are tasked with creating a program that analyzes a given text file to count the occurrences of each unique word. For the purpose of this problem, a word is defined as a sequence of alphanumeric characters, excluding any punctuation or whitespace. The program should be case-insensitive, meaning that "Hello" and "hel... | codefeedback |
You are tasked with implementing a file transfer manager that handles the reception of files and error handling. The file transfer manager exposes two callback functions: `fileReceived` and `errorHappened`. Your goal is to create a class that utilizes these callbacks to manage the received files and errors.
You need t... | codefeedback |
You are tasked with creating a Python class that simulates a simple network switch. The switch should be able to handle incoming and outgoing network traffic between multiple hosts. Your task is to implement the `Switch` class with the following functionalities:
1. Initialize the switch with a given name and default n... | codefeedback |
You are tasked with implementing a resource management system for a service. The system needs to update the values of various resources based on the service's availability and buffer constraints. You are given a code snippet that demonstrates the usage of a function `update_resource_values` to update the resource value... | codefeedback |
You are working on a project that involves importing various architectures from a module called `architectures`. The `architectures` module contains different classes and functions for building neural network architectures. Your task is to create a program that dynamically imports these architectures based on user inpu... | codefeedback |
You are tasked with implementing a class hierarchy for handling vertex array objects in a graphics rendering engine. The code snippet provided is a part of a factory method that returns a specific implementation of a vertex array based on the chosen renderer.
The `Renderer::Implementation` enum class represents differ... | codefeedback |
You are tasked with creating a custom resource model for managing attachments in a Magento-based application. The resource model should handle operations such as saving and loading attachment objects. Your task is to implement the `_afterSave` and `_afterLoad` methods within the custom resource model class.
The `_afte... | codefeedback |
You are tasked with implementing a Python function that processes flow statistics and generates a formatted report. The function should take a list of flow statistics objects as input and produce a well-structured report displaying the flow name, received frames, and received bytes in a tabular format.
The flow statis... | codefeedback |
You are given a code snippet that appears to be part of a function that manipulates an array called `HexAlphabetReverse`. The code snippet is incomplete and contains some missing parts. Your task is to complete the function based on the given code snippet and the following requirements:
1. The `HexAlphabet` array cont... | codefeedback |
You are tasked with creating a Python class that manages the execution of various tasks based on a set of options. The class should construct a string based on the provided options and then perform the specified task.
You are given the following code snippet as a starting point:
```python
+ option["variableDe... | codefeedback |
You are tasked with implementing a resource management system for a data source in a multi-threaded environment. The data source provides access to various table functions, and it is essential to ensure that the resources are properly released after their usage to prevent memory leaks and resource exhaustion.
Your tas... | codefeedback |
You are working as a DevOps engineer for a company that is developing a microservices-based application. As part of your responsibilities, you need to manage and monitor various services running on Kubernetes clusters. One of the tasks involves obtaining the URLs for different services and their corresponding ports. Yo... | codefeedback |
You are tasked with implementing a function to parse and extract data from a file containing sprite information. The file contains data in the following format:
```
Sprite <name>
{
texture = <texture_name>
rect = <x>,<y>,<width>,<height>
<other_data>
}
```
Where:
- `<name>` is the name of the sprite.
- `<textur... | codefeedback |
You are tasked with implementing a custom neural network architecture for a specific application. The network will be used to classify images of handwritten digits from 0 to 9. To achieve this, you will need to create a multi-layer perceptron (MLP) using the `pylation` library, which provides tools for building and tra... | codefeedback |
You are tasked with implementing a function that calculates the total number of unique paths to reach the bottom-right corner of a grid from the top-left corner. You can only move either down or to the right at any point in time. The grid is represented as a 2D array where 1 indicates an obstacle and 0 indicates an emp... | codefeedback |
You are tasked with implementing a simple game simulation involving bots, humans, and agents. The game involves creating instances of these entities and equipping them with different types of guns. Your task is to create classes for `Bot`, `Human`, and `Agent`, as well as classes for different types of guns. Each entit... | codefeedback |
You are tasked with implementing a progress tracking system for a test framework. The system should monitor the collection of test items and display the progress in a visually appealing manner. The code snippet provided is a part of this progress tracking system, which uses the `pytest` library for Python.
Your task i... | codefeedback |
You are tasked with implementing a function to calculate the SHA-512 hash of a given input string using the OpenSSL library in C. The SHA-512 algorithm produces a 64-byte (512-bit) hash value. The code snippet provided declares an array `hash` of type `unsigned char` with a size of `SHA512_DIGEST_LENGTH`, which is a co... | codefeedback |
You are tasked with implementing a custom exception class in Python for handling signal events. Signals are a form of inter-process communication used in Unix-like operating systems to notify a process that a particular event has occurred. Your goal is to create a custom exception class called `SignalException` that wi... | codefeedback |
You are tasked with creating a Django model and admin interface for managing schedules of courses. The Schedule model represents the schedule for a particular course group on a specific day of the week, including the start and end times. The admin interface should allow easy management of these schedules, including the... | codefeedback |
You are given a snippet of code that is part of a mobile application's view controller. The code is responsible for setting up buttons and an image view based on the properties of a model object. Your task is to implement a function that calculates the height of an image view based on the width and aspect ratio of the ... | codefeedback |
You are tasked with implementing a Python function that performs softmax activation on a given set of predictions. Softmax activation is a common operation used in machine learning to convert raw predictions into probabilities. The softmax function takes a vector of arbitrary real-valued scores and normalizes it into a... | codefeedback |
You are given a set of soft constraints represented as function calls in the following format:
```
soft(weight, condition)
```
Where `weight` is a positive integer representing the importance of the constraint, and `condition` is a boolean expression involving absolute differences between variables. The goal is to dete... | codefeedback |
You are tasked with creating a Python program that simulates a simple task management system. The program should allow users to add, remove, and list tasks, as well as mark tasks as completed. The tasks should be stored in a list and displayed with their corresponding status (completed or pending).
Your task is to imp... | codefeedback |
You are tasked with implementing a custom iterator in Rust that generates Fibonacci numbers. 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. Your custom iterator should produce an infinite sequence of Fibonacci numbers.
Your task i... | codefeedback |
You are tasked with implementing a greedy algorithm for optimizing a target function in the context of a specific problem domain. The algorithm operates on a fine vector and requires an order parameter to determine its behavior. Your task is to design and implement the greedy algorithm to optimize the target function b... | codefeedback |
You are tasked with implementing a function that takes a string representing an HTML table and returns the table's data in a structured format. The input string will be in the following format:
```html
<table>
<tr>
<th>Header 1</th>
<th>Header 2</th>
</tr>
<tr>
<td>Data 1-1</td>
<td>Data 1-2</td>... | codefeedback |
You are tasked with implementing a function to parse and extract information from a C header file. The header file contains a set of convenience functions for logging messages in the context of OpenCL programming. Your goal is to extract the function names, parameters, and their types from the given code snippet.
You ... | codefeedback |
You are tasked with implementing a Python class that manages configuration widgets and their associated units. The class should allow for the addition of configuration widgets and their units, as well as the retrieval of these widgets and units. Additionally, the class should provide a method to display the configurati... | codefeedback |
You are tasked with implementing a migration tracking system for a database. The system should keep track of the current version of the database schema and allow for the execution of migration scripts to update the schema. Your task is to write a function that takes a list of migration scripts and applies them to the d... | codefeedback |
You are tasked with implementing a function to calculate the power of a given base to a given exponent using an iterative approach. The function should take two integer parameters, `a` and `b`, representing the base and the exponent, respectively. You need to complete the implementation of the `power` function, which s... | codefeedback |
You are tasked with creating a Laravel Eloquent model for a medical application that manages blog posts related to different diseases. The model should have relationships with the Menu and App models, and it should include custom query scopes to filter posts by disease and title.
Your task is to implement the Eloquent... | codefeedback |
You are tasked with implementing a custom iterable class in Python. The class should allow iteration over its internal data and return both the value and the index of each element when iterated over. Additionally, the class should raise an IndexError if an attempt is made to access an index beyond the length of the int... | codefeedback |
You are tasked with creating a Python program that simulates a simple message queue system using the Pika library. The program should implement a basic message producer and consumer, where the producer sends messages to a queue, and the consumer retrieves and processes these messages.
Your task is to complete the impl... | codefeedback |
You are tasked with creating a function that processes a given HTML code snippet to extract and manipulate certain attributes. The HTML code snippet contains an input element and a span element with conditional rendering based on a variable. Your task is to write a function that takes the HTML code as input and returns... | codefeedback |
You are tasked with implementing a function that processes a text corpus obtained from a file. The function should perform various text processing operations and return specific information based on the processed text.
You are provided with a Python function `test_corpus(get_text_from_file)` that takes a single argum... | codefeedback |
You are tasked with creating a script that sets environment variables for a specific project. The script should set the `LD_LIBRARY_PATH`, `LD_INCLUDE_PATH`, `C_INCLUDE_PATH`, `CPLUS_INCLUDE_PATH`, `INCLUDE_PATH`, and `PATH` variables to include the project's `lib` and `include` directories. Additionally, the script sh... | codefeedback |
You are given a Python code snippet that includes a list `l1` containing integer elements. The code snippet also includes a function `merge_sort` that sorts the list using the merge sort algorithm. The main function calls `merge_sort` to sort `l1` and then compares the sorted list with the result obtained from the buil... | codefeedback |
You are tasked with implementing a class that manages the timeout settings for a function. The class should have a property called `timeout` that allows getting and setting the timeout value for the function it manages. The timeout value should be stored in a private attribute `_function["timeout"]`. You need to implem... | codefeedback |
You are tasked with simulating a thermostat control system for a heating device. The system consists of a heater, a thermostat, and a temperature sensor. The heater's power can be adjusted to regulate the temperature, and the temperature sensor provides the current temperature. The goal is to maintain the temperature c... | codefeedback |
You are tasked with designing a generic interface for managing virtual folders in a file system. The interface includes properties and constraints for various types of virtual folder results. Your goal is to implement a class that adheres to this interface and provides functionality for managing virtual folders.
The i... | codefeedback |
You are tasked with implementing a simple task execution system using Python's `asyncio` library. The system will involve defining and executing asynchronous tasks using the `@task` decorator provided by the `api` module. The tasks will perform basic operations and interact with a parent task ID.
Your task is to creat... | codefeedback |
You are tasked with implementing a function that takes in a string representing a JSX code snippet and checks if the opening and closing tags for each JSX element are properly balanced. In JSX, elements are enclosed in angle brackets, and each opening tag must have a corresponding closing tag. The opening and closing t... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.