instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a custom data structure called `CircularQueue` in Python. A circular queue is a data structure that follows the FIFO (First In First Out) principle, but the last element is connected to the first element to form a circle. The circular queue should support the following operations:
1. `_... | codefeedback |
You are tasked with implementing a custom namespace resolver for a specific namespace in a C# application. The namespace resolver should be able to dynamically resolve and load classes from the specified namespace at runtime. Your task is to create a class that can dynamically load and instantiate classes from the give... | codefeedback |
You are tasked with implementing a Python generator function that yields the ancestors of a given resource in a hierarchical structure. The resource is represented by an object with a `parent` attribute pointing to its parent resource. The generator function should yield each ancestor resource in sequence until reachin... | codefeedback |
You are given a set of logical implications in the form of First Order Logic expressions. Each expression takes the form of "A(x) ⊃ B(x)", where A(x) and B(x) are predicates and x is a variable. This notation means that if A(x) is true, then B(x) must also be true.
Your task is to write a program that can determ... | codefeedback |
You are tasked with implementing a transaction validation module for a cryptocurrency system. The provided code snippet is a partial excerpt from the module, showcasing the public interface and the modules it uses for transaction validation.
Your task is to design and implement the validation logic for a cryptocurrenc... | codefeedback |
You are given a 2D board of characters and a list of words. Your task is to implement a function that finds all the words from the list that can be formed by a sequence of adjacent characters on the board. The adjacent characters can be horizontally or vertically neighboring, but not diagonally. Each character on the b... | codefeedback |
You are tasked with implementing a class that represents a debugger expression value in a debugging environment. The class should handle different types of completion data and provide methods to retrieve the value's address, full name, and type name.
Your task is to create a class `DebuggerExpressionValue` with the fo... | codefeedback |
You are tasked with creating a Python class for managing entities in a simulation environment. The class contains two methods: `update_entity` and `publish_marker_array`.
The `update_entity` method is responsible for updating the position and orientation of a specified entity in the simulation. It takes in the entity ... | codefeedback |
You are tasked with implementing a function that simulates a smooth scrolling effect on a web page using the provided code snippet as a reference. The function should take in the starting position, the target position, the duration of the scroll, and the easing function to be used. The easing function will determine th... | codefeedback |
You are tasked with implementing a Python class that manages data forwarding entries in a software-defined networking (SDN) controller. The provided code snippet is a partial implementation of a RESTful API endpoint using Flask and Flask-RESTful for adding and deleting data forwarding entries in the SDN controller. You... | codefeedback |
You are tasked with implementing a function that flattens a nested object into a single-level object, where the keys are concatenated using dot notation. For example, given the input object `{ a: { b: 1, c: { d: 2 } } }`, the output should be `{ 'a.b': 1, 'a.c.d': 2 }`.
Write a function `flattenObject` that takes an i... | codefeedback |
You are tasked with creating a tax calculation program for a country where the tax rates are based on income brackets. The tax calculation is based on the following rules:
- If the tax base is less than or equal to 1200 times the value of MANWON, the tax is calculated as 6% of the tax base.
- If the tax base is greater... | codefeedback |
You are tasked with implementing a class method that calculates the score of an object based on its location and orientation. The object is represented by a class with the following attributes and methods:
Attributes:
- `self.loc`: A 2D vector representing the location of the object.
- `self.ry`: A scalar representing... | codefeedback |
You are tasked with implementing a custom data structure to efficiently store and retrieve a collection of network resource properties. Each network resource property consists of a name and a description. The data structure should support adding new properties, retrieving properties by name, and listing all properties ... | codefeedback |
You are tasked with implementing a class for managing auto-heal rules in a game. The class, `AutoHealRules`, should allow setting conditions for when the auto-heal actions should be executed. The provided code snippet shows a method `withTriggers` that sets the triggers for auto-heal actions. Your task is to implement ... | codefeedback |
You are tasked with implementing a simple event stream processing system using JavaScript. The system will receive events from two Kafka-like message brokers and process them using the Most.js library.
You are provided with a code snippet that sets up two instances of a fake Kafka message broker and creates an event s... | codefeedback |
You are tasked with creating a Rust program that analyzes a given Rust project's dependencies and provides a report on the number of external crates used. The program should read the project's `Cargo.toml` file, which contains information about its dependencies, and then count and display the number of external crates ... | codefeedback |
You are tasked with implementing a parallel multiway merge algorithm using the STXXL library. The STXXL library is a C++ implementation of the C++ standard library STL for external memory computations. The given code snippet is a part of a program that utilizes the STXXL library for parallel multiway merging.
Your tas... | codefeedback |
You are given a C# program that is intended to print a pattern of asterisks in a diamond shape. However, the code snippet provided is incomplete and contains missing parts. Your task is to complete the given C# program to achieve the desired diamond pattern output.
The program should take an integer input `n` and prin... | codefeedback |
You are tasked with implementing a simplified version of a task service that handles requests and optimizes an index. The task service is responsible for processing requests and optimizing the index when the request is made from an API. The provided code snippet is a part of the task service's logic.
Your task is to c... | codefeedback |
You are working on a data processing system that involves handling and persisting data packets in HDF5 format. The system utilizes various modules and utilities from the `pyon` and `ion` libraries. Your task is to implement a function that generates a unique identifier for a new data packet and persists the packet to a... | codefeedback |
You are working on a project that involves processing 3D point cloud data. The code snippet provided is a part of a Python class that manipulates the point cloud data. The class has two methods: `translate` and `histogramEqualize`.
The `translate` method takes two parameters `centerY` and `centerZ`, and it subtracts t... | codefeedback |
You are tasked with creating a Python class that simulates a simple LED controller using the Raspberry Pi GPIO library. The class should allow users to turn the LED on and off, as well as set its brightness level. Your task is to complete the implementation of the LEDController class by adding the necessary methods.
T... | codefeedback |
You are tasked with creating a TypeScript class that interfaces with a user profile API to handle user profile updates and creations. The API provides several data transfer objects (DTOs) and input types for different operations. Your task is to create a TypeScript class that encapsulates the logic for making requests ... | codefeedback |
You are a DevOps engineer responsible for managing database credentials and ensuring their secure storage. You are tasked with creating a Python script to update database passwords and store them in a YAML file using the PyYAML library. Additionally, the script should execute SQL commands to update the database passwor... | codefeedback |
You are working on a project that involves implementing a deep learning model for predicting stock price movements based on order book data. The code snippet provided is from a Python module that imports two components: `LOBDeepPP_model` and `LOBDeepPP_params_files`. The `LOBDeepPP_model` likely contains the implementa... | codefeedback |
You are tasked with creating a program to generate a grid layout for a collection view in an iOS app. The grid layout should consist of a 1-2-1 pattern, where the middle row spans the entire width of the grid, while the top and bottom rows each occupy half the width of the grid. The grid layout should be responsive to ... | codefeedback |
You are working on a project that involves configuring a particle physics event processing framework using the CMS (Compact Muon Solenoid) software. The provided code snippet is a part of the configuration script written in Python using the FWCore.ParameterSet.Config module.
Your task is to complete the configuration ... | codefeedback |
You are tasked with implementing a class that manages the disposal of resources. The class should have a method for disposing resources and a method for releasing unmanaged resources. Your task is to complete the implementation of the `ResourceHandler` class by adding the necessary methods to properly dispose of resour... | codefeedback |
You are tasked with creating a Python program that processes genetic sequences to identify specific nucleotide components. The program should be able to read a DNA sequence from a file, count the occurrences of each nucleotide (A, C, G, and T), and then calculate the GC content of the sequence.
Write a Python function... | codefeedback |
You are tasked with creating a Python function that parses a help text for a Telegram bot and extracts the list of commands along with their descriptions. The help text is structured with each command followed by its description, and the command and description separated by a colon. The commands are prefixed with a for... | codefeedback |
You are tasked with creating a Python program that securely stores user credentials in a file using base64 encoding. The program should prompt the user to input their username and password, encode the credentials in base64 format, and then write the encoded credentials to a file named "secret". Additionally, the progra... | codefeedback |
You are tasked with implementing a Python class that utilizes the provided code snippet to create a web scraping utility. The class should have the ability to perform indirect web scraping by following a chain of URLs to reach the desired content. Your task is to complete the implementation of the `WebScraper` class by... | codefeedback |
You are tasked with implementing a function to build an Address Resolution Protocol (ARP) message for IPv4. The ARP message consists of various fields such as EtherType, operation, source hardware address, source protocol address, target hardware address, and target protocol address. The function `build_arp_msg_ipv4` t... | codefeedback |
You are tasked with creating a TypeScript class that implements a custom pipe for transforming form data. The pipe should take an input object containing form data, where each key represents a form field and the corresponding value is an object containing the field's properties. The pipe should then transform this inpu... | codefeedback |
You are tasked with implementing a custom class `ByteString` that simulates a byte string object. The `ByteString` class should support the following operations:
1. Initialization: The class should be initialized with a sequence of bytes.
2. `lines()`: A method that returns a list of lines in the byte string, where a l... | codefeedback |
You are tasked with implementing a Python function to process image data using the DASC (Data Adaptive Smoothing and Clustering) algorithm. The DASC algorithm is used for image processing and analysis, and it involves generating a histogram and creating a movie from the processed image data.
You are provided with the ... | codefeedback |
You are working as a data scientist for a marketing company. Your task is to build a predictive model to determine customer response to marketing campaigns. You have been provided with a dataset named "bank_cleaned.csv" containing various customer attributes and their response to previous marketing campaigns. The datas... | codefeedback |
You are given a Python function that takes two integers `X` and `N` as input and returns a list of sets. The function aims to find all unique combinations of numbers raised to the power of `N` that sum up to `X`. However, the code snippet provided is incomplete and lacks proper documentation. Your task is to understand... | codefeedback |
You are tasked with implementing a Python generator function that takes two lists as input and yields a sorted list of tuples. Each tuple should contain an element from the first list and its corresponding element from the second list. Additionally, you need to create a unit test case for this generator function using ... | codefeedback |
You are tasked with implementing a generic visitor pattern in Java to process different types of series data. The provided code snippet is a part of the declaration of a visitor interface for the series data. The `FIELDS` and `SeriesVisitor` are placeholders for actual code.
Your task is to complete the implementation... | codefeedback |
You are tasked with implementing a function to prune communities in a social network represented by a graph. The graph is represented using an adjacency list, where each key-value pair represents a node and its corresponding neighbors. The function `prune_communities(G, min_size)` takes in the graph `G` and an integer ... | codefeedback |
You are tasked with implementing a class `Max` that contains methods to find the maximum value among given input integers. The class should have the following methods:
1. `maxValue(int a, int b)`: This method should take two integer arguments `a` and `b` and return the maximum value among them.
2. `max(int a, int b, in... | codefeedback |
You are tasked with implementing a hierarchical classifier in Python. A hierarchical classifier is a machine learning model that organizes multiple classifiers into a hierarchical structure to make predictions. The given code snippet initializes a hierarchical classifier using existing category classifiers and a class ... | codefeedback |
You are tasked with implementing a CO2 emissions calculator for a survey application. The application collects user responses and calculates the corresponding CO2 emissions based on the user's input. The code snippet provided is a part of the CO2 emissions calculation logic. The `result` object contains the user's resp... | codefeedback |
You are tasked with implementing a user authentication system for a mobile application using Swift and Firebase. The provided code snippet is a part of the `SignIn` view controller, which is responsible for handling user sign-in functionality. The view controller contains two `UITextField` outlets for the username and ... | codefeedback |
You are tasked with designing a system to manage the workflow of a warehouse for an e-commerce company. The system should handle the placement and receipt of orders, inventory management, order backlog, order fulfillment, and cost tracking. Your task is to create a class structure that represents the various components... | codefeedback |
You are tasked with creating a Python program to control smart shades in a smart home environment. The program should accept command-line arguments for the IP address of the hub and the name of the shade to control. The smart home hub provides an API for controlling the shades, and your program needs to make HTTP reque... | codefeedback |
You are tasked with implementing a function to determine if a given ray intersects with a triangle in 3D space and, if so, calculating the intersection point and the distance along the ray to the intersection.
You are given the following code snippet as a starting point:
```cpp
return Point(x, y, z);
}
// This funct... | codefeedback |
You are tasked with creating a Python function that processes a series of Linux networking commands and extracts specific information from them. The function should take a list of strings as input, where each string represents a command from the Linux `ip` utility. The function should then extract and return the names ... | codefeedback |
You are tasked with implementing a simplified version of a command-line tool that performs various operations based on user input. The provided code snippet is part of the main execution flow of the tool. Your task is to create a class hierarchy for the operations and handle exceptions appropriately.
Your task is to c... | codefeedback |
You are tasked with simulating a ranking system for a sports competition. The ranking system follows a specific algorithm to update the ranks of the winners and losers after each match. The algorithm is as follows:
1. Calculate the winner's and loser's scores using the formula:
- winner_score = winner_rank_transfor... | codefeedback |
You are tasked with creating a Python package for image processing. The package should include modules for image registration and transformation. The image registration module should handle the alignment of images, while the transformation module should provide functions for applying various transformations to images.
... | codefeedback |
You are tasked with creating a Python script that interacts with a PowerShell script to perform a specific task. The PowerShell script, named `dns.ps1`, is located in the current working directory. Your Python script should execute the PowerShell script using the `subprocess` module and wait for its completion before p... | codefeedback |
You are tasked with implementing a data transmission protocol for a custom hardware device. The provided code snippet is a part of the data transmission process. The `lines` variable is a list of strings, and the code processes each line to prepare it for transmission. The `data` variable accumulates the processed line... | codefeedback |
You are tasked with implementing a function to manage email subscriptions based on keywords. The function `subscribe_email` takes three parameters: `email` (a string representing the email address to subscribe), `kws` (a list of strings representing keywords), and `time_limit` (an integer representing the time limit in... | codefeedback |
You are tasked with implementing a Python class that manages API requests using the aiohttp library. The class should handle the initialization of API parameters and provide an asynchronous context manager for making API requests.
You need to create a class `APIManager` with the following specifications:
- The class s... | codefeedback |
You are tasked with creating a Python program to implement a number guessing game. The program should generate a random number between 1 and 100 (inclusive) and prompt the user to guess the number. After each guess, the program should provide feedback on whether the guess is too high, too small, or correct. The game sh... | codefeedback |
You are tasked with implementing a Python function that processes and writes data to JSON files based on the given code snippet. The code snippet is part of a larger program that handles different types of security content and writes the processed data to JSON files. Your task is to complete the function `process_secur... | codefeedback |
You are working with climate data stored in a NetCDF file format. Your task is to create a Python function that reads the temperature data from the file and processes it to calculate the average temperature for a specific time period.
You are given a code snippet that demonstrates the initial steps of reading the data... | codefeedback |
You are tasked with creating a Python script that processes audio files using a pre-trained TensorFlow model for speech recognition. The script should take in command-line arguments to specify the frozen graph file, label file, and the audio file to be labeled. The frozen graph file contains the trained model, the labe... | codefeedback |
You are tasked with implementing a token-based authentication system for a RESTful API using Python's Flask-RESTful library. The code snippet provided is a starting point for creating a resource that requires token authentication.
Your task is to extend the `TokenAuthResource` class to create a specific resource calle... | codefeedback |
You are tasked with creating a script that processes a list of numbers and performs specific operations on them. The script should take a list of numbers as input and output the result of the operations. The operations to be performed are as follows:
1. Double the number if it is even.
2. Triple the number if it is odd... | codefeedback |
You are tasked with implementing a function to determine whether the current time falls within a trade window for a financial trading system. The trade window is defined to avoid the early morning and late night periods, as well as weekends, to prevent overnight gaps. The provided code snippet contains partial logic fo... | codefeedback |
You are tasked with creating a Python program that processes a given file and performs specific operations on its content. Your program should read a file path as a command-line argument and then perform the following tasks:
1. Check the file for PEP 8 compliance using the `flake8` tool with a maximum line length of 12... | codefeedback |
You are tasked with creating a React component that renders an SVG icon representing a "Turn Right" arrow. The SVG icon should be designed to fit within a 2048x2048 viewport and should have a specific path defined to create the arrow shape. Your task is to write the React component code that generates the SVG icon as d... | codefeedback |
You are tasked with implementing a custom link processor for a markdown parser. The processor should be able to parse link destinations and titles from a given input and assert the correct format of the link closing characters.
Your task is to complete the implementation of the `LinkCloserProcessor` class by defining ... | codefeedback |
You are given an array of integers `a` of length `n`. Your task is to pair up the elements of the array in such a way that the sum of the indices of each pair is minimized. In other words, you need to pair up the elements such that the sum of the indices of each pair is as small as possible.
Write a function or progra... | codefeedback |
You are tasked with creating a program that checks whether a given number is a perfect number or not. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, 6 is a perfect number because the sum of its proper divisors (1, 2, 3) equals 6.
Write a function ... | codefeedback |
You are tasked with implementing a review page for a code review system. The review page is part of a larger system that manages code reviews, code files, and comments. The code snippet provided is a partial class for the ReviewPageModel, which is responsible for handling the review page's logic and interactions with t... | codefeedback |
You are working on a machine learning project that involves splitting a dataset into training, validation, and testing sets. The dataset is stored in a JSON file, and you need to write a script to split the data into the three sets based on a given ratio. Additionally, you need to ensure that the JSON file paths for th... | codefeedback |
You are tasked with creating a PHP class that processes event data for a web application. The class should handle incoming HTTP requests and manipulate date and time information using the Symfony and Drupal libraries.
Your task is to implement a class called `EventsController` that includes methods for processing even... | codefeedback |
You are tasked with creating a Python function that extracts the names of the models from the given code snippet. The function should take the code snippet as input and return a list of model names.
Create a function called `extract_model_names` that takes a code snippet as a string input and returns a list of model n... | codefeedback |
You are tasked with implementing a custom serialization mechanism for a Java application. The application uses a class `Constants` to define various constant values. One of the constants is `SERIALIZABLE_NULL_KEY_PATH`, which is used to represent a special key path for handling null values during serialization.
Your t... | codefeedback |
You are tasked with implementing a generic networking client in Swift that can handle asynchronous requests and decode the response data into a specified type. Your task is to complete the implementation of the `load` function within the `NetworkingClient` class. The `load` function takes three parameters: `service`, `... | codefeedback |
You are working on a project to defend against adversarial attacks on machine learning models. As part of this project, you need to implement a method to generate adversarial examples for a given dataset and model. An adversarial example is a sample that has been modified to cause a machine learning model to make a mis... | codefeedback |
You are tasked with implementing a text layout algorithm for rendering text using signed distance fields (SDFs). An SDF is a grayscale image where the pixel values represent the distance to the nearest boundary. The given code snippet is part of a text layout algorithm that processes SDFs to render text. The algorithm ... | codefeedback |
You are tasked with creating a program to manage a video recording interface in a macOS application. The given code snippet is part of the setup for the user interface. The program should allow the user to control video recording, select audio and camera sources, and display a preview of the recorded video.
Your task ... | codefeedback |
You are tasked with implementing a command-line argument parser for a compiler tool. The tool accepts various command-line options, and your task is to parse and process these options. The options are specified in a specific format, and your parser should be able to extract the relevant information from the command-lin... | codefeedback |
You are tasked with implementing a generic stack data structure in Java. The stack should support the following operations:
1. `push(item)`: Add an item to the top of the stack.
2. `pop()`: Remove and return the item at the top of the stack.
3. `peek()`: Return the item at the top of the stack without removing it.
4. `... | codefeedback |
You are tasked with creating a script to automate the benchmarking of a video encoding tool called `kvazaar`. The script will utilize the `make` command to compile the tool, extract two video files using 7z, and then run the `kvazaar` tool with specific parameters to measure its performance. The script will capture the... | codefeedback |
You are tasked with implementing a class method to calculate Brunet's statistic for a given set of sentences. Brunet's statistic is a measure of lexical diversity, which is used to quantify the richness of vocabulary in a text. The formula for Brunet's statistic is given by:
\[ V = N^{(V^b)} \]
Where:
- \( V \) is th... | codefeedback |
You are given a graph representing a town with `n` vertices numbered from 1 to `n`. The graph is represented as an adjacency list `graph`, where `graph[i]` contains the neighbors of vertex `i`. Additionally, there is a list `town_color` of length `n` initialized with -1, which will store the color of each town.
Your t... | codefeedback |
You are tasked with implementing a custom sorting algorithm for a specific data structure. The data structure consists of a list of `run_info` objects, each containing information about a neural network optimization run. Each `run_info` object has the following attributes:
- `cpu_time`: The CPU time taken for the optim... | codefeedback |
You are given a code snippet that contains various shell functions and comments. Your task is to analyze the code and identify the specific patterns and operations being performed within the functions.
Your goal is to write a program that can parse and extract relevant information from the given code snippet. Specifi... | codefeedback |
You are tasked with implementing a Rust function that interacts with the Android Java Native Interface (JNI) to create an instance of the `Eq` class from the `DynamicsProcessing` package in the Android media framework. The provided code snippet demonstrates the usage of the JNI to call the constructor of the `Eq` class... | codefeedback |
You are tasked with implementing a class for reading data from a ROS bag file. The ROSBagReader class should be able to read and process data from a ROS bag file, which is a file format used in the Robot Operating System (ROS) for storing time-series data, such as sensor data, messages, and other information.
The ROSB... | codefeedback |
You are tasked with creating a Python class to manage Amazon S3 buckets. The class should have two methods: `list_buckets` and `create_bucket`. The `list_buckets` method should retrieve and print the names of all existing S3 buckets, while the `create_bucket` method should create a new S3 bucket with a specified name.
... | codefeedback |
You are tasked with implementing a simple job management system in Rust. The system will handle job creation requests and store information about the jobs, including their status and duration.
You are provided with a code snippet that defines a `CreateRequest` struct using the `serde` crate for deserialization. The `C... | codefeedback |
You are tasked with creating a program to generate spectrogram images for a given set of audio files. A spectrogram is a visual representation of the spectrum of frequencies of a signal as it varies with time. The program should iterate through a list of audio files and produce spectrogram images for each file.
Your t... | codefeedback |
You are tasked with implementing a logging system for affirmations in a Java application. The code snippet provided is part of a logging framework and contains a method to retrieve an active affirmation. The `getActiveAffirmation` method is responsible for obtaining an active affirmation from a set of supported asserti... | codefeedback |
You are tasked with creating a script to automate the setup of the atftp (Advanced Trivial File Transfer Protocol) software. The script should perform the following tasks:
1. Remove the existing atftp directory within the specified working directory.
2. Create a new directory named "atftp" within the working directory... | codefeedback |
You are tasked with creating a program to calculate the total discount for a group of children attending an event. The discount is based on the number of children in the group, and the discount rates are as follows:
- 2 children: 10% discount
- 3 children: 15% discount
- 4 children: 18% discount
- 5 or more children: 1... | codefeedback |
You are given a list of integers, and your task is to find the highest product of three distinct numbers from the list.
Write a function `highest_product_of_three(nums)` that takes in a list of integers `nums` and returns the highest product of three distinct numbers from the list.
For example, given the input list `... | codefeedback |
You are tasked with creating a function that validates a given connection string for a Service Bus in Azure. The connection string should adhere to a specific pattern to be considered valid. The pattern for a valid connection string is as follows:
- It should start with "Endpoint=sb://"
- Followed by any characters (de... | codefeedback |
You are tasked with implementing a function `get_utf8_value` that takes a single parameter `value`. The function should return the UTF-8 encoded byte representation of the input value. The input `value` can be of various data types, including integers, strings, and lists. The function should handle each data type appro... | codefeedback |
You are tasked with creating a Python function that processes a list of migration files and extracts the names of the models being created. Each migration file is represented as a string, and the model names are enclosed within the `migrations.CreateModel` function calls. The model names are enclosed in single quotes a... | codefeedback |
You are tasked with implementing a custom token management system in Java. Your goal is to create a class that generates unique tokens for use in a bundle management system. The tokens should be immutable and unique for each instance of the class.
Your task is to create a Java class called `TokenManager` that contains... | codefeedback |
You are working on a task scheduler system that manages dependencies between tasks. The system uses a graph-based representation to track the dependencies and operations to be performed. The given code snippet is a part of a method in the task scheduler class that handles the creation of new tasks and their dependencie... | codefeedback |
You are tasked with implementing a function that calculates the color at a specific point within a gradient. The gradient is defined by two colors, a start point, an end point, and a set of locations. The function should take the start color, end color, start point, end point, and locations as input, and return the col... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.