instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with automating the deployment of multiple microservices in a Kubernetes environment using OpenShift command-line tools. The provided code snippet is a part of a deployment script and is responsible for processing a service template file and applying it to the cluster for each microservice. The script re...
codefeedback
You are tasked with implementing a function to process operations for a system with a specified number of modes. The function should initialize a list of operations for each mode and check if the system is purely electronic. You are given a Python class with an incomplete `op_setup` method. The method should initializ...
codefeedback
You are tasked with implementing a custom user details service in a Spring Boot application. The user details service should retrieve user information from a database and provide it to the Spring Security framework for authentication and authorization purposes. Your task is to create a class `CustomUserDetailsService`...
codefeedback
You are tasked with creating a configuration parser for a Python application. The configuration settings are defined as a dictionary where each key represents a configuration parameter and its corresponding value is another dictionary containing the parameter's type and default value. Your goal is to implement a functi...
codefeedback
You are tasked with creating a Python program that interacts with a remote server using the ASN.1 protocol. ASN.1 (Abstract Syntax Notation One) is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way. Your program needs to establish a co...
codefeedback
You are tasked with implementing a visitor pattern for a simple tree data structure. The tree consists of nodes that can be of different types, such as `LeafNode` and `CompositeNode`. Each node type has its own specific behavior when visited by a visitor. The `PrintVisitor` class is responsible for visiting the nodes ...
codefeedback
You are tasked with creating a Python function to calculate the maximum revolutions per minute (RPM) for a given propeller diameter to ensure that the tip speed does not exceed 0.7 times the speed of sound at sea level. The speed of sound at sea level can be calculated using the formula: \[ speed\_of\_sound = \sqrt{\g...
codefeedback
You are tasked with implementing a custom view in Swift that displays an image and a title label. The provided code snippet contains a custom view class with two methods: `layoutSubviews` and `setUI`. The `layoutSubviews` method is responsible for setting the frames of the `imageView` and `titleLabel`, while the `setUI...
codefeedback
You are tasked with implementing a function that calculates the minimum workspace size required for various operations in a numerical library. The provided code snippet contains template definitions for determining the minimum workspace size for different types of operations based on the input parameters. Your task is...
codefeedback
You are tasked with implementing a program to decipher a ciphertext using the Vigenere Cipher method. The Vigenere Cipher is a method of encrypting alphabetic text by using a simple form of polyalphabetic substitution. It uses a keyword to shift the letters in the plaintext to create the ciphertext. In this problem, yo...
codefeedback
You are working on a bioinformatics project that involves analyzing genetic data. You have a file named `${PREF}-head.txt` containing data related to genetic molecules. The code snippet provided is a part of a shell script that processes this genetic data. The script iterates over three genes (a, b, c) and for each gen...
codefeedback
You are tasked with creating a program that securely stores and retrieves LinkedIn login credentials. Your program should implement a class that allows users to set their LinkedIn email and password, encrypt and store this information, and then retrieve and decrypt it when needed. The encryption and decryption should b...
codefeedback
You are tasked with implementing a module for calculating the thickness of a material based on its density and volume. The module should provide a function that takes the density of the material and the desired volume, and returns the required thickness to achieve the given volume. You are provided with the following ...
codefeedback
You are tasked with creating a script to automate the testing of a command-line tool for genetic analysis. The script will take in four parameters: the binary directory, a seed value, a bin number, and the haplotype count. The script will then execute two commands, `cli_test_input.sh` and `cli_test_input.sh`, passing t...
codefeedback
You are tasked with implementing a Django model for a ticketing system. The model should include a foreign key relationship with the Site model, a custom string representation method, and a save method that triggers email notifications under certain conditions. Your task is to create a Django model for the Ticket clas...
codefeedback
You are tasked with creating a Java program that parses a collection of SGF (Smart Game Format) files and extracts specific information from them. SGF is a text-based format for storing board game data, particularly for Go, chess, and similar games. Your program should be able to read an SGF file and extract the number...
codefeedback
You are tasked with implementing a custom form validation method for a Django class-based view. The view has a `post` method that calls the `form_valid` method to handle form validation. Your task is to complete the `form_valid` method to perform custom validation logic and return an appropriate response. The `form_va...
codefeedback
You are tasked with implementing a function to retrieve all the node editors in a given 3D animation software environment. In this environment, a global progress bar is accessible through a provided function. Your task is to create a Python function that can identify and return a list of all the node editors present in...
codefeedback
You are tasked with creating a web application that displays a dashboard with user information. The user information is stored in a JavaScript object and needs to be dynamically rendered on the dashboard using HTML and JavaScript. You are given the following JavaScript object representing user information: ```javascri...
codefeedback
You are tasked with optimizing the performance of a data loader used in a machine learning pipeline. The given code snippet initializes a data loader using PyTorch for a test set with a large number of classes. The data loader is set to load data in batches, with specific configurations for batch size, shuffling, pinni...
codefeedback
You are given a Python script that aims to reconstruct chopped trees from a tracker. The script imports a module called `PlotLineageTree` and then attempts to process data from two files: `cellIDdetails_raw.txt` and `tracks_type2.xml`. The script iterates through the lines of the `cellIDdetails_raw.txt` file, splitting...
codefeedback
You are tasked with implementing a Python class that handles the enveloping and wrapping of data structures for communication over a network. The class contains two methods: `envelope_wrap` and `envelope_send`. The `envelope_wrap` method takes a denormalized data structure, a network connection, and a message ID as inp...
codefeedback
You are tasked with creating a program that processes software license information. The program should read a string containing the maintainer's name and email, as well as the license type and its optional parameters. The maintainer's name and email are separated by "<<EMAIL>>", and the license type and its parameters ...
codefeedback
You are tasked with implementing a custom text interpolation feature for a Swift application. The custom text interpolation should allow for the inclusion of special formatting within a `Text` object. The goal is to create a function that can handle custom interpolation syntax and produce the expected output. Your tas...
codefeedback
You are tasked with creating a Python class that simulates a simple banking system. The class should have methods for depositing funds, withdrawing funds, and checking the current balance. Additionally, the class should keep track of the transaction history, including the date, type of transaction (deposit or withdrawa...
codefeedback
You are tasked with implementing a user authentication system for a web application using Python and Flask. The provided code snippet contains two Flask routes: one for rendering the index page and setting a cookie, and another for handling user registration. Your task is to create a Flask route for user login and imp...
codefeedback
You are given two strings, `a` and `b`. Your task is to implement a function or method to find the length of the longest common subsequence (LCS) of `a` and `b`. A subsequence is a sequence that can be derived from another sequence by deleting some or no elements without changing the order of the remaining elements. Th...
codefeedback
You are tasked with implementing a smooth scrolling feature for a RecyclerView in an Android application. The smooth scrolling is achieved using a SmoothScroller object, which is responsible for animating the scrolling behavior. The provided code snippet is a part of the implementation of the smooth scrolling functiona...
codefeedback
You are tasked with implementing a Python class that manages the display range of a graph. The class should inherit from another class and override certain methods to achieve the desired functionality. You are given the following code snippet as a starting point: ```python class DisplayAll: def __init__(self, ax,...
codefeedback
You are tasked with implementing a function that processes product images for a given product. The function should take a `ProductItem` object and an array of images as input, and perform image processing operations on the product's images. The goal is to resize and optimize the images before saving them. You are prov...
codefeedback
You are tasked with implementing a Python function that processes a dictionary of parameters and returns a formatted string representing the key-value pairs. The function should handle nested dictionaries and output the key-value pairs in a specific format. You are given the following code snippet as a starting point:...
codefeedback
You are working on a software system that manages a collection of labels. Each label has an associated boolean value, and the system allows for the removal of labels based on certain conditions. You are given a code snippet that performs label removal based on a random selection and the associated boolean value. Your ...
codefeedback
You are tasked with implementing a function that extracts the class names from a given HTML code snippet. The function should take the HTML code as input and return a list of unique class names found within the code. Function Signature: `def extract_class_names(html_code: str) -> List[str]` Example: For the given HTM...
codefeedback
You are tasked with implementing a generic data structure that supports type-safe storage and retrieval of elements. The data structure should allow storing elements of any type and provide a mechanism to retrieve the stored elements with their original type information intact. Your task is to implement the `TypedStora...
codefeedback
You are tasked with creating a Python function that generates a schedule for renewing quote cards in a financial data processing system. The function should take in the start date, schedule interval, and default arguments, and return a schedule configuration in the form of a Directed Acyclic Graph (DAG) object. The sc...
codefeedback
You are tasked with creating a Python script that manipulates JSON data. Your script should perform the following tasks: 1. Read data from a JSON file named `example.json`. 2. Remove a specific key-value pair from the JSON data. 3. Write the modified JSON data back to the same file. Your script should handle the case ...
codefeedback
You are required to implement a Python class `Solution` that contains a method `subsets` which takes a list of integers `nums` as input and returns all possible subsets of the input list. For example, given the input `nums = [1, 2, 3]`, the method should return a list of lists containing all possible subsets: `[[], [1...
codefeedback
You are tasked with implementing a function that processes images based on certain conditions. The function takes in three parameters: `im` (an input image), `args` (a dictionary of arguments), and `im_size_max` (the maximum size of the image). The function first checks if the value of `args.crop` is not equal to "True...
codefeedback
You are tasked with creating a context manager in Python that logs the time taken for a specific operation using the `logging` module. The context manager should also handle exceptions that may occur during the operation and log them appropriately. Additionally, the context manager should support the use of different d...
codefeedback
You are tasked with implementing a custom data structure in Swift that mimics the behavior of a stack but has an additional method to efficiently retrieve the minimum element in the stack. You need to design the data structure to support the following operations: 1. `push(val)`: Add an element `val` to the top of the s...
codefeedback
You are tasked with creating a script to process a set of files using a command-line tool and then display a summary message. The script should iterate through a list of files in a specific directory, apply a command-line tool called "minim" to each file, and suppress any output from the tool. Once all files have been ...
codefeedback
You are tasked with implementing a custom list view in a mobile app using SwiftUI. The app should display a list of navigation links, each leading to a different page. Each navigation link should have a label with an icon and, optionally, a subtitle. Your task is to create a SwiftUI view that fulfills these requirement...
codefeedback
You are tasked with creating a Python function that processes data related to COVID-19 deaths and makes predictions using different methods. The function takes in a dataframe `df`, a string `method` indicating the prediction method, and other relevant parameters. The code snippet provided is a part of the function and ...
codefeedback
You are tasked with parsing and extracting data from HTML table cells. Given an HTML table row represented by the following code snippet: ```html <tr> <td style="width: 3%"><p style="font-size: 12px; margin-left: 10px">3.</p></td> <td style="width: 40%"><p style="font-size: 12px; margin-left: 1px">Tindakan yan...
codefeedback
You are tasked with creating a Python function that establishes a secure connection to a CockroachDB instance hosted on Google Cloud Platform (GCP). The function should utilize the provided connection parameters to establish a secure connection to the database. The connection parameters are as follows: - `password`: T...
codefeedback
You are tasked with implementing a function that calculates the average score of students in a class. The function should take in a list of student scores and return the average score rounded to the nearest integer. If the average score is exactly halfway between two integers, it should be rounded up. Function Signatu...
codefeedback
You are tasked with implementing a parser for a custom Extended Context-Free Grammar (ECFG) format. The ECFG format is a variation of the traditional Context-Free Grammar (CFG) used in formal language theory. The grammar consists of a set of production rules, each defining how a non-terminal symbol can be expanded into...
codefeedback
You are tasked with creating a Python decorator that checks if a user has the required roles to access a specific function. The `role_required` decorator takes in four boolean parameters: `student`, `teacher`, `cd` (course director), and `admin`, indicating whether the user must have these roles to access the decorated...
codefeedback
You are working for a sports analytics company that wants to analyze the performance of basketball players based on their average score, handedness, and other attributes. The company has provided you with a dataset in the form of a pandas DataFrame named `df`. The DataFrame contains the following columns: 'name' (playe...
codefeedback
You are tasked with implementing a genetic algorithm to solve a simple optimization problem. The genetic algorithm operates on a population of candidate solutions, where each candidate solution is represented as a chromosome. The genetic algorithm involves parent selection and variation to produce new candidate solutio...
codefeedback
You are tasked with implementing a program to solve the "Mastermind" game. In this game, one player (the "codebreaker") tries to guess the secret code chosen by the other player (the "codemaker"). The secret code is a sequence of four colored pegs chosen from six possible colors. After each guess, the codemaker provide...
codefeedback
You are tasked with implementing a class that processes and manipulates data strings based on a given character bound. The class should have a property for the character bound and another property for the data string. The character bound represents the maximum Unicode code point value allowed in the data string. You ne...
codefeedback
You are tasked with creating a program that analyzes the frequency of words in a given text and returns the most frequently occurring word(s). Your program should ignore common English words (e.g., "the", "and", "is") and be case-insensitive. If there are multiple words with the same highest frequency, return all of th...
codefeedback
You are tasked with implementing a function to validate user nicknames based on the following criteria: 1. The nickname must be at least 6 characters long. 2. The nickname can only contain alphanumeric characters (a-z, A-Z, 0-9). 3. The nickname must start with an uppercase letter. You need to implement the function `...
codefeedback
You are given a set of sensor data that includes sensor IDs, timestamps, and sensor readings. The sensor IDs are randomly generated integers between 1001 and 2000. The timestamps are generated at 15-minute intervals for a period of 1000 intervals starting from the current date and time. The sensor readings are generate...
codefeedback
You are tasked with implementing a trait for a bitmap font in Rust. The trait, `ToBitmapFont`, has three methods: `bitmap_height`, `bitmap_width`, and `font_size`. Your goal is to create a struct that implements this trait and returns the appropriate values for each method. The `ToBitmapFont` trait is defined as follo...
codefeedback
You are tasked with implementing a disassembler for a custom instruction set architecture (ISA). The disassembler should be able to convert machine code instructions into human-readable assembly language mnemonics. The provided code snippet imports a module named "disassembler" which contains the necessary functionalit...
codefeedback
You are tasked with creating a program that utilizes the AWS Rekognition service to detect labels in images. The AWS Rekognition service provides an API for image analysis, including label detection, facial analysis, and text recognition. In this problem, you will be focusing on the label detection functionality. Your...
codefeedback
You are tasked with creating a PHP class that can parse XML data and extract specific information from it. Your class should be able to handle XML data from a Sonos music system and extract details about the music library. Your task is to create a class called `SonosXmlParser` with a method `getMusicLibrary` that take...
codefeedback
You are working for a biotechnology company that is conducting research on the production of certain genes under different temperature conditions. The company has collected data on the production levels of each gene under two different temperature conditions and the associated induction costs. Your task is to write a P...
codefeedback
You are tasked with implementing a blockchain network using Python and Flask. The provided code snippet is a part of a Flask web application that handles the replacement of the blockchain chain in response to a GET request to the '/replace_chain' endpoint. The `replace_chain` function is called when this endpoint is ac...
codefeedback
You are tasked with creating a Bash script that automatically installs the Git Tab Completion script from a specified link. The script should be able to download the script from the provided URL and install it in the appropriate directory. Your task is to write a Bash script that accomplishes the following: 1. Set the...
codefeedback
You are tasked with creating a script to automate the installation of essential web development tools on a Linux system. The script should install Node.js, Apache, and MySQL. Your script should handle the installation process for each tool, including any necessary dependencies and system updates. Your script should pe...
codefeedback
You are tasked with implementing a function to reconstruct a 32-bit integer from a given set of operations and bit manipulations. The function `_bit_reconstruction_and_f` takes an optional boolean parameter `xor_x4` and returns an integer or None. The function utilizes several helper functions and variables, including ...
codefeedback
You are tasked with implementing a function that processes a series of graph queries and returns the results based on the given graph structure. The graph is represented using the OdinGraph library, which provides methods for querying and manipulating graph data. The graph consists of nodes and directed edges, where e...
codefeedback
You are tasked with implementing a program to find all prime numbers up to a given limit using the Sieve of Eratosthenes algorithm. The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to a specified integer. It works by iteratively marking the multiples of each prime number starting from ...
codefeedback
You are given a 2D image represented as a 2D array of integers. Your task is to implement a function `pixelate(image_array, pixel_size, gradation_number)` that pixelates the image by replacing each pixel block with the average color value of that block. The pixelation process involves dividing the image into non-overla...
codefeedback
You are tasked with simulating a simple text formatting and printing system. The system provides a set of commands to control the formatting and printing of text. Your goal is to implement a program that processes a sequence of commands and text content, and produces the formatted output. The commands available are: -...
codefeedback
You are given a Python code snippet that performs clustering using either KMeans or LouvainB algorithm. The code snippet is part of a larger program that processes data and performs clustering based on certain criteria. Your task is to implement a function that takes the clustering results and calculates the silhouette...
codefeedback
You are working on a project to convert Keras models to ONNX format for interoperability with other deep learning frameworks. As part of this project, you need to implement a function that extracts the computational graph from a Keras model and converts it to ONNX format. You are given a code snippet that shows part o...
codefeedback
You are tasked with creating a custom JSON serializer for a Java class using Google's Gson library. The class `Person` represents a person's information and has the following fields: - `name` (String): the person's name - `age` (int): the person's age - `email` (String): the person's email address Your task is to crea...
codefeedback
You are tasked with implementing a function that processes binary data to populate a nested HashMap structure in Rust. The function is expected to read binary data and construct a HashMap with String keys and nested HashMap values containing usize keys and String values. The provided code snippet serves as a starting p...
codefeedback
You are tasked with creating a command-line interface (CLI) for a screen capture application. The application should allow users to specify various configuration options through command-line arguments. Your task is to implement a parser for these command-line arguments using the C++ library `CLI11`. The provided code ...
codefeedback
You are tasked with creating a program that processes SVG (Scalable Vector Graphics) data to extract and manipulate specific attributes. SVG data is represented as a string containing various attributes and values. For this problem, you need to extract the `viewBox` attribute and the `fill` attribute from the SVG data ...
codefeedback
You are tasked with creating a custom storage class for a Django project that will store media files on Amazon S3 using the `S3Boto3Storage` backend. Your custom storage class should have the following features: 1. The class should be named `CustomMediaStorage`. 2. It should inherit from `S3Boto3Storage`. 3. The media...
codefeedback
You are tasked with implementing a function to compute the Cavg (average cost) for a given set of language recognition pairs. The Cavg is calculated using several threshold bins within a specified score range. The function `get_cavg` takes the following parameters: - `pairs`: A list of language recognition pairs, where...
codefeedback
You are tasked with creating a Django signal handler that automatically creates a corresponding `UserSocialAuth` instance whenever a new `User` instance is created. The `User` model is provided by the `django.contrib.auth.models` module, and the `UserSocialAuth` model is provided by the `social_django.models` module. ...
codefeedback
You are tasked with implementing a function to generate a message for posting on a social media platform. The message should be created based on a set of predefined rules and should be suitable for posting on a user's feed. The function should take into account the user's preferences and generate a message accordingly....
codefeedback
You are tasked with implementing a log hierarchy builder for a dataset containing Huawei device logs. The given code snippet is a part of this implementation. The `huawei_df` dataframe contains the Huawei device logs, and the goal is to construct a log hierarchy based on certain relevant columns. The `tqdm` function is...
codefeedback
You are tasked with creating a Bash script that configures proxy settings based on user input. The script should take three arguments: proxy type, proxy address, and port number. If the script is executed with fewer than three arguments, it should display an error message and exit. If the script receives the correct nu...
codefeedback
You are tasked with creating a Python script that interacts with various .NET libraries to perform geometric operations within the context of Autodesk Revit. The script should utilize the `clr` module to add references to the required .NET assemblies and import necessary namespaces to access the functionality provided ...
codefeedback
You are tasked with implementing a Python function that can determine the execution order of a series of functions based on their dependencies. Each function has a unique identifier and may depend on the output of other functions. Your task is to create a function that takes a list of tuples, where each tuple represent...
codefeedback
You are tasked with implementing a custom asynchronous wait mechanism in Java. Your task is to create a class that provides a method for waiting until a specified condition is met. The condition will be checked repeatedly until it evaluates to true. You are provided with the following interface: ```java public interf...
codefeedback
You are tasked with creating a program that simulates a simple text-based game. The game involves a character navigating through a series of challenges and making decisions based on input. The character's goal is to reach a specific destination by following a set of rules. The provided code snippet is a part of the ga...
codefeedback
You are given a list of integers `a` of length `n`. Your task is to write a function to calculate the median of the list. The median of a list of numbers is the middle number when the list is sorted. If the list has an odd number of elements, the median is the middle element. If the list has an even number of elements,...
codefeedback
You are tasked with implementing a C++ template meta-programming problem. Your goal is to create a meta-function that takes a set of sequences and an index, and returns a new sequence containing the elements at the specified index from each input sequence. You are provided with a code snippet that contains a partial i...
codefeedback
You are tasked with implementing a file management system for a survey application. The system should allow users to remove files and manage the validity of different sections of the survey. The application variables `answers` and `sectionsValidity` are used to store the survey responses and the validity status of diff...
codefeedback
You are tasked with writing a Python function that parses a given HTML text and extracts the content within the `<span>` tags. The function should return a list of strings containing the text within the `<span>` tags in the order they appear in the HTML text. Write a function `extract_span_content(html_txt: str) -> Li...
codefeedback
You are tasked with creating a simple authentication middleware for an Apollo GraphQL server. The middleware should intercept incoming requests, check for a valid authentication token, and attach the authenticated user's information to the request context before passing it to the resolver functions. The provided code ...
codefeedback
You are tasked with implementing a module for handling quoted strings in a programming language. The module should provide functionality to parse and manipulate quoted strings in a given input. Your task is to implement the `quoted_string` module with the following requirements: 1. The module should contain a function...
codefeedback
You are tasked with creating a Python class that represents a podcast channel and its episodes. The class should have methods to add episodes, generate an XML feed, and generate an HTML representation of the channel. Your task is to implement the `PodcastChannel` class with the following requirements: - The class shou...
codefeedback
You are tasked with creating a Python program that interacts with the Baidu AI NLP (Natural Language Processing) API to analyze the parts of speech of Chinese words. The given code snippet demonstrates the usage of the AipNlp client to process the Chinese sentence "我爱米思齐" (which translates to "I love Messi") and extrac...
codefeedback
You are given a Python code snippet that involves the creation of grid cells using the `addGridCell` method. The method takes several parameters to define the position and boundaries of the grid cell. Your task is to create a program that simulates the behavior of the `addGridCell` method and its associated grid cells....
codefeedback
You are tasked with implementing a function to calculate the presentation timestamp (PTS) of video frames based on the given code snippet. The code snippet is a part of a video decoding process and involves the use of FFmpeg library functions. Your task is to write a function that takes the necessary input parameters a...
codefeedback
You are tasked with implementing a graph data structure in Python. Specifically, you need to create a method to add an edge to a vertex in the graph. The graph is represented using an adjacency list, and each vertex has a list of edges incident to it. You are given the following code snippet for the `add_edge` method ...
codefeedback
You are tasked with implementing a tile caching system for a navigation mesh in a game development project. The provided code snippet initializes a navigation mesh and a tile cache, and then returns the tile cache instance. Your goal is to complete the implementation by defining the necessary parameters and processes f...
codefeedback
You are tasked with creating a script to automate the generation of PBS (Portable Batch System) job scripts for running a series of Vaa3D image processing tasks in a high-performance computing environment. The script should take into account the specific file paths and parameters required for each job script. Your tas...
codefeedback
You are tasked with implementing a command-line tool for managing a gargantua, a powerful entity in a fictional universe. The tool should support creating or starting a gargantua, stopping it, and destroying it. Additionally, it should provide an option to display a help message. The tool should accept the following c...
codefeedback
You are tasked with implementing a custom dataset class for image classification using PyTorch. The dataset class, named `FollowSuit`, should be designed to load image indexes and class label annotations from a CSV file. Your task is to complete the `FollowSuit` class by implementing the necessary methods to load and p...
codefeedback
You are given a string representing a grid of seats in a movie theater. Each character in the string represents a seat, where 'L' indicates an empty seat and '.' indicates an occupied seat. The grid is represented as a single string, with each row of the theater concatenated together. Your task is to write a function ...
codefeedback