instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a function to send notifications using the Line Notify API. Line Notify is a web service provided by Line Corporation that allows you to send notifications to Line groups or chats. Your task is to complete the implementation of the `send_line_notify` function, which takes a message as i... | codefeedback |
You are tasked with implementing a function that processes regular expressions and returns a specific type of visitor handlers based on the flags present in the regular expression.
You are given a code snippet that includes a function `createVisitor` which takes a `regexpContext` object as a parameter. The `regexpCont... | codefeedback |
You are tasked with implementing a function that performs a join operation on two arrays of objects based on specified key mappings. The function should take in two arrays of objects and an object specifying the key mappings for the join operation. The key mappings object will have two properties: `from` and `to`, repr... | codefeedback |
You are working on a project that involves managing machine learning models on Google Cloud Platform (GCP). As part of this project, you need to create a Python function that handles the deletion of a machine learning model using the Vertex AI service. The function should take in the model name, project ID, location, a... | codefeedback |
You are tasked with implementing a quantum circuit simulator that can handle a specific set of operations. The circuit is defined by a series of quantum gates and templates, and the goal is to create a function that can generate the corresponding quantum circuit based on the given parameters.
You are provided with a c... | codefeedback |
You are tasked with implementing a service method for deleting a contract using Angular and RxJS. The provided code snippet is a method from an Angular service that makes an HTTP DELETE request to a specific API endpoint to delete a contract. Your task is to complete the implementation of the `del` method in the servic... | codefeedback |
You are tasked with implementing a generic method to compare two instances of a custom `MapSet` class. The `MapSet` class is a key-value mapping where keys are of type `TKey` and values are of type `TValue`. The method `MapEquals` should compare the current `MapSet` instance with another `MapSet` instance and return `t... | codefeedback |
You are working on a home automation system that controls various devices such as lights, thermostats, and security systems. The system is organized into modules, and you are responsible for integrating the lighting and scheduling modules. The code snippet provided imports the `lights` and `schedule` modules from the c... | codefeedback |
You are tasked with implementing a simple reflection-based method invocation system in C#. Your goal is to create a class that allows registering services and invoking methods on those services using reflection.
You are provided with a partial implementation of a `ReflectCallProvider` class, which is a subclass of `Ca... | codefeedback |
You are tasked with implementing a data processing algorithm that involves parsing and categorizing blocks of data. Each block of data is defined by a start and stop index, and may contain multiline values. Your task is to write a function that processes the data and categorizes it based on certain criteria.
You are g... | codefeedback |
You are tasked with implementing a function that takes in a string representing a tree structure and returns the maximum depth of the tree. The tree structure is represented using a custom format where each node is denoted by a pair of characters: an opening angle bracket `<` followed by a closing angle bracket `>`. Th... | codefeedback |
You are tasked with simulating a network packet forwarding system. The system consists of a server that receives packets and forwards them to their destination based on a predefined path. However, an attack scenario needs to be simulated where a valid packet is forwarded on a different path, causing the server to probe... | codefeedback |
You are tasked with creating a program that simulates a simple database seeding process. In database management, seeding refers to the initial population of a database with data. Your program should allow users to define the structure of the database and the data to be seeded. The seeding process should support multipl... | codefeedback |
You are tasked with implementing a URL routing system for a web application using Django. The given code snippet is a part of the URL configuration in a Django project. It includes the definition of URL patterns and their corresponding views using the `url()` function.
Your task is to create a function that takes a UR... | codefeedback |
You are tasked with simulating a simplified version of a process manager in a multi-threaded environment. The process manager is responsible for handling process creation and management. In this scenario, you are required to implement a function that searches for a specific process by name and returns its process handl... | codefeedback |
You are tasked with implementing a caching mechanism for a web application. The caching mechanism should support two modes: `Absolute` and `Sliding`. In the `Absolute` mode, cached items have an absolute expiration time, while in the `Sliding` mode, cached items have a sliding expiration time that is extended each time... | codefeedback |
You are tasked with implementing a custom callback function for a deep learning model training process. The callback function should monitor the training process and take specific actions based on the model's performance.
Your task is to create a callback function that tracks the validation accuracy during the traini... | codefeedback |
You are tasked with creating a Python script to automate the comparison of output files generated by a scientific computing application. The script should compare the contents of two directories containing output files and identify any differences. The comparison should be performed using specific scripts and tools pro... | codefeedback |
You are tasked with creating a program that simulates a simple message encryption and decryption system using a Caesar cipher. A Caesar cipher is a type of substitution cipher in which each letter in the plaintext is shifted a certain number of places down or up the alphabet. For example, with a shift of 3, A would be ... | codefeedback |
You are tasked with implementing a method to handle roster entries in an XMPP chat application. The `roster` object represents the user's contact list, and the `createEntry` method is used to add a new contact to the roster. The method takes three parameters: `jid` (the Jabber ID of the contact), `nickname` (the displa... | codefeedback |
You are tasked with implementing a simple virtual CPU that can execute a set of instructions. The CPU has a set of registers, and the instructions are provided in a custom assembly-like language. Your goal is to write a function that interprets the given assembly code and executes the instructions, updating the CPU's r... | codefeedback |
You are given a string `S` of length `N` and a positive integer `len`. Your task is to find the minimum length of a substring of `S` such that no duplicate substrings of length `len` exist within the original string `S`.
Write a function `minUniqueSubstringLength` that takes in the string `S` and the integer `len` as ... | codefeedback |
You are tasked with creating a Python class to manage financial transactions. The class should be able to handle both deposits and withdrawals, and provide functionality to retrieve transaction details and calculate the total balance.
Create a Python class `Transaction` with the following specifications:
- The class s... | codefeedback |
You are tasked with implementing a shopping cart system using React context. The given code snippet is a part of a React component that provides a context for managing the shopping cart state. The context includes functions for completing the checkout, updating the cart, adding a shipping method, and the total number o... | codefeedback |
You are given a code snippet from LLVM IR, a low-level programming language used as an intermediate representation in compilers. The comment `// CHECK-NEXT: ret i64 72057594037927936` indicates an expected output from the LLVM IR code. Your task is to write a program that generates the LLVM IR code that produces the gi... | codefeedback |
You are tasked with creating a Python function that retrieves the root path of a package or the current working directory if the package path cannot be found. The function should first attempt to obtain the path using the module's file attribute. If that is not available, it should then check the loader and handle case... | codefeedback |
You are tasked with creating a program that processes a given license file to extract specific information from it. The license file is formatted as a text file containing the license details. Each line in the file represents a separate detail of the license. The details include the license type, version, and any addit... | codefeedback |
You are tasked with creating a program that simulates the functionality of a code coverage test reporter. Code coverage is a measure used to describe the degree to which the source code of a program is executed when a particular test suite runs. The given code snippet is a command-line instruction that uses the Code Cl... | codefeedback |
You are working on a deployment script for a web application and need to automate the configuration of a server. The script is written in Bash and involves manipulating configuration files and starting a gem server. The code snippet provided is a part of the deployment script.
The script performs the following action... | codefeedback |
You are tasked with implementing a simplified event dispatcher for a system that processes events related to aggregates. An aggregate is a collection of domain objects that are treated as a single unit for data changes. Your goal is to create a method that adds event descriptors to a list for the current aggregate and ... | codefeedback |
You are tasked with implementing a function to find the geometry with the largest Singlet Fission (SF) rate in a molecular system. The given code snippet is part of a larger program and demonstrates the update of a progress bar, followed by the identification of the geometry with the highest SF rate and the extraction ... | codefeedback |
You are tasked with creating a Python function that simulates a simple web browser using the `selenium` library. Your function should take a URL as input, navigate to the specified webpage, and then assert the presence of a specific string in the webpage's title. If the string is found, the function should return `True... | codefeedback |
You are tasked with creating a Python class that represents a geometric shape. The class should have methods to calculate the area and perimeter of the shape. Additionally, the class should implement a custom `__repr__` method to generate a string representation of the object.
Create a class called `GeometricShape` wi... | codefeedback |
You are tasked with creating a Python class to represent SNMP sensors and implementing a method to add devices based on SNMP data. The SNMP sensor class should be able to store information about the host, port, community, base OID, sensor name, and unit. Additionally, you need to handle error indication and logging whe... | codefeedback |
You are tasked with implementing a pseudo-random number generator using the Tausworthe algorithm. The Tausworthe generator is a type of linear feedback shift register (LFSR) generator that produces a sequence of pseudo-random numbers. The code snippet provided initializes the Tausworthe generator with a global seed and... | codefeedback |
You are tasked with implementing a class that loads and processes configuration properties for a Swagger generator tool. The provided code snippet is the beginning of the `SwaggerGenerator` class, which is responsible for loading configuration properties and generating Swagger documentation.
Your task is to complete t... | codefeedback |
You are tasked with implementing a Python class for a linearithmic function, which is a function of the form f(x) = (mx + h)log_b(kx + a). The class should be a subclass of the provided `calculus.Function` class and should include an `__init__` method to initialize the function parameters. Additionally, you need to imp... | codefeedback |
You are working on an image processing project and need to implement a function that will stitch together a set of images into a single large image. The function takes a 4D numpy array `images` representing a collection of images, where `images.shape` is `(num_images, height, width, channels)`. You are also given a tup... | codefeedback |
You are tasked with implementing a Python class method for augmenting image samples. The method should take a sample object as input and perform a series of image augmentation operations on the image data within the sample. The sample object contains an image, sample ID, points, and a mask. Your task is to implement th... | codefeedback |
You are given a scenario where a chemical reaction is taking place. The reaction involves two chemical components, carbon (C) and oxygen (O). The reaction proceeds according to the following rules:
- If the amount of carbon (C) is at least half of the amount of oxygen (O), then the reaction can occur.
- When the reacti... | codefeedback |
You are tasked with implementing a function that sends different types of emails using the AWS Simple Email Service (SES). The function should be able to send welcome emails, password reset emails, and promotional emails based on the type specified in the event data. You are provided with a code snippet that includes a... | codefeedback |
You are tasked with creating a program that processes a list of dependencies and their versions and organizes them into a structured format. Each dependency is represented as a string in the format "dependency_name => dependency_name version", where the dependency name and version are separated by " => ". Your program ... | codefeedback |
You are tasked with implementing a simplified XML document parser that can perform basic querying and retrieval operations. The XML document is represented as a tree structure, with elements and attributes. Your parser should be able to handle queries based on element names, attributes, and text content.
You are given... | codefeedback |
You are tasked with creating a Python function that processes real-time order data and displays it in a specific format. The function should take a pandas DataFrame as input and output the formatted data using the `click` library. Additionally, the function should retrieve order logs using a context object and append t... | codefeedback |
You are tasked with creating a Python program that processes a given file to extract information about GitHub repositories and their stars. The file contains lines of code, and each line may or may not contain information about GitHub repositories and their stars. The format of the lines is as follows:
```
<gh_stars>mi... | codefeedback |
You are tasked with implementing an Access Control List (ACL) system for a web application. The ACL system is responsible for determining whether a user has permission to perform certain actions on specific resources. Your task is to create a class that manages the ACL rules and correctly enforces access control based ... | codefeedback |
You are tasked with creating a Swift program to manage a to-do list. The program should include a `TodoItem` struct and a `TodoItemParser` class to parse data into `TodoItem` objects. The `TodoItem` struct should have properties for `title`, `description`, and `dueDate`. The `TodoItemParser` class should have a method ... | codefeedback |
You are tasked with creating a Swift function that processes an array of integers and returns the maximum sum of a contiguous subarray within the input array. The function should be named `maxSubarraySum` and should take an array of integers as its input parameter. The function should return an integer representing the... | codefeedback |
You are tasked with implementing a function that calculates the average of an array of numbers, excluding the minimum and maximum values. Create a function called `calculateAverage` that takes an array of numbers as input and returns the average of the remaining numbers after excluding the minimum and maximum values.
... | codefeedback |
You are tasked with creating a Python function that processes test function names and file names to ensure consistency and conformity to a specific naming convention. The function should take in a test function name and file name, and then remove the "test_" prefix from both the function name and the file name. Additio... | codefeedback |
You are tasked with creating a program that processes a list of email addresses and extracts the domain names from them. The program should take a list of email addresses as input and return a list of unique domain names present in the input list.
Write a function `extract_domains(emails: List[str]) -> List[str]` tha... | codefeedback |
You are tasked with implementing a module resolution system for a JavaScript project. The project has several modules, each of which can export one or more named exports. Your goal is to create a function that resolves the module path and returns the exported named exports.
You are given a code snippet representing th... | codefeedback |
You are tasked with implementing a simple parser for a custom markup language. The parser should be able to handle opening and closing tags, as well as nested tags. Each tag is represented by a pair of angle brackets, with the tag name enclosed within the brackets. For example, `<b>` represents the opening tag for bold... | codefeedback |
You are tasked with creating a custom component for the Home Assistant platform called "Transactive Home". This component will be responsible for integrating with a transactive energy system and providing real-time energy consumption data to the Home Assistant dashboard.
To achieve this, you need to create a custom en... | codefeedback |
You are tasked with implementing a program that reads a text file and counts the occurrences of each word in the file. The program should then output the unique words along with their respective counts in descending order of frequency.
You are provided with a text file named "input.txt" containing a passage of text. E... | codefeedback |
You are given a Python code snippet that initializes an empty dictionary `words` and a string `strip` containing various characters. Your task is to write a function that takes a string as input and returns a dictionary containing the frequency of each word in the input string, while ignoring any characters specified i... | codefeedback |
You are given a Python code snippet that involves the use of NumPy arrays. Your task is to create a function that takes an array of NumPy arrays and transforms it into a new array of isometric lists. An isometric list is a list that has a fixed width and fills any remaining space with a specified fill value. The functi... | codefeedback |
You are tasked with creating a Gradle plugin that extends the XJC (XML to Java Compiler) functionality. The plugin should allow users to define and manage XML schemas for code generation. Your goal is to implement a method that adds a new XML schema to the XJC extension in the Gradle project.
You are provided with the... | codefeedback |
You are tasked with creating a custom HID (Human Interface Device) using CircuitPython. The custom HID device will be programmed to send specific key presses when activated. Your goal is to write a CircuitPython script that configures the custom HID device to send a sequence of key presses when a button is pressed.
Yo... | codefeedback |
You are given a C++ program that includes two header files, "reader.h" and "writer.h". The "reader.h" file contains a function `readData()` that reads data from a file and returns it, while the "writer.h" file contains a function `writeData()` that takes data as input and writes it to a file. Your task is to implement ... | codefeedback |
You are tasked with implementing a configuration management system for a software application. The system should allow users to define and manage various design patterns used within the application. Each design pattern consists of multiple components, and the system should provide functionality to add, remove, and retr... | codefeedback |
You are tasked with implementing a Swift function that processes a list of OAuth errors and constructs a response message based on the error codes. The OAuth errors are represented by an enum `OAuthError` with associated values for specific error details. The response message should be constructed according to the foll... | codefeedback |
You are tasked with implementing a class method `nid_done_editing` for a document editing application. The method should update the status of the document to indicate that the editing process is complete. Additionally, it should calculate the total time spent editing the document and update the document's metadata with... | codefeedback |
You are tasked with implementing a function to perform data augmentation on input tensors based on a given data format. The function should apply a sequence of augmentations to the input tensor and return the augmented output. Additionally, the function should ensure that certain properties hold true for the augmented ... | codefeedback |
You are tasked with creating a job listing application that allows users to search for job listings based on certain criteria. The application uses a server-side template engine to render the job listings on the front end. The code snippet provided is a part of the front-end template that handles the display of job lis... | codefeedback |
You are tasked with implementing a method to extract a specific value from an HTTP header. The HTTP header is represented as a string, and the method should return the value associated with a given header field.
You are given the following code snippet as a starting point:
```java
public class HttpHeaderParser {
... | codefeedback |
You are tasked with creating a C++ program that processes a given input string and performs a specific operation based on the input. The input string will consist of two parts: the first part will be a GitHub repository's star count, and the second part will be a C++ code snippet. Your task is to extract the star count... | codefeedback |
You are given a C++ code snippet for a function `shifted_binary_search` that performs a binary search on a shifted sorted array. The function takes in a vector `vec` of integers, the integer `n` to be searched, and the lower and upper indices `l` and `h` of the subarray to be searched. The function uses recursion to pe... | codefeedback |
You are given a list of bookings for a hotel. Each booking is represented by a tuple of three integers (i, j, k), where i is the starting room number, j is the ending room number, and k is the number of rooms booked. The hotel has n rooms numbered from 1 to n. Your task is to write a function that generates the occupan... | codefeedback |
You are working on a task management system that involves creating and managing tasks with various modifiers. One of the key features is the ability to turn a decorated generator function into a task and apply the `enqueue` modifier. Your task is to implement a TypeScript decorator that accomplishes this functionality.... | codefeedback |
You are given a list of integers representing the heights of buildings. Your task is to find the largest rectangular area that can be formed by the consecutive buildings. The width of each building is assumed to be 1, and the height of the rectangle is determined by the height of the shortest building within it.
Write... | codefeedback |
You are tasked with implementing a Python class that manages middleware exceptions and state data, while also allowing dependency overrides. Your goal is to create a class with specific attributes and methods to handle these functionalities.
You need to create a class called `MiddlewareManager` with the following attr... | codefeedback |
You are tasked with implementing a program that processes a list of integers and performs specific operations based on the input. The program should take a list of integers as input and perform the following operations:
1. Remove all duplicate integers from the list.
2. Sort the list in ascending order.
3. Calculate th... | codefeedback |
You are tasked with implementing a user registration system for a web application. The system should handle the registration of new users, including validation of user input and password matching. Your task is to write a function that performs the user registration process and handles any potential exceptions that may ... | codefeedback |
You are tasked with implementing a class that manages a collection of documents and connectors. Each document has a unique identifier, and each connector also has a unique identifier. Your task is to design a class that allows adding documents and connectors, as well as establishing connections between them. Additional... | codefeedback |
You are tasked with implementing a Python function that applies style transfer to an image using the given parameters. Style transfer is a technique that blends the artistic style of one image with the content of another. The function takes in various parameters to control the style transfer process. Your task is to co... | codefeedback |
You are given a list of integers `l` and an integer `n`. Your task is to write a function that finds and returns the closest integer to `n` in the list `l`. If there are multiple integers with the same closest distance to `n`, return the one that appears last in the list.
Function signature: `def closest_integer(l: Li... | codefeedback |
You are tasked with creating a Python function that simulates a simple banking system. The function should allow users to create accounts, deposit money, withdraw money, and check their balance. Additionally, the function should handle error cases such as insufficient funds and non-existent accounts.
Your task is to i... | codefeedback |
You are given a Python class representing a mathematical operation. The class has a method `__repr__` that returns a string representation of the class instance. Your task is to implement a method `calculate` that performs the mathematical operation and returns the result.
The class has the following attributes:
- `ca... | codefeedback |
You are tasked with creating a Python asynchronous function that simulates a message sending system. The function should handle the scenario where a message is sent, but the connection rejects the send request before the message is actually sent. You will need to implement the function and write a test case using the `... | codefeedback |
You are tasked with implementing a memory-efficient data structure to manage a list of renderers in a game engine. The game engine uses a custom memory management system that includes a pool for reusing memory. Your goal is to create a class that efficiently manages the list of renderers while utilizing the memory pool... | codefeedback |
You are tasked with creating a PHP function that processes a given HTML file and extracts all the text content within the `<div class="fill">` element. The function should return the extracted text content as a string. Assume that the HTML file is well-formed and contains the specified `<div>` element.
Your task is to... | codefeedback |
You are tasked with creating a program to scrape and download images from the webcomic site XKCD. The program should navigate through the webcomic pages, extract the image URLs, and save the images to a local directory. Your task is to implement the function `download_xkcd_images(num_images)` which takes an integer `nu... | codefeedback |
You are tasked with implementing a class that represents a mathematical expression and provides functionality to manipulate and evaluate the expression. The class should support the concept of a "This" property, which refers to the current expression, and a collection of values that the expression operates on.
Your ta... | codefeedback |
You are working on a Python templating engine that processes template files and generates output based on the provided data. The engine uses a class with various methods for parsing and processing the template content. One of the methods, `_make_node`, is responsible for creating a node object based on the input parame... | codefeedback |
You are tasked with implementing a TaskSuite class that manages a collection of tasks and provides methods for finishing the suite and generating a summary of the tasks. The TaskSuite class has the following methods:
1. `finish(status: str) -> str`: This method finishes the suite and returns the status of the suite ba... | codefeedback |
You are tasked with creating a Rust program that manipulates file paths and directories. Your program should perform the following tasks:
1. Create a directory structure based on the given environment variable.
2. Construct a file path within the created directory structure.
Your program should use the `env` and `pat... | codefeedback |
You are tasked with creating a Python function that emulates the functionality of the given shell command to clean out all Vim backup files within a specified directory and its subdirectories. The function should take a directory path as input and delete all files with names ending in "~".
The function signature shoul... | codefeedback |
You are working for a company that specializes in designing and building industrial tanks. Your task is to develop a program to calculate the initial capital expenditure (Capex) and fixed operational expenditure (Opex) for a given tank design. The company has provided you with the following mathematical model to calcul... | codefeedback |
You are given a list of integers representing the values of coins and a target value. Your task is to determine the number of ways to make up the target value using the given coins. You can use each coin an unlimited number of times.
Write a function `count_coin_combinations(coins: List[int], target: int) -> int` that... | codefeedback |
You are given a list of dependencies in the form of strings, where each string represents a dependency between two items. Your task is to write a function that determines whether the given dependencies form a valid ordering. A valid ordering means that for each dependency "A depends on B", the item A should appear afte... | codefeedback |
You are tasked with implementing a simple module loader for a JavaScript application. The module loader should be able to resolve and import modules based on their file paths. Each module is represented by a file, and the module loader should be able to handle both relative and absolute file paths.
Your task is to imp... | codefeedback |
You are given a list of tuples `friend_towns`, where each tuple contains two elements: the name of a friend and the name of a town they are visiting. Additionally, you are provided with a dictionary `home_to_town_distances`, which maps town names to their distances from the friend's home. The code snippet provided is i... | codefeedback |
You are tasked with creating a Python function that processes data from log files and generates visualizations based on the data. The function should read data from log files in a specified directory and then plot the data using matplotlib. The data to be read is related to ethical, adversarial, and irrelevant categori... | codefeedback |
You are tasked with creating a Python function that plots a task space with a boundary and a hole, and then adds an agent location to the plot. The task space is defined by a list of vertices representing the boundary and the hole. The boundary is a closed polygon, and the hole is represented as a list of vertices. The... | codefeedback |
You are tasked with creating a Python class to manage ride requests for a transportation service. The class should include methods to handle pickup and dropoff locations, acceptance status, and notification status. Your task is to implement the `RideRequest` class with the required methods and attributes.
Your `RideRe... | codefeedback |
You are given two strings, `word1` and `word2`. Your task is to merge the strings in a specific way to form the largest possible merged string. The merge process is as follows:
- If `word1` is empty, append the remaining characters of `word2` to the merged string and vice versa.
- If the first character of `word1` is g... | codefeedback |
You are given a Python function `merge(L1, L2)` that takes in two lists `L1` and `L2` as input and merges them into a single sorted list. The function first concatenates the two input lists and then uses the bubble sort algorithm to sort the merged list in ascending order. The sorted list is then returned as the output... | codefeedback |
You are tasked with creating a function that simulates the behavior of a simplified email verification process using JavaScript and jQuery. The function should take an email input and perform the following steps:
1. If the email is already verified, the function should update the text content of an element with the ID... | codefeedback |
You are tasked with implementing a function to convert a given integer into its Roman numeral representation. Roman numerals are represented by combinations of letters from the set {I, V, X, L, C, D, M}, where each letter corresponds to a specific value. The conversion follows a set of rules, such as subtractive notati... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.