instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a script to automate the process of running a Python program within a virtual environment. The script should be able to activate the virtual environment and execute the Python program with specified arguments. Your task is to write a Bash script that accomplishes this automation.
Your Bash... | codefeedback |
You are tasked with implementing a tracking system for an e-commerce framework. The system should allow tracking of various events such as page views, clicks, and other user interactions. To achieve this, you need to create a class that implements the `TrackEventInterface` interface provided below.
```php
namespace Pi... | codefeedback |
You are tasked with creating a program that simulates a simple inventory management system for a small store. The program should allow users to add, remove, and display items in the inventory. Each item in the inventory will have a unique ID, a name, a quantity, and a price. The program should also provide the function... | codefeedback |
You are tasked with creating a script to manage network devices orchestrated using Containerlab. Containerlab is a tool for creating and managing container-based networking labs. The given code snippet is a part of a larger script that checks for the installation of Containerlab, installs it if necessary, and then retr... | codefeedback |
You are tasked with implementing a function to build a manual similarity map based on the given data. The data consists of a list of lists, where each inner list represents a topic or a service. The goal is to create a similarity map that associates topics with their corresponding services.
You need to implement the `... | codefeedback |
You are tasked with implementing a function that performs concurrent processing on a list of input data. The function should take advantage of Python's `concurrent.futures` module to process the input data in parallel. The input data consists of a list of dictionaries, each containing various parameters required for th... | codefeedback |
You are tasked with creating a program to compare two sets of CSV files and identify the differences between them. The input will consist of a series of commands and file paths, and your program should output the differences between the specified CSV files.
The input will contain the following types of commands:
1. `c... | codefeedback |
You are tasked with creating a script to automate the build process for a set of plugins in a game development environment. The script needs to iterate through a list of plugin libraries, create release directories, move compiled framework files, and copy configuration files to the release directories.
The provided co... | codefeedback |
You are tasked with creating a Django migration for a new model called `Product`. The `Product` model should have three fields: `name` (CharField), `price` (DecimalField), and `description` (TextField). Additionally, this migration should be dependent on the previous migration for the `OrderStatus` model, specifically ... | codefeedback |
You are tasked with creating a simple Android application that displays real-time data on a graph. The application should fetch data from a remote server and update the graph as new data arrives. You are provided with a code snippet that sets up the graph view and initializes a LineGraphSeries for displaying the data.
... | codefeedback |
You are tasked with implementing a unit test for a function that calculates the Kullback-Leibler (KL) divergence between two probability distributions. The code snippet provided is a part of a unit test written using the `assert` methods from a testing framework. Your task is to write the function `calculate_kl_diverge... | codefeedback |
You are tasked with implementing a multi-threaded program that simulates a simple ticketing system using semaphores. The program should consist of two types of threads: ticket sellers and ticket buyers. The ticket sellers will be responsible for adding tickets to the system, while the ticket buyers will attempt to purc... | codefeedback |
You are tasked with implementing a function that renders a stream of JSX elements based on a given context and options. The function `renderStream` takes two parameters: `fn` and `baseOptions`. The `fn` parameter is a function that takes a `RequestContext` object and returns a JSX element. The `baseOptions` parameter i... | codefeedback |
You are working on a text matching system that uses different types of matchers to compare strings. Each matcher type has a specific behavior for comparing strings. Your task is to implement a function that takes a matcher type and two strings as input and returns a boolean value indicating whether the comparison satis... | codefeedback |
You are tasked with creating a Python class that simulates a simple bank account. The class should have methods to deposit funds, withdraw funds, and check the current balance. Additionally, the class should have a method to display the account holder's information.
Your task is to implement the `BankAccount` class wi... | codefeedback |
You are tasked with implementing a genetic algorithm to solve the knapsack problem. The knapsack problem is a classic optimization problem where given a set of items, each with a weight and a value, determine the number of each item to include in a collection so that the total weight is less than or equal to a given li... | codefeedback |
You are tasked with implementing a caching mechanism for a web application. The caching system should support both absolute expiration and sliding expiration policies for cache entries. The absolute expiration policy removes the cache entry after a specified duration, regardless of whether it has been accessed or not. ... | codefeedback |
You are given a string `s` consisting of only the characters 'L' and 'R'. A balanced string is a string that has an equal number of 'L' and 'R' characters. You need to write a function `balancedStringSplit` to find the maximum number of balanced strings that can be formed by splitting the given string `s`.
For example... | codefeedback |
You are tasked with implementing a package dependency resolver for a software distribution system. The system manages packages and their relationships, and your goal is to write a function that resolves the dependencies between packages.
You are given a Python class `Package` with the following attributes and methods:... | codefeedback |
You are tasked with creating a Python function that plays a game to evaluate arithmetic expressions and determine if they equal 24. The game involves using the four basic arithmetic operations (+, -, *, /) to manipulate a set of four numbers to achieve a result of 24. Each number must be used exactly once, and the orde... | codefeedback |
You are tasked with implementing a simple user account management system in Swift. Your task is to create a `User` class that conforms to several protocols for secure storage. The `User` class should be able to store, retrieve, and delete user account information securely using the Locksmith library.
Your `User` class... | codefeedback |
You are tasked with implementing a CSV parser class in C++ that can handle parsing CSV files. The parser should be able to handle various scenarios such as parsing a file that does not exist, parsing a file with a specified delimiter, and handling errors appropriately.
Your task is to implement the `CsvParser` class w... | codefeedback |
You are working on a data preprocessing task for a time series dataset. The given code snippet is a part of the data preprocessing pipeline. The code uses the numpy library to manipulate the input data and prepare it for further processing. Your task is to complete the data preprocessing pipeline by implementing the mi... | codefeedback |
You are tasked with implementing a simple command-line application that simulates a basic banking system. The application should allow users to create accounts, deposit funds, withdraw funds, and check their balance. The application should be implemented using Rust programming language.
Your task is to implement the `... | codefeedback |
You are tasked with creating a program that analyzes a given text file to identify and count the occurrences of specific words. The program should read the text file, tokenize the words, and then count the occurrences of each word. Additionally, the program should exclude any words that appear in a predefined list of c... | codefeedback |
You are tasked with implementing a Swift protocol that defines the behavior of a router for handling self-payment request details within a mobile application. The protocol should include properties and methods to manage navigation, display, and user interaction related to self-payment requests.
The protocol, named `Se... | codefeedback |
You are tasked with creating a Python function that simulates a simplified version of a deep learning inference process. The function will take in a model, image size, and device as input and measure the time taken for the model to perform inference on a dummy image. The model is assumed to be an instance of a deep lea... | codefeedback |
You are tasked with implementing a class that manages context object registrations in a Spring-based application. The class should implement the `IContextConfigurator` interface, which encapsulates the registration of context objects. The `IContextConfigurator` interface has a single method `LoadObjectDefinitions` that... | codefeedback |
You are tasked with implementing a method to calculate the total distance traveled by a robot based on a series of movement commands. The robot can move in four directions: up, down, left, and right. Each movement command is represented by a single character: 'U' for up, 'D' for down, 'L' for left, and 'R' for right. T... | codefeedback |
You are tasked with implementing a custom authentication adapter factory in PHP. The factory is responsible for creating instances of an authentication adapter that will be used in an authentication system. The authentication adapter requires a dependency injection of the Doctrine entity manager obtained from the Servi... | codefeedback |
You are tasked with creating a Python function that analyzes a given string and provides information about the occurrences of the letter "a" within it. Your function should perform the following tasks:
1. Calculate the total number of occurrences of the letter "a" (both uppercase and lowercase) in the given string.
2. ... | codefeedback |
You are given a list of accounts, where each account is represented as a list of strings. Each account contains a name and a list of email addresses. It is guaranteed that each email belongs to exactly one account. You need to merge these accounts and return a list of accounts that represent the merged accounts. The ac... | codefeedback |
You are tasked with implementing a custom collection type in Rust that supports adding, removing, and iterating over elements. The collection should be able to store elements of any type and should provide methods to add elements, remove elements by value, and iterate over the elements in the collection.
Your task is ... | codefeedback |
You are tasked with creating a script to automate the process of adding new repositories to a GitHub organization. The script should take a list of repository names as input and set the remote origin URL for each repository to a specific GitHub organization using the provided credentials.
You are given a code snippet ... | codefeedback |
You are given a code snippet that involves the use of the Eigen library for linear algebra operations in C++. Your task is to create a programming problem that tests the understanding of Eigen library and its usage in a specific context.
Write a program that simulates a 3D transformation using Eigen library. You are g... | codefeedback |
You are tasked with implementing a thread-local configuration system for a multi-threaded application. The provided code snippet includes a simplified version of the configuration system, which allows setting a boolean option for tracing exceptions. The `EnvOption` class is used to define and manage configuration optio... | codefeedback |
You are working on a file management system and need to implement a function to recursively delete a directory and all its contents. The function should take the directory path as input and delete the directory along with all its subdirectories and files. You are not allowed to use any built-in functions or libraries t... | codefeedback |
You are tasked with implementing a Python function that processes a CSV file and generates an HTML table based on its contents. The function should take the file path as input and return a string containing the HTML representation of the CSV data.
The function should follow these requirements:
- Read the CSV file usin... | codefeedback |
You are tasked with implementing a macro in Rust that mimics the behavior of the `par_azip!` macro. The `par_azip!` macro is used to parallelize the assignment of values to elements in a mutable array based on operations performed on other arrays. Your goal is to create a similar macro that achieves the same functional... | codefeedback |
You are tasked with creating a Python program that processes a YAML file containing instructions for including additional files using the `!include` tag from the `pyyaml-include` library and variable substitution using `{{}}` placeholders. Your program should read the input YAML file, resolve any included files, perfor... | codefeedback |
You are tasked with creating a function that simulates the behavior of the `sendVerificationCode` method and its completion handler. The `sendVerificationCode` method takes a verification code as input and executes a completion handler with a success flag and optional data. The completion handler for `sendVerificationC... | codefeedback |
You are tasked with creating a Python class that processes test report data from an Allure report directory. The class should be able to extract and store information from various types of report files, including test result JSON files, test container JSON files, and attachment files. Your task is to implement the miss... | codefeedback |
You are tasked with implementing a music audition system that simulates auditions for different types of audiences. The system is designed to handle auditions for individual performers as well as for community performances. The provided code snippet is a part of the audition system and contains a conditional statement ... | codefeedback |
You are tasked with implementing a Java method that performs bitwise AND operations on different numeric data types. The method should take two parameters of type `Object` and return the result of the bitwise AND operation as an `Object`. The input parameters can be of type `Byte`, `Short`, `Integer`, or `Long`. The me... | codefeedback |
You are tasked with implementing a data migration process for a Core Data model in a Swift application. The given code snippet demonstrates the setup for the migration process, including creating a persistent store coordinator, adding a persistent store, setting up a managed object context, and saving the context. Addi... | codefeedback |
You are tasked with creating a command-line tool to manage the development workflow for a poetry application. The tool should support various commands for starting the development environment, migrating the database, and loading data for cards and poets.
Your task is to implement a Python script that processes the giv... | codefeedback |
You are tasked with creating a program that can manipulate file paths. Your program should be able to extract various components from a file path, such as the file name, file extension, and directory path.
Write a function `parseFilePath` that takes a file path as input and returns a dictionary containing the followi... | codefeedback |
You are tasked with creating a Python function that generates a command-line argument string for a neural style transfer program. The function should take in several parameters and construct a string that represents the command to be executed.
The function signature should be:
```python
def generate_style_transfer_com... | codefeedback |
You are tasked with creating a program that analyzes the frequency of words in a given text and returns the top N most frequent words. For the purpose of this problem, a word is defined as a sequence of alphanumeric characters, excluding any punctuation or whitespace.
Write a function `top_n_words(text: str, n: int) -... | codefeedback |
You are tasked with creating a Python function that dynamically loads and preprocesses image datasets based on the number of classes specified. The function should handle two scenarios: when the number of classes is 10 and when it is 100. The function should load the CIFAR-10 dataset if the number of classes is 10, and... | codefeedback |
You are tasked with implementing a simple chat application using TypeScript. The application will have a session engine that handles user authentication and channel management. Your goal is to complete the implementation of the session engine by adding the necessary functionality to authenticate users and manage chat c... | codefeedback |
You are tasked with implementing a function that processes user input to create a new post on a social media platform. The function takes in several parameters, including the post's body, the author's username, and additional metadata in JSON format. Your goal is to complete the function by handling the input validatio... | codefeedback |
You are tasked with creating a Python program to manage a library's database of books, authors, categories, awards, events, stands, editorials, and volunteers. The program should allow users to perform various operations such as adding new entries, updating existing ones, and displaying information.
Your task is to im... | codefeedback |
You are tasked with implementing a module dependency resolver for a software system. The system consists of various modules, each identified by a unique name. Modules can have dependencies on other modules, and it is essential to resolve these dependencies to ensure proper initialization and functioning of the system.
... | codefeedback |
You are tasked with implementing a Python decorator that logs the execution time of a function. The decorator should print the name of the function, its execution time, and the arguments passed to the function. You should also handle both positional and keyword arguments.
Your task is to complete the implementation of... | codefeedback |
You are tasked with creating a program that can analyze and extract key information from a given Chinese text. The program should be able to identify and count the occurrences of Chinese characters, English letters, digits, and special symbols in the text.
Write a function `analyze_text` that takes a Chinese text as i... | codefeedback |
You are tasked with implementing a module resolution algorithm for a JavaScript module system. The module system uses the `export * from 'module'` syntax to re-export all the named exports from another module. Your goal is to write a function that resolves the exports for a given module, taking into account the re-expo... | codefeedback |
You are given a 2D grid representing a game board. Each cell in the grid contains a non-negative integer representing the points that can be earned by placing a tile on that cell. The goal is to place tiles on the grid to maximize the total points earned, subject to the following constraints:
- Each tile covers a 2x2 s... | codefeedback |
You are tasked with implementing a custom decorator in Python that restricts access to certain views based on user roles. The decorator should be used to protect views in a web application, allowing only administrators or the original submitter of a resource to make changes.
Your task is to implement the `@role_requir... | codefeedback |
You are tasked with creating a PHP class that simulates a simple database seeder for a car dealership application. The seeder will be responsible for populating the database with sample data for the "marca" (brand) model. The "marca" model represents different car brands.
Your task is to implement the `MarcaSeeder` cl... | codefeedback |
You are tasked with creating a Python function that parses a given module docstring and extracts the platform and synopsis information. The module docstring is formatted in reStructuredText and contains metadata about the module.
You need to implement a function `parse_module_docstring(docstring: str) -> Tuple[str, st... | codefeedback |
You are tasked with implementing a function that processes a list of valid URLs and generates HTML code based on certain conditions. The function should take the following inputs:
- `validURL`: a list of strings representing valid URLs
- `includeQR`: a boolean indicating whether to include QR codes in the HTML output
-... | codefeedback |
You are tasked with implementing a backward function for attention score computation in a neural network. The attention score is calculated using the given `attn_query`, `attn_keys`, `bias`, and `linear_attn` tensors. The goal is to compute the gradients of the input tensors with respect to the `grad_output` tensor, wh... | codefeedback |
You are tasked with implementing a class for working with strings in a programming language that supports object-oriented programming. The class should extend another class called `Arr` and provide a method to convert a given string to lower-case.
Your task is to complete the implementation of the `Str` class by addin... | codefeedback |
You are tasked with creating a Python function that calculates the time interval between two dates and determines if the difference falls within specified upper and lower time intervals. The function should take two date columns as input and return the time interval in either hours (by default) or days, along with a fl... | codefeedback |
You are tasked with implementing a TypeScript function that validates the provided `ExecutionClientOptions` object based on certain criteria. The `ExecutionClientOptions` type is defined as a combination of `ExecutionClientConfig`, `k8s.Provider`, `string`, and `VolumeConfig`. Your task is to ensure that the `Execution... | codefeedback |
You are tasked with creating a function that retrieves a book from a database and checks if it exists and is not deleted. You are given a code snippet that uses asynchronous operations and MongoDB syntax as inspiration.
Write a function called `findBook` that takes in a `bookId` as a parameter and uses asynchronous op... | codefeedback |
You are tasked with implementing a function to overlay a smaller image onto a larger image with alpha blending. The function should take in the larger image, the smaller image, and the coordinates at which to place the smaller image. The alpha blending should allow for transparency in the smaller image, resulting in a ... | codefeedback |
You are tasked with reversing the tempering applied to outputs of the MT19937 pseudo-random number generator. The tempering process involves applying a series of bitwise operations to the generated random number. Your goal is to implement the `untemper` function that reverses this tempering process and recovers the ori... | codefeedback |
You are tasked with implementing a function that calculates the total length of all the lines added to a view in a given iOS application. The lines are added as UIViews with specific constraints, as shown in the code snippet below:
```swift
bottomToolView.addArrangedSubview(likeButton)
//line
let line = UIView()
line... | codefeedback |
You are working on a web application and need to import a style file located in a specific directory. The style file is located at a relative path from the current file. The code snippet provided attempts to import the style file using a relative path. Your task is to write a function that resolves the correct absolute... | codefeedback |
You are tasked with implementing a job scheduling system for a multi-threaded application. The system consists of a `JobQueue` class that manages a queue of jobs to be executed and a `Semaphore` class that controls access to the job queue.
The `JobQueue` class has the following methods:
- `insert(job)`: Inserts a job ... | codefeedback |
You are tasked with implementing a custom `compareTo` method for a class `Key` that extends `Collection` and contains elements of type `CharSequence`. The `compareTo` method should compare the elements of the calling `Key` object with the elements of another `Key` object passed as a parameter. The comparison should be ... | codefeedback |
You are tasked with implementing a simple asynchronous task scheduler in Rust. The task scheduler should allow users to schedule tasks to be executed on the next tick of the micro task queue. The micro task queue is a queue of tasks that are executed after the current task has finished, but before control is returned t... | codefeedback |
You are working on a project that involves geospatial data processing. Your task is to implement a function that converts coordinates from the World Geodetic System 1984 (WGS84) to the East-North-Up (ENU) coordinate system. Additionally, you need to prepare data for further processing by organizing it into a specific f... | codefeedback |
You are tasked with implementing a function to convert RGB color values to their corresponding hexadecimal representation. The function should take a tuple of three integers representing the red, green, and blue components of the color and return a string representing the hexadecimal color code.
You are given the foll... | codefeedback |
You are working on a text processing task and need to manipulate a given string according to specific rules. Your task is to write a function that takes a string as input and performs the following operations:
1. Convert the string to lowercase.
2. Replace all underscores ('_') with spaces (' ').
3. Capitalize the firs... | codefeedback |
You are tasked with implementing a function to write data to a sensor using the I2C protocol. The provided code snippet is a part of a class method `write` within the `GI::Sensor::Mpr121` class. The function takes two parameters: `reg`, an unsigned char representing the register to write to, and `data`, an unsigned cha... | codefeedback |
You are tasked with implementing a part-of-speech tagging system for natural language processing. Part-of-speech tagging involves labeling words in a sentence with their corresponding part of speech, such as noun, verb, adjective, etc. Your goal is to create a function that can accurately tag the parts of speech for a ... | 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 the program should randomly generate a choice for the computer. After both choices are made, the program should determine the winner and dis... | codefeedback |
You are tasked with implementing a simplified version of a hardware pen sign notifier in C#. The provided code snippet demonstrates a switch statement that calls different methods of the `DeviceChangeNotifier.hWPenSign` class based on the case value. Your task is to create a class `HWPenSign` and implement the methods ... | codefeedback |
You are tasked with implementing a custom iterator in Rust that chains together multiple iterators and then reverses the elements while also enumerating them. Your task is to create a struct `CustomChainRevEnumerate` that implements the `Iterator` trait and provides the functionality described.
Your `CustomChainRevEnu... | codefeedback |
You are tasked with implementing a simple user authentication system using Python. The system should include functionalities for signing up, signing in, signing out, updating user information, retrieving user information, and displaying user details. The code snippet provided imports these functionalities from separate... | codefeedback |
You are tasked with implementing a method to read the entirety of a stream and return its content as a string. The method should be able to handle various types of streams and should be efficient in reading and processing the stream data.
You are provided with the following code snippet as a starting point:
```csharp... | codefeedback |
You are tasked with implementing a CPU instruction builder for a simulated processor. The processor has a set of registers and flags that need to be manipulated based on the instruction being executed. The code snippet provided is a part of a unit test for the instruction builder.
The snippet first checks the state of... | codefeedback |
You are tasked with implementing a Python class that represents a trading calendar for the US stock market. The class should be able to determine whether a given date is a trading day or a holiday according to the predefined rules.
Your task is to complete the implementation of the `USTradingCalendar` class by adding ... | codefeedback |
You are tasked with creating a Python class that represents a resource with a template. The class should be immutable and inherit from `CUBEResource` and `abc.ABC`. Additionally, the class should have a `template` attribute that is initialized using an `InitVar` and a `__post_init__` method to perform any necessary pos... | codefeedback |
You are tasked with creating a Python function that validates a user's input for resetting a password. The function should ensure that the reset key is provided and that the two password fields match. You are given a code snippet from a test suite that uses a schema to validate the reset password data. Your task is to ... | codefeedback |
You are tasked with implementing a gene filtering algorithm that reads gene information from a TSV file, filters out specific genes based on a reference file, and writes the filtered gene information to a new TSV file.
You are given the following information:
- The variable `refgene` contains the path to a reference g... | codefeedback |
You are tasked with implementing a functional programming concept in TypeScript. Your goal is to create a function that composes two effects, `self` and `that`, to produce a new effect. An effect is a type that represents a computation that may fail with an error of type `E` or produce a value of type `A`. The `compose... | codefeedback |
You are tasked with creating a Python function that extracts the package name from a given code snippet. The package name is defined as the string following the last occurrence of the word "import" in the code snippet. If the code snippet does not contain any import statements, the function should return "No package im... | codefeedback |
You are tasked with implementing a function that simulates a simple memory allocator. The allocator should manage a fixed-size memory block and support allocating and freeing memory.
You are given a partial implementation of the memory allocator as follows:
```rust
pub struct SimpleAllocator {
memory: Vec<u8>,
... | codefeedback |
You are tasked with creating a Python function that processes a summary report and generates an HTML report based on a specified template. The function should handle cases where a custom template is provided as well as when no template is specified, defaulting to a standard template. Additionally, the function should u... | codefeedback |
You are tasked with creating a Python script that automates the process of building documentation, installing a package, and running tests based on the given code snippet. Your script should handle each of these tasks and provide appropriate feedback to the user.
Your script should perform the following tasks:
1. Buil... | codefeedback |
You are tasked with implementing a file parsing function that extracts specific information from a given file. The file contains a series of lines, each representing a software license agreement. Your goal is to extract the restrictions mentioned in each license agreement and store them in a structured format for furth... | codefeedback |
You are tasked with implementing a display control system for a device. The system consists of three classes: `DisplayData`, `DisplayControl`, and `DisplayCommands`. The `DisplayData` class defines the minimum and maximum length of data, the `DisplayControl` class specifies control commands, and the `DisplayCommands` c... | codefeedback |
You are tasked with implementing a custom data structure to efficiently store and retrieve PickerView titles for a given row and component. The PickerViewTitle data structure contains the necessary information for the title, such as the title string and any associated metadata.
Your task is to design and implement the... | codefeedback |
You are tasked with creating a test case for a Django application that manages podcast episodes. The provided code snippet is a starting point for the test case, which includes a setup method to create an episode object using the Episode model. Your task is to extend this test case by adding test methods to ensure the ... | codefeedback |
You are tasked with implementing a program to simulate the behavior of items in a shop, particularly focusing on the "Sulfuras, Hand of Ragnaros" item. In this simulation, the quality and sell-in value of items change over time according to specific rules. The "Sulfuras" item, however, has unique behavior compared to o... | codefeedback |
You are tasked with implementing a simple asset management system for a game using the Amethyst game engine in Rust. The system should be able to load, store, and retrieve various types of assets such as textures, sounds, and other resources.
Your task is to create a struct `AssetManager` that will manage the assets. ... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.