instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a function to send an email notification from Zendesk to a Slack channel when a specific event occurs. The function `email_from_zendesk` takes three parameters: `event`, `slack_client`, and `zendesk_client`. The `event` parameter represents the event triggering the email notification, t... | codefeedback |
You are tasked with creating a Python class to manage employees in an organization. The class should have the following functionalities:
1. Initialize the employee with their details.
2. Allow the manager to input a list of employees under them.
3. Display the details of the manager and the employees under them.
You ... | codefeedback |
You are tasked with implementing a program that reads a sequence of integers from the command line arguments and calculates the sum of all the even numbers in the sequence. The program should ignore any non-integer command line arguments and consider only the valid integers for the sum calculation.
Your task is to com... | codefeedback |
You are tasked with implementing a custom output buffering mechanism in C++. The provided code snippet contains a partial implementation of a custom output buffering system using the `std::ostream` class and namespaces. Your task is to complete the implementation of the custom output buffering system by defining the mi... | codefeedback |
You are working on a project that involves optimizing a system using different algorithms. One of the key steps in the optimization process is to perform a QR decomposition on a given matrix. The QR decomposition is a factorization of a matrix into an orthogonal matrix Q and an upper triangular matrix R. Your task is t... | codefeedback |
You are tasked with creating a Python function that analyzes a given Django project's URL configuration and returns a list of all the views that are included in the project. The URL configuration is provided as a list of tuples, where each tuple represents a URL pattern and its corresponding view function.
You are giv... | codefeedback |
You are tasked with creating a Python unit test for a volume group snapshot creation function. The function takes in various options and should be tested to ensure that it interacts with the necessary mocks and asserts the expected behavior.
Write a unit test for the `volume_group_snapshot_create_with_options` functio... | codefeedback |
You are working on a simulation system for a mining company. The system includes a class called `Simulator` that is responsible for simulating various scenarios related to the mining operations. The `Simulator` class has a method called `simulate` which takes a scenario generator as input and returns the simulation res... | codefeedback |
You are tasked with implementing a program that takes command-line arguments and performs a specific operation based on the input. The program should accept two command-line arguments: a string representing an operation and a number on which the operation will be performed. The program should support the following oper... | codefeedback |
You are tasked with implementing a file system utility in Python. The utility will involve creating a class to handle file operations within a directory. The provided code snippet outlines a `FileSection` class with some methods that need to be implemented. The `DIRTYPE` constant is also defined as 'dir'.
Your task is... | codefeedback |
You are tasked with implementing a function that processes data from a sensor network to identify specific events. The sensor network consists of multiple nodes, each generating timestamped data. The data is stored in a 2D NumPy array `G`, where each row represents a node and each column represents a timestamp. Additio... | codefeedback |
You are tasked with implementing a Python class that manages Docker containers for a Supervisor DNS service. The class, named `DnsManager`, has several methods and properties related to managing Docker containers. Your task is to complete the implementation of the `DnsManager` class by filling in the missing parts of t... | codefeedback |
You are tasked with implementing a priority queue system for a server that processes network latency quality checks (NLQCs). The server has a function `run_next_in_queue` which takes an NLQC as input and processes it. The function also takes an optional `timeout` parameter, which specifies the maximum time the server s... | codefeedback |
You are working with a dataset containing behavioral metrics of mice in a research lab. The code snippet provided is part of a data processing pipeline to create a dataframe with behavioral metrics for all mice. The snippet iterates through each mouse's data, retrieves relevant behavioral information, and stores it in ... | codefeedback |
You are tasked with implementing a ConstrainedAdvPoisoningGlobalExport algorithm for a machine learning model. The algorithm takes in several parameters, including delta, s, clst_model, lb, and G. Your task is to write a function that takes these parameters and performs the ConstrainedAdvPoisoningGlobalExport algorithm... | codefeedback |
You are tasked with implementing a function to generate unique identifiers using the given code snippet as a reference. The `gen_trid` function is designed to create a random string of a specified length using a predefined character set `TRID_CSET`. The character set includes digits (0-9) and lowercase and uppercase le... | codefeedback |
You are working on a deployment script for a secure application that involves handling encrypted files. Your task is to write a Python function that simulates the decryption process of the encrypted file `secrets.tar.enc` using the provided encryption key and initialization vector (IV). The function should decrypt the ... | codefeedback |
You are working on a WordPress plugin that integrates with the Zopim live chat service. The code snippet provided is part of a larger PHP class that handles the plugin's settings and options. The `update_option` function is used to update a specific option in the WordPress database, and the `add_notice` method is used ... | codefeedback |
You are tasked with implementing a function that borrows the standard input/output (stdio) and performs an operation on it. The function `borrow_stdio` takes two generic parameters: `F`, a closure or function, and `T`, the return type of the closure or function. The function signature is as follows:
```rust
pub fn bor... | codefeedback |
You are tasked with implementing a class for a modified YOLOv3 model. The YOLOv3 model is a popular object detection algorithm, and in this case, it uses Darknet 53 as the default backbone. Your task is to complete the implementation of the `__init__` method of the YOLOv3 class, which takes in two parameters: `depth` a... | codefeedback |
You are tasked with implementing a class that parses YAML configuration files and provides methods to access and modify the configuration settings. The class should be able to handle both file-based and string-based YAML configurations.
Your task is to complete the implementation of the `Yaml` class, which has two con... | codefeedback |
You are working on a time-series database system and need to implement a function to parse query results. The function `Parse` takes several parameters including a pointer to `QueryResults`, an index `idx`, a pointer to `tsdb::label::Labels` `lset`, a vector of `tsdb::label::Labels` `lsets`, a pointer to `uint64_t` `id... | codefeedback |
You are given a list of expenses incurred by a group of individuals. Each expense is a positive integer. Your task is to find the two expenses that sum up to a specific value. You need to write a function that takes the list of expenses and the required sum as input and returns the two expenses that satisfy the conditi... | codefeedback |
You are tasked with creating a function that simulates the process of generating a new user ID for a website. The function should take a string representing the initial user ID and apply a series of transformations to produce the final user ID. The transformations are based on a set of rules specified below.
Rules for... | codefeedback |
You are tasked with creating a program to manage a library's book borrowing system. The library has a collection of books, each identified by a unique ISBN (International Standard Book Number). The program should allow users to borrow and return books, as well as check the availability of a specific book.
Your task is... | codefeedback |
You are tasked with creating a Python function that processes a given directory and its subdirectories to find all files that contain a specific keyword in their content. You should also handle the case where the keyword contains regular expression metacharacters.
Write a function called `find_files_with_keyword(direc... | codefeedback |
You are tasked with implementing a class hierarchy for web components in a TypeScript project. The provided code snippet is a partial implementation of a core HTML component in TypeScript. Your task is to complete the implementation by defining the required properties and methods for the `CoreHtmlComponent` class and i... | codefeedback |
You are tasked with implementing a function to convert a given dictionary into a JSON string. The function should handle nested dictionaries and should exclude any empty dictionaries from the output. The provided code snippet is part of a larger function that constructs a JSON string from a dictionary. The `result` var... | codefeedback |
You are tasked with implementing a method for drawing objects in a game. The method `DrawWorker` takes in the location (`loc`), rotation (`rot`), object definition (`thingDef`), object instance (`thing`), and extra rotation (`extraRotation`) as parameters. Your task is to complete the implementation of the `DrawWorker`... | codefeedback |
You are tasked with creating a script to automate the provisioning of software packages on a Linux system. The script should handle the installation and version locking of the "puppet" package, as well as perform a system update using the "yum" package manager. Your task is to complete the script by adding the necessar... | codefeedback |
You are tasked with creating a Python program that organizes files in a specified directory based on their file extensions. Your program should prompt the user to input a source directory and a destination directory. It should then scan the source directory for files and move them to the destination directory, organizi... | codefeedback |
You are tasked with creating a data provider method for a testing framework that reads search terms from an external CSV file and provides them as test data for search functionality testing. Your task is to implement the `csvToMap` method and the `multipleSearchTermsFromExternalSource` data provider method.
The `csvTo... | codefeedback |
You are tasked with implementing a function to create a user from input email and password. The function should prompt the user to specify their email and password for a given server host, and optionally an alias. The function should then check if it is possible to log in with the provided credentials and return the us... | codefeedback |
You are tasked with implementing a Python class method that manages a pool of VIP users in a web application. The class, named `VIPManager`, contains a method `create_pool` that takes in a `context` object and a `pool` object as parameters. The `pool` object represents a new pool of VIP users to be created in the appli... | codefeedback |
You are tasked with designing a database schema for a university's course management system. The system should maintain information about departments, courses, and users (such as students, professors, and staff). Each course is associated with a department, and users may be related to courses in various roles (e.g., st... | codefeedback |
You are tasked with creating a program to parse and process HTML table data. Given an HTML table snippet as a string, your program should extract the table data and perform specific operations on it.
Write a function `process_html_table` that takes in a string `html_table` representing an HTML table and returns a lis... | codefeedback |
You are tasked with creating a TypeScript module that provides autocomplete functionality for a web application. The module should export various classes and interfaces related to autocomplete functionality. The provided code snippet is a partial export statement from a TypeScript module that includes the export of dif... | codefeedback |
You are tasked with creating a function that processes data from an API and performs a specific setup operation. The function `setup` takes two parameters: a reference to a `barrel` object obtained from the `api` and a `schema_name` string. The function is asynchronous and returns a result that may contain an error. Yo... | codefeedback |
You are tasked with implementing a function to scrape headlines and categorize them from a satirical news website called "The Beaverton." The function should scrape headlines from the website and categorize them based on a predefined schema. The function should return a dictionary containing the scraped headlines, the ... | codefeedback |
You are tasked with creating a script to automate the installation of software packages on a Linux system. The script should execute a series of commands to update the package repository, install specific software packages, and display messages at certain points during the process. Your task is to write a Bash script t... | codefeedback |
You are tasked with creating a Python function that processes financial data and generates a summary report in an Excel spreadsheet using the `openpyxl` library. The function should take in two parameters: `income_statement` and `stonk_rows`. The `income_statement` parameter is a dictionary containing financial informa... | codefeedback |
You are tasked with creating a Python function that processes a list of dictionaries representing software units. Each dictionary contains information about the unit, including a list of binary file paths. Your function should iterate through each unit, modify the file permissions of the binaries, and return the update... | codefeedback |
You are tasked with creating a Python class that interacts with a database using a Data Access Layer (DAL). The provided code snippet imports a `TestDal` class from a module named `test_db`. Your task is to implement a new class called `UserManager` that utilizes the `TestDal` to perform user management operations.
Yo... | codefeedback |
You are tasked with implementing a Hierarchical Alternating Least Squares (HALS) algorithm for non-negative matrix factorization. In this problem, you will focus on updating the components U_1, U_2, ..., U_N of a non-negative matrix factorization model. The HALS algorithm is an iterative optimization process used to fa... | codefeedback |
You are tasked with creating a C# program that simulates a simple proxy server. The program should intercept and modify HTTP requests before forwarding them to the destination server. Your task is to implement the proxy server functionality to modify the HTTP request headers.
Your program should have the following fea... | codefeedback |
You are tasked with implementing a file system utility function in Rust. The function should read the contents of a directory and return a mapping of file names to their corresponding metadata.
You are provided with a code snippet that demonstrates the usage of the `read_entries` function. The function takes a mutable... | codefeedback |
You are tasked with implementing a class that performs matrix decomposition to extract scale, rotation, and translation components from a 4x4 transformation matrix. The transformation matrix is represented using the `mat4` data type, and the decomposition process involves using the `glm::decompose` function from the GL... | codefeedback |
You are given the inorder and postorder traversal sequences of a binary tree. Your task is to construct the binary tree from these traversal sequences and return the root node of the tree.
The inorder traversal sequence of a binary tree is a list of nodes obtained by performing an inorder traversal of the tree. Simila... | codefeedback |
You are tasked with creating a model factory for a fictional web application. The application is a platform for managing and sharing recipes. Your task is to implement a model factory for the `Recipe` model using a programming language of your choice. The `Recipe` model has the following attributes:
- `id`: a unique i... | codefeedback |
You are tasked with implementing a Python function that processes a given string to remove any leading indentation based on the provided indentation level and quote character. The function should take the following parameters:
- `text`: A string representing the text to be processed.
- `indent`: An integer representing... | codefeedback |
You are tasked with implementing a class for controlling a motor in a robotic system. The class should provide methods for checking if the motor is ready and for retrieving the target position of the motor. Below is the skeleton of the motor control class:
```java
public class MotorController {
/**
* Retrieves th... | codefeedback |
You are tasked with implementing a function that processes a given TypeScript interface and extracts all the properties defined within it. The function should return an array containing the names of all the properties found in the interface.
Write a function `extractInterfaceProperties` that takes a string representin... | codefeedback |
You are tasked with creating a Rust macro that generates code based on the provided input. The macro should take a list of operating systems and their corresponding pollers, and generate type aliases based on the target operating system. The macro should handle the case when the target operating system is "macos" diffe... | codefeedback |
You are tasked with implementing a network graph data structure to represent user authentication activities within a computer network. The network consists of nodes representing users and computers, and edges representing authentication activities. The provided code snippet demonstrates the addition of nodes and edges ... | codefeedback |
You are tasked with implementing a caching mechanism for thumbnail images in a file management system. The system has a method `cacheReceiveThumb` that takes in a `BaseFileInfo` object and an `InputStream` containing the thumbnail image data. The method is responsible for caching the thumbnail image and ensuring that d... | codefeedback |
You are tasked with creating a simple HTTP server using Swift's NIO (Network I/O) framework. Your server should be able to handle incoming HTTP requests and respond with a predefined message. You will need to set up the server, define the request handling logic, and configure it to listen on a specific port.
Your task... | codefeedback |
You are tasked with creating a Python package that can sign and verify Docker images. The package should include a function to retrieve the version of the package. Your task is to implement the `docker_sign_verify` package with the required functionality.
Your task is to create a Python package `docker_sign_verify` wi... | codefeedback |
You are tasked with implementing a custom macro in Rust that generates a nested structure of code based on the input provided. Your macro should take a single input token and generate a specific pattern of nested code based on that input.
Your task is to create a macro called `nested_macro` that takes a single input t... | codefeedback |
You are given a grid of pixels represented as a 2D array. Each pixel is initially set to either 0 or 1. The grid can be manipulated by a series of commands to rotate specific columns by a given number of steps. The rotation of a column involves shifting the elements in that column downwards by the specified number of s... | codefeedback |
You are tasked with creating a Python class for a neural network model. The class should include a method for training the model using mini-batch gradient descent. The provided code snippet is a part of the training method within the class. Your task is to complete the implementation of the training method by adding th... | codefeedback |
You are given a code snippet that initializes an array of strings representing the days of the week and declares some variables. Your task is to write a program that takes input for a number of test cases, and for each test case, it reads two dates in the format "yyyy-mm-dd" and calculates the number of days between th... | codefeedback |
You are tasked with implementing a function to save an image represented as a NumPy array to a file. The function should take the image array, file name, and an optional output directory as input, and save the image to the specified location. If the output directory does not exist, it should be created. The image array... | codefeedback |
You are tasked with implementing 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 keep track of the total number of transactions (deposits and withdrawals) made on the account.
Your task is... | codefeedback |
You are tasked with implementing a Python class for a NoEnvInputTranslationVariationalAutoEncoder. The class inherits from a superclass and has specific parameters for its initialization.
Your task is to complete the implementation of the `NoEnvInputTranslationVariationalAutoEncoder` class by defining its `__init__` m... | codefeedback |
You are tasked with implementing a function that processes a given JavaScript code snippet to identify and extract all the unique CSS styles applied to a specific HTML element. The function should take the JavaScript code snippet as input and return an array of unique CSS styles found within the snippet.
The JavaScrip... | codefeedback |
You are tasked with implementing a genetic algorithm for feature selection in a machine learning context. The genetic algorithm is used to evolve a population of feature subsets to maximize the accuracy of a machine learning model. The algorithm uses a fitness function to evaluate the performance of each feature subset... | codefeedback |
You are tasked with implementing a Python function that processes a given string to extract specific information. The function should extract and return the Python class name and the first character of the string. The input string will be in the format of a Python function definition, and the output should be the extra... | codefeedback |
You are tasked with implementing a custom thread management system in Swift. Your goal is to create a class called `CustomThread` that extends the functionality of the standard `Thread` class. The `CustomThread` class should have the following features:
1. A property called `isCustom` that returns true if the thread is... | codefeedback |
You are tasked with creating a Python function to parse and extract information about the active scene in Autodesk Maya. The function should retrieve specific attributes related to the scene and return them in a dictionary format.
You are provided with a code snippet that demonstrates the expected attributes to be cap... | codefeedback |
You are tasked with creating a Python class that generates an animation of a pigeon's flight using the `matplotlib.animation` library. The pigeon's body parts are represented as nodes, and the connections between them as edges. The animation will show the movement of the pigeon's body parts over a specified range of fr... | codefeedback |
You are tasked with implementing a time difference calculation function in a messaging application. The application uses PHP and HTML to display messages with their creation timestamps. The code snippet provided is a part of the HTML template used to display the creation timestamp of a message. The PHP code `<?=$Messag... | codefeedback |
You are tasked with creating a Rust function that processes a given version string and returns a formatted string with an icon, the version number, and a specified color. The function should take a string representing the Rust compiler version as input and return the formatted string. The icon should be "🦀", and the c... | codefeedback |
You are tasked with implementing a simplified task management system for a software application. The system consists of a TaskManager class with the following methods:
1. `publish_abort(log_key)`: This method publishes an abort command for the task identified by the given log_key.
2. `wait_for_tasks(log_key)`: This m... | codefeedback |
You are tasked with implementing a custom logging system in C#. The system should support logging messages at different log levels and provide the flexibility to log messages either directly as strings or through function delegates.
Your task is to create a class `CustomLogger` that adheres to the following requiremen... | codefeedback |
You are tasked with creating a Rust command-line application for managing configuration settings. The application should support four subcommands: `ConfigPath`, `ConfigRemove`, `ConfigSet`, and `ConfigSetInto`. Each subcommand corresponds to a different operation on the configuration settings.
Your task is to implemen... | codefeedback |
You are given a string containing a mix of uppercase and lowercase letters. Your task is to write a function that returns a new string where the uppercase letters are converted to lowercase and the lowercase letters are converted to uppercase. Any characters that are not letters should remain unchanged.
Write a functi... | codefeedback |
You are tasked with implementing a function that sorts a list of results based on a specific criterion. The results are represented as a list of tuples, where each tuple contains information about a result. Your task is to sort the results based on the third element of each tuple in descending order.
Write a function ... | codefeedback |
You are tasked with designing a system for managing different flows within a mobile application. The system will involve creating and managing instances of various flow classes, each responsible for a specific aspect of the application's functionality.
You are provided with a code snippet that initializes a `UITabBarC... | codefeedback |
You are tasked with implementing a message processor for a network communication system. The message processor is responsible for processing different types of messages and may support acknowledgment functionality. Your task is to implement the initialization process for the message processor based on the provided code... | codefeedback |
You are tasked with creating a word guessing game in Python. The game will randomly select a word from a predefined dictionary and allow the player to guess letters until they either correctly guess the word or run out of attempts.
Your task is to implement the `WordGuessGame` class with the following specifications:
... | codefeedback |
You are tasked with implementing a message handling system for a version protocol. The system should be able to process different versions of messages and handle them according to specific rules. Each message has a version number and a payload. Your task is to implement a function that processes the messages according ... | codefeedback |
You are tasked with implementing a function to determine the winning hand in a Chinese card game called "Hupai32". In this game, players are dealt a hand of cards, and the goal is to identify if the hand is a winning combination according to the game's rules. The game involves a set of cards and specific combinations t... | codefeedback |
You are tasked with implementing a dependency injection container that supports resolving service registrations based on resolution requests. The container should provide a method `GetRegistration` that takes a `ResolutionRequest` object as input and returns the corresponding `IServiceRegistration` object.
The `Resolu... | codefeedback |
You are tasked with creating a Rust library for generating secure and memorable passwords inspired by the xkcd comic #936. The library should allow users to configure the number of words in the password, the minimum length of each word, and whether to include special characters. Your task is to implement the `Configura... | codefeedback |
You are tasked with creating a program that retrieves weather information from an external API and processes the data to display specific details. The `get_weather()` function is provided to retrieve the weather data, but it is not fully implemented. Your task is to complete the `get_weather()` function and create addi... | codefeedback |
You are tasked with implementing a Redux reducer function in TypeScript for managing the authentication state of a web application. The provided code snippet outlines the initial state and the action types related to authentication.
Your task is to complete the reducer function that handles these actions and updates t... | codefeedback |
You are tasked with creating a program that utilizes the Sentence Transformers library to perform semantic similarity analysis on a set of sentences. The Sentence Transformers library provides pre-trained models to convert sentences into numerical vectors, allowing for comparison of semantic similarity between sentence... | codefeedback |
You are tasked with creating a custom suggestion provider for a development tool. The tool allows users to specify a branch name for a version control system, and the suggestion provider should offer a list of valid branch names based on certain criteria. Your goal is to implement the suggestion provider class to gener... | codefeedback |
You are tasked with creating a script to automate the process of loading user data into a web application using the `curl` command. The script should take user input for `username`, `password`, and `userid`, and then send a POST request to the specified URL with the user data in JSON format.
Your task is to write a Ba... | codefeedback |
You are tasked with implementing a function that processes a list of items and creates a list of view models for each item. The provided code snippet is a part of a Swift application and defines a `ListingViewModel` struct with a method `listOfItemVM()` that needs to be completed. The `ListingViewModel` struct contains... | codefeedback |
You are tasked with implementing a function that reads a requirements file and returns a dictionary containing the dependencies and their versions. The requirements file follows a specific format where each line contains a package name and its version, separated by an equals sign. For example, the file may look like th... | codefeedback |
You are tasked with implementing a generic method for converting a Data Transfer Object (DTO) to a Plain Old Java Object (POJO). The provided code snippet is a part of an abstract class `BaseDTO` that contains a method `toEntity` for this purpose. Your task is to complete the implementation of the `toEntity` method to ... | codefeedback |
You are tasked with implementing a bandpass filter for a given signal. A bandpass filter allows signals within a certain frequency range to pass through while attenuating frequencies outside this range. The filter is defined by its lower and upper cutoff frequencies. You are given a signal in the form of a list of floa... | codefeedback |
You are given a dictionary containing keys representing different tasks and their corresponding boolean values indicating whether the task is completed or not. Your task is to write a function that returns the percentage of completed tasks in the dictionary.
Write a function `calculate_completion_percentage(tasks: dic... | codefeedback |
You are tasked with implementing a text box generator in Rust. The text box generator takes an iterator of lines and an optional header, and produces an iterator of strings where each string represents a line of the text box. The text box should have a specific format and styling.
The text box should be generated as f... | codefeedback |
You are tasked with creating a Python function that processes and displays an image using the `guidata` library. The function should take an image file path as input and display the image in a GUI window with a specified title.
Write a function `display_image` that takes two parameters:
- `image_path` (string): The fi... | codefeedback |
You are tasked with creating a command-line tool to automate the deployment process for a web application. The tool should execute a series of commands to ensure that the application is properly updated and optimized. Your task is to write a Python script that simulates the behavior of the deployment tool by executing ... | codefeedback |
You are tasked with implementing a function to calculate the Stochastic Oscillator (STOCH) indicator for a given set of stock prices. The STOCH indicator is a momentum indicator that shows the location of the close relative to the high-low range over a set number of periods. It consists of two lines: %K and %D. The %K ... | codefeedback |
You are tasked with implementing a RangeTimePlot class that can be used to visualize time-based data within a specified range. The class should support adding data points with associated timestamps and then be able to generate a time plot within a given time range.
The RangeTimePlot class should have the following met... | codefeedback |
You are tasked with implementing a mock class for a USB library in Java. The USB library provides a `PollfdListener` interface, and you need to create a mock implementation for testing purposes. The `PollfdListener` interface is used for monitoring file descriptors for events.
Your task is to complete the implementati... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.