instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with writing a shell script to automate the installation of specific software versions. The script should utilize the environment variables provided and install the corresponding software versions using the appropriate package manager. Given the following environment variables: ``` export gdsVersion="1....
codefeedback
You are tasked with implementing a Python function that takes a string as input and converts all special characters and Unicode characters into their respective hex-escaped representations. The function should follow the steps outlined in the given code snippet to achieve this conversion. Your task is to complete the ...
codefeedback
You are tasked with creating a Python class that manages permissions for a Django web application. The class should allow for the registration and management of different types of permissions within the application. Your task is to implement a `PermissionManager` class with the following requirements: - The class shou...
codefeedback
You are tasked with implementing a custom exception class in PHP that extends the built-in `Exception` class. Your custom exception class should have a constructor that accepts a message and an optional previous exception. Your task is to create a PHP class called `CustomException` that extends the `Exception` class a...
codefeedback
You are working on a software testing system for a city's infrastructure management. The system maintains a queue of items to be tested, and each item can be in one of several states. You need to implement a class to manage the testing queue and its items. You are given a partial code snippet for a Python class that r...
codefeedback
You are tasked with creating a Python script that processes a collection of blog entries and generates a static website using the `staticjinja` library. Each blog entry is stored in a separate JSON file and contains metadata such as title, author, date, and content. Your script should read these JSON files, process the...
codefeedback
You are tasked with implementing a course management system that allows users to update specific fields of a course. The system provides a function `_get_course_field` to obtain the field to be updated for a given course. Additionally, there is a function that checks if a course name matches the provided name and retur...
codefeedback
You are tasked with writing a script to extract information from a build configuration file and generate a JSON file based on certain conditions. The script should extract the version, device, ROM type, and variant from the build configuration file and create a JSON file with specific naming conventions. Given the fol...
codefeedback
You are tasked with implementing a Python decorator that validates the configuration keys for a task class. The code snippet provided showcases the usage of the `@with_config_key` decorator to validate configuration keys for a `WriterTask` class. Your goal is to create a decorator that ensures the presence of specific ...
codefeedback
You are tasked with implementing a class that represents an HTML tag. The class should have the ability to create an HTML tag with a specified tag type and tag name. Your task is to complete the implementation of the `HtmlTag` class by adding a method that generates the opening tag based on the tag type and name provid...
codefeedback
You are tasked with implementing a TypeScript function that simulates the behavior of the `ReflectDefineMetadata` function. The `ReflectDefineMetadata` function is used to define metadata on a target object or property. The metadata can be any arbitrary value associated with a specific key. You are provided with the f...
codefeedback
You are tasked with implementing a function to perform random image augmentation for a given input image. The function should apply random shifts to the input image based on specified ranges for height and width shifts. The shifts are to be applied using the following logic: 1. If the `height_shift_range` is non-zero,...
codefeedback
You are tasked with creating a function that processes a given object containing asynchronous import functions and returns a modified object with the imported raw data. The input object has the following structure: ```javascript { readme: async () => import("!!raw-loader!./readme.md"), files: () => [ { name: "2...
codefeedback
You are tasked with implementing a custom data structure that simulates a circular buffer. A circular buffer is a fixed-size buffer that wraps around when it reaches its capacity, effectively overwriting the oldest elements with the newest ones. Your task is to implement the `CircularBuffer` class with the following me...
codefeedback
You are given a Rust code snippet that contains assertions using the `assert_eq!` macro. The assertions compare the result of a range lookup with a color value. The `range` is a collection of colors, and the lookup is performed using the `min` function with different parameters. Your task is to implement the `min` func...
codefeedback
You are tasked with implementing a logging module for a .NET application using the ABP (ASP.NET Boilerplate) framework. The module should integrate with the Castle Windsor dependency injection container and utilize the Log4Net logging library for logging messages. Your task is to create a class that configures and ini...
codefeedback
You are tasked with creating a Python class that represents a factory part and its associated attributes. The factory part can be of different types, such as a table or a node, and it interacts with other components in the factory. Your task is to implement the `FactoryPart` class and its subclasses, and ensure that th...
codefeedback
You are tasked with creating a Rust module that manages sprite sheets for a 2D game. The module should provide functionality to load sprite sheet configurations and manage the corresponding textures. You are given a code snippet that imports two items from external modules: `SpriteSheetConfig` from the `fortress_bake::...
codefeedback
You are tasked with implementing a simple behavior-based robot control system using Python. The robot has three behaviors: move to a specific point, catch an object, and move back to a specific point. The robot's behaviors are triggered by messages received from a ROS (Robot Operating System) topic. The provided code ...
codefeedback
You are working on a project that involves evaluating the performance of a model that predicts certain outcomes. As part of this evaluation, you need to implement a function that calculates a specific loss metric based on the predicted and ground truth values. The code snippet provided is a part of the loss calculation...
codefeedback
You are tasked with implementing a Python module that interacts with various event handling functions. The module should provide both synchronous and asynchronous versions of the functions for retrieving and posting events. You are given the following code snippet as a starting point: ```python from .wrappers import g...
codefeedback
You are tasked with implementing a parser for a subset of the C++ programming language. The given code snippet is a part of a C++ parser implemented using the GLR Parser (glrp) framework. The parser is responsible for handling abstract declarators and pointer abstract declarators in C++. An abstract declarator in C++ ...
codefeedback
You are tasked with implementing a class to represent an edge pair in a graph. The class should provide functionality to store and retrieve information about the two vertices connected by the edge, as well as any associated weight. Additionally, the class should support comparison operations to determine equality betwe...
codefeedback
You are tasked with implementing a collectible system for a game using Unity and C#. The game features different types of collectible items, each with its own unique properties. Your goal is to create a system that allows the player to collect these items and keep track of the collected items in a data structure. You ...
codefeedback
You are given an array of integers representing the weights of items and a maximum weight capacity. Your task is to find the maximum total weight that can be carried by selecting a subset of the items, such that the total weight does not exceed the maximum weight capacity. You need to implement a function `maxTotalWei...
codefeedback
You are tasked with implementing a Python class that manages software packages. The class should have the ability to track whether a package needs a specific operation, such as "lipo," to be performed on it. Your task is to implement the `Package` class with the following specifications: - The class should have an att...
codefeedback
You are tasked with creating a Python decorator that logs the execution time of a function. The decorator should print the name of the function, its execution time, and the arguments passed to the function. Your task is to implement the `@log_execution_time` decorator and apply it to a sample function. Your decorator ...
codefeedback
You are working on a natural language processing (NLP) project and have been tasked with implementing a text classification pipeline using a machine learning model. The pipeline consists of a series of preprocessing, feature extraction, and model training steps. You are provided with a code snippet that includes a pred...
codefeedback
You are working on a Python package for a graphical user interface (GUI) application. The package contains several modules, including `palette.py`, `theme.py`, and `template.py`. Each of these modules is responsible for a specific aspect of the GUI design and functionality. Your task is to create a function that will ...
codefeedback
You are tasked with implementing a parser for a simple programming language that supports positional and named arguments in function calls. The given code snippet represents part of the data structures used in the parser. The `Argument` enum has two variants: 1. `Positional(Expression)`: Represents a positional argume...
codefeedback
You are tasked with implementing a shell script function that sorts a list of numbers in ascending order. The function should take a list of numbers as input and return the sorted list. The sorting algorithm to be used is the bubble sort algorithm. You are provided with a partial code snippet for the shell script func...
codefeedback
You are tasked with implementing a custom tag handler for a configuration management system. The tag handler, called `GlobHandler`, is responsible for processing glob patterns within configuration files and expanding them into a list of file paths. The `GlobHandler` should support basic glob patterns such as `*`, `?`, ...
codefeedback
You are tasked with implementing a custom paging view in Swift. The provided code snippet includes a protocol `PageContentViewDelegate` and a class `PageContentView` that will be used to create the paging view. Your task is to complete the implementation of the `PageContentView` class by adding the necessary propertie...
codefeedback
You are tasked with creating a program that manages a legacy mode flag and performs operations based on its value. The legacy mode flag is initially set to `false`. Your program should provide functionality to toggle the legacy mode flag and execute different operations based on its state. Your task is to implement a ...
codefeedback
You are tasked with creating a Python class that interacts with Google's mobility report data. The class should have a method to load the report from Google, with the option to filter by a country region code and to cache the report. Additionally, the class should have a default report URL and the ability to show progr...
codefeedback
You are tasked with implementing a function to perform non-IID (non-identically distributed) data partitioning for a given dataset. Non-IID data partitioning is a technique commonly used in federated learning, where data is distributed among multiple clients in a non-uniform manner to simulate real-world scenarios wher...
codefeedback
You are given a string `T` consisting of lowercase English letters. Your task is to write a function that returns the longest substring of `T` that contains at most two distinct characters. If there are multiple such substrings with the same length, return the first occurring substring. For example, given the input st...
codefeedback
You are tasked with creating a program that monitors the CPU usage of a given process on a Windows system. The program should retrieve the CPU usage as a percentage and display it to the user. To achieve this, you will need to utilize the Windows API functions for retrieving system and process times, and then calculate...
codefeedback
You are working on a task management system that involves importing tasks from various sources. The given code snippet is a function `task_imports` that returns a list of task modules to be imported. Each module contains task definitions that need to be integrated into the system. Your task is to implement a function ...
codefeedback
You are tasked with implementing a BookManager class that manages a collection of books. The class should have the following functionalities: 1. Add a book to the collection. 2. Remove a book from the collection based on its title. 3. List all the books in the collection. You are provided with a partial implementatio...
codefeedback
You are tasked with implementing a Python function that generates a banner of a specified width and height, with a given message centered within the banner. The banner will be composed of horizontal and vertical characters, and the message will be surrounded by these characters to form a border. Your task is to write a...
codefeedback
You are tasked with implementing a class called `Selection` that monitors the system clipboard for changes and retrieves the new content at regular intervals. Your task is to complete the `Selection` class by implementing the `get_str` method to achieve this functionality. The `Selection` class has the following attri...
codefeedback
You are tasked with creating a program that can analyze the structure of an HTML file and determine if all the opening tags have corresponding closing tags. For the purpose of this problem, an HTML tag is defined as a string enclosed in angle brackets, such as `<html>`, `<body>`, or `<div>`. Opening tags are denoted by...
codefeedback
You are tasked with implementing a custom cost function for detecting abrupt changes in time series data. The `ruptures` library provides a `BaseCost` class that serves as the foundation for creating custom cost functions. Your goal is to create a new cost function by subclassing `BaseCost` and implementing the require...
codefeedback
You are tasked with creating a serverless application using AWS CDK (Cloud Development Kit) in Python. Your goal is to set up a serverless stack that includes AWS X-Ray for tracing and monitoring the application's performance. The provided code snippet initializes the serverless stack and synthesizes the application. ...
codefeedback
You are tasked with implementing a data synchronization mechanism for a sensor fusion system. The system receives data from two sensors: an accelerometer and a gyroscope. The provided code snippet is a part of the synchronization logic, which checks if the data from the accelerometer and gyroscope has been updated. Th...
codefeedback
You are tasked with implementing a Python function that performs deconvolution on a given input signal using the Richardson-Lucy algorithm. Deconvolution is a process used to reverse the effects of convolution, which is a mathematical operation commonly used in signal processing and image processing. The Richardson-Luc...
codefeedback
You are tasked with creating a Python script that analyzes a given `setup.py` file and extracts specific information from it. The `setup.py` file is used to describe the metadata about the Python package, including its dependencies, license, and description. Your task is to write a function `extract_package_info` that...
codefeedback
You are tasked with implementing a class that simulates a creature's combat cooldown mechanism. The creature has a combat cooldown value that needs to be decremented until it reaches 0. The provided code snippet shows the `onUpdate` method of the creature's class, which is called periodically to update the creature's s...
codefeedback
You are tasked with creating a Python script to automate the process of generating and publishing content for a website. The script should load data, generate works and a timeline, build the HTML files, and then publish the output to a remote server using rsync over SSH. Your task is to implement the Python script to ...
codefeedback
You are tasked with implementing a Python class that creates a proxy object to delegate method calls to a wrapped object. The proxy object should have an attribute named `_wrapped` that holds the wrapped object. When a method is called on the proxy object, it should delegate the call to the corresponding method of the ...
codefeedback
You are tasked with implementing a Python function that manipulates date and time information using the `pyepoch` library. The `pyepoch` library provides functionality for working with dates and times in various timezones. Your task is to complete the implementation of the `timezone()` function, which takes a date and ...
codefeedback
You are tasked with implementing a function that processes a list of tuples representing field configurations for a user interface. Each tuple consists of a string representing the field group name and a dictionary containing the field names. The function should return a dictionary where the keys are the field group na...
codefeedback
You are tasked with creating a program that analyzes a given text file to count the occurrences of specific words. The program should read the text file, identify the specified words, and output the count of each word. You are given a text file named "sample_text.txt" containing the following content: ``` Lorem ipsum ...
codefeedback
You are tasked with creating a unit test for a class that manages the configuration of a package manager. The class has a method `getComposerBinDirectory` which should return the path to the vendor's binary directory. To facilitate testing, the code uses vfsStream, a virtual file system for testing purposes. The provid...
codefeedback
You are tasked with implementing a Python function that performs a specific operation on a given list of integers. The function should take a list of integers as input and return a new list containing the cumulative sum of the input list. The cumulative sum at each index in the output list should be the sum of all the ...
codefeedback
You are tasked with implementing a rendering system for a 3D graphics application. The given code snippet is part of the rendering process and involves setting up the rendering encoder to draw indexed primitives for a mesh using a color map texture. Your task is to write a function that takes in the necessary paramete...
codefeedback
You are tasked with creating a Python class to represent a chess game and implementing a method to determine all possible moves for a given piece on the board. The chess board is represented as an 8x8 grid, and the pieces are represented by their respective characters ('K' for king, 'Q' for queen, 'R' for rook, 'B' for...
codefeedback
You are tasked with implementing a Python class that represents a beacon block for a blockchain system. The beacon block consists of a beacon block body and has a generic type parameter. Your goal is to create the class and implement a method that returns a string representation of the beacon block. You are provided w...
codefeedback
You are tasked with implementing a command-line argument parser for a PHP application. The parser should extract and validate command-line arguments based on the provided route and controller action information. You are given a code snippet that retrieves information about the controller action using the Reflection AP...
codefeedback
You are tasked with implementing a Swift enumeration and its associated properties to represent different box dimensions. The enumeration should have cases for box height, box rotate angle, box slant angle, and box width. Each case should have an associated value of a custom type `SDAI` which has properties `realValue`...
codefeedback
You are tasked with creating a script that automates the setup process for a developer's environment. The script should execute a series of sub-scripts to install and configure various tools and settings. Each sub-script is responsible for a specific task, such as setting up Visual Studio Code, installing npm packages,...
codefeedback
You are tasked with creating a custom authentication strategy for a Node.js application using the NestJS framework. The application uses JSON Web Tokens (JWT) for authentication and authorization. Your goal is to implement a JwtStrategy class that extends the PassportStrategy class and uses the passport-jwt library to ...
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 balance. Additionally, the class should have a method for applying interest to the account balance. The interest should be calculated based on a giv...
codefeedback
You are tasked with implementing a message encoder for a schema registry system. The schema registry system is responsible for encoding and decoding messages based on predefined schemas. Your goal is to create a class that can encode messages according to the schema rules. You are provided with an interface `ISchemaRe...
codefeedback
You are tasked with implementing a simple result-keeping system for a sports tournament. The provided code snippet includes the import of a `ResultKeeper` module and its associated types and functions. The `ResultKeeper` module is responsible for managing and displaying the results and standings of players in the tourn...
codefeedback
You are tasked with creating a custom error handling mechanism for a file processing application. The application needs to handle errors related to file operations and provide detailed error messages for debugging purposes. Your task is to implement a custom error type and a function to handle errors related to file op...
codefeedback
You are given a code snippet from a C header file that defines various constants for different peripherals in a microcontroller. Your task is to write a program that parses this code snippet and extracts the peripheral names and their corresponding values. Write a function `parsePeripheralConstants` that takes a strin...
codefeedback
You are given a Python script that reads integers from a file and processes them in a sliding window. Your task is to complete the script by implementing the sliding window logic and counting the number of times a specific condition is met. The script reads integers from a file named "input.txt" and initializes a slid...
codefeedback
You are tasked with implementing a Python class that manages a collection of neural network layers for a reinforcement learning system. The class should provide methods for adding different types of layers, such as DenseEmbeddingNet, QNet, CNNEmbeddingNet, PolicyNet, and ValueNet, and for retrieving specific layers bas...
codefeedback
You are tasked with implementing a Python class that represents a user's profile. The class should have attributes for the user's name, age, email, and access token. Additionally, you need to implement a method that returns a string representation of the user's profile, excluding any attributes that start with an under...
codefeedback
You are working as a DevOps engineer for a software company that develops Python packages. As part of the continuous integration and deployment process, you need to automate the deployment of a Python package to the Python Package Index (PyPI) using the `devpi` tool. The deployment process involves pushing the package ...
codefeedback
You are tasked with creating a program that interacts with a web API to retrieve data. Your program should send an HTTP request with specific content and handle the response appropriately. You are given a code snippet that demonstrates how to send the request and handle the response using C# and the HttpClient class. ...
codefeedback
You are tasked with creating a Python script to automate the process of creating an AWS CloudFormation stack for a VPC (Virtual Private Cloud) using the AWS CLI. Your script should handle the execution of the CloudFormation command and provide appropriate feedback based on the success or failure of the stack creation. ...
codefeedback
You are tasked with creating a Python program that processes metadata from a software development project. The metadata is provided as a list of strings, where each string represents a line of metadata. Each line contains a key-value pair separated by a double colon (::). Your program needs to extract specific informat...
codefeedback
You are tasked with implementing a function to generate big rules from frequent itemsets. Given a list of frequent itemsets `L`, a dictionary `support_data` containing the support for each itemset, and a minimal confidence `min_conf`, you need to generate all big rules. Each big rule is represented as a 3-tuple contain...
codefeedback
You are tasked with creating a program that can extract and display information from HTML tags. Specifically, you need to write a function that can extract the text content from an HTML `<h6>` tag with specific attributes and display it. Write a function `extractH6Text` that takes in a string of HTML content and retur...
codefeedback
You are tasked with implementing a function to determine whether two given arrays of strings are isomorphic. Two arrays of strings are considered isomorphic if they have the same length and there exists a one-to-one mapping of the elements from one array to the other, such that the order is preserved. In other words, e...
codefeedback
You are tasked with implementing a Python class that provides serialization and JSON conversion functionality for its instances. The provided code snippet outlines a basic structure for this class, but it is incomplete. Your task is to complete the class definition and implement the required methods to achieve the desi...
codefeedback
You are tasked with implementing a scoring system for a web application. The system should allow users to submit scores for specific categories and then publish those scores. You are provided with a code snippet from a Node.js application that handles the publishing of scores. Your task is to complete the implementatio...
codefeedback
You are tasked with creating a Python program that handles custom exceptions related to test functions and test class names in an exam management system. The program should define two custom exception classes, `TestFuncNameError` and `TestClassNameError`, to handle errors when the test function name is wrong and when t...
codefeedback
You are tasked with simulating a simplified trading system using object-oriented programming concepts. Your goal is to create a Trade class that models a trade in a financial market. The Trade class should have methods to open and close trades, as well as to create market orders. Additionally, you need to implement a T...
codefeedback
You are given a code snippet that involves signal processing using the Discrete Fourier Transform (DFT) and visualization using Python's matplotlib library. Your task is to write a Python function that calculates the negative frequency magnitude spectrum and plots it alongside the positive frequency magnitude spectrum....
codefeedback
You are given a list of lists containing integers. Each inner list represents a row of a 2D grid. The integers in each row are sorted in ascending order. However, the integers in each row are not necessarily in ascending order relative to the integers in other rows. Your task is to write a function that efficiently fin...
codefeedback
You are tasked with creating a script to simulate a simple dice game using the Bash scripting language. The game involves rolling a six-sided die multiple times and keeping track of the outcomes. Your script should generate random numbers to simulate the dice rolls and then display the frequency of each outcome. Your ...
codefeedback
You are tasked with implementing a temperature scheduler for a smart home system. The `run_temp_scheduler()` function is responsible for controlling the temperature settings based on the time of day and the current temperature. The function takes no parameters and returns no value. It operates by querying the current t...
codefeedback
You are tasked with creating a Swift function that retrieves a list of knowledge articles related to a specific case from a Salesforce Service Cloud instance. You will be utilizing the Salesforce Mobile SDK for iOS to achieve this. Your function should take in the case ID as a parameter and return an array of knowledg...
codefeedback
You are tasked with creating a program to simulate a simple game of "Whack-a-Mole". In this game, the player must tap on randomly appearing moles to earn points. The moles will appear at random positions on a grid, and the player must tap on them before they disappear to earn points. If the player taps on a mole, they ...
codefeedback
You are tasked with creating a Python function that parses a time interval string and returns the total number of seconds it represents. The time interval string can have the following format: "X days, HH:MM:SS" or "HH:MM:SS" where X is the number of days, HH is the number of hours, MM is the number of minutes, and SS ...
codefeedback
You are tasked with creating a script to automate the process of sparsifying a neural network model using a given code snippet as inspiration. The script should iterate through different sparsity levels and perform the necessary operations to create sparse model files and weight files. The script should perform the f...
codefeedback
You are tasked with implementing a throttle controller for an autonomous vehicle. The vehicle's throttle control system is represented by a Proportional-Integral-Derivative (PID) controller. The PID controller takes in the vehicle's mass, fuel capacity, brake deadband, deceleration limit, acceleration limit, wheel radi...
codefeedback
You are tasked with implementing a simple geometric application in Rust. You are given a code snippet defining a trait and a function signature. Your goal is to create a struct and implement the trait for the struct to calculate the distance of the point from the origin. The code snippet provided is as follows: ```rus...
codefeedback
You are given a list of integers representing the frequency of characters in a string. Your task is to rearrange the characters in the string such that no two adjacent characters are the same. If it is not possible to rearrange the characters, return an empty string. You need to implement the function `rearrangeString...
codefeedback
You are tasked with implementing a Python class that represents an undirected graph and provides procedures for its manipulation. The graph class should support adding and removing edges, as well as performing depth-first search (DFS), breadth-first search (BFS), and finding connected components. Your task is to compl...
codefeedback
You are tasked with creating a program that can extract and display information from a 3D scene file in a specific format. The scene file is provided in the Wavefront .obj format, which is a simple text-based file format that represents 3D geometry. The file contains information about vertices, texture coordinates, nor...
codefeedback
You are working on a project that involves manipulating and tuning mathematical expressions using a specialized library called IR (Expression Manipulation Library). The library provides functions for creating, modifying, and tuning mathematical expressions. In the given code snippet, the variable `rel` is initialized w...
codefeedback
You are tasked with implementing a function that calculates the molecular weight of a chemical compound based on its constituent elements. The molecular weight of a compound is the sum of the atomic weights of all the atoms in the compound. The atomic weights of the elements are provided in a dictionary. Each element i...
codefeedback
You are tasked with creating a Python program to generate an Excel file containing student information. The program should prompt the user to input the student details, including name, age, and grade. The program should then save this information to an Excel file named "students.xls" with the following format: - The s...
codefeedback
You are tasked with creating a bash script to monitor the login attempts of a web application and terminate the application if the login attempts exceed a specified timeout. The script should increment a counter for each login attempt and check if the counter exceeds the login timeout value. If the timeout is exceeded,...
codefeedback
You are tasked with implementing a function to calculate the best blend of enriched air for scuba diving based on the depth and the desired fraction of oxygen. The function should handle error cases where the depth is negative or the fraction of oxygen is outside the valid range. The enriched air calculator class provi...
codefeedback