instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are working on a package management system for a software repository. The system is responsible for managing dependencies between different packages. Each package can have multiple dependencies, and it's crucial to ensure that all dependencies are installed before a package can be used. You are given a list of pac...
codefeedback
You are tasked with creating a C++ function that dynamically unloads a shared library and returns an appropriate value based on the success or failure of the operation. The function should take a handle to the loaded library as a parameter and use the Windows API function `FreeLibrary` to unload the library. If the lib...
codefeedback
You are tasked with implementing a beam search algorithm for a speech recognition system. The algorithm aims to find the most likely sequence of words given an input audio signal. The provided code snippet is a part of the beam search algorithm and is responsible for updating the probabilities of different word sequenc...
codefeedback
You are tasked with implementing a role-based access control system for a web application. The system should allow users to be assigned to different roles, and roles to be granted or denied access to specific resources. You need to create a class `AccessControlManager` that manages the access control rules. The class ...
codefeedback
You are tasked with implementing a Python function that builds a neural network based on the given options. The function should construct the network according to the specified type and parameters. The network should be returned as the output of the function. You are provided with a code snippet that contains a functi...
codefeedback
You are tasked with creating a Python function that extracts the major, minor, and patch versions from a given version string following the semantic versioning format (e.g., "X.Y.Z"). Semantic versioning is a versioning scheme that consists of three non-negative integers separated by periods. The first integer is the m...
codefeedback
You are given a list of strings, each containing lowercase English letters. Your task is to find the checksum of the list, which is calculated as the product of the count of strings containing exactly two duplicate letters and the count of strings containing exactly three duplicate letters. Write a function or program...
codefeedback
You are tasked with creating a Python function that simulates a simplified version of a database migration system. The function should take a list of migration operations and generate the SQL statements required to apply those migrations to a database. Each migration operation is represented as a tuple containing the o...
codefeedback
You are tasked with implementing a constraint satisfaction problem (CSP) solver for a scheduling application. The application needs to assign roles to a group of individuals while satisfying certain constraints. Each individual can be assigned to one role, and each role has specific constraints that must be satisfied. ...
codefeedback
You are tasked with creating a Python program that simulates a simple game of rock-paper-scissors. The program should prompt the user to input their choice (rock, paper, or scissors), generate a random choice for the computer, determine the winner, and display the result. Your program should follow these guidelines: -...
codefeedback
You are tasked with implementing a function that calculates the sum of all prime numbers within a given range. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. Write a function `sumOfPrimes` that takes two integers `start` and `end` as input and returns the sum o...
codefeedback
You are given a directed graph represented as an adjacency list. Each node in the graph is labeled with a unique integer. Your task is to implement a depth-first search (DFS) algorithm to traverse the graph and return the nodes in the order they were visited. You are provided with a code snippet that partially impleme...
codefeedback
You are working on a program to analyze gene sets and their relationships. The program uses a set of rules to summarize the relationships between gene sets. One of the rules, `commonSupertermInListRepresentsSubtermsWithLessRepresentativePower`, is designed to identify superterms that represent subterms with less repres...
codefeedback
You are tasked with creating a program that utilizes the Compact Language Detector 2 (CLD2) library to detect the language of a given text and provide a summary of the language detection results. The CLD2 library is a language detection library for plain text, HTML, and XML documents. It is capable of detecting over 80...
codefeedback
You are tasked with creating a Python function that processes a given time array and returns a formatted string representing the time in the "YY-MM-DD HH:MM:SS" format. The time array is a list containing the year, month, day, hour, minute, and second in that order. You need to implement the function `format_time` that...
codefeedback
You are tasked with implementing a vending machine system that allows adding products to specific slots within the machine. Each slot can accommodate a single product or a product bundle. The products and product bundles are represented by classes that implement the `ProductInterface` and `ProductBundleSlotInterface` i...
codefeedback
You are given a Rust code snippet that defines a struct `S` and a trait implementation for mutable references to `S`. Additionally, there is a function `foo` that takes a generic parameter `X` and has a trait bound for references to `X`. However, when trying to call `foo` with `S` as the generic parameter, a compilatio...
codefeedback
You are tasked with implementing a function that calculates the total number of frames in a cycle, given the number of frames in one cycle and the number of times all the other frames of a cycle repeat. Write a function `calculate_total_frames` that takes in two parameters: - `frames_in_cycle` (integer): the number of...
codefeedback
You are tasked with implementing a class that processes HTML content and generates a Word document. The WordDocument class has a method called Process that takes an HtmlParser object as a parameter. The HtmlParser object represents an HTML document and contains a method to parse the HTML content. Your task is to implem...
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 account balance. Additionally, the class should have a method for applying a discount to the account balance. Your task is to implement the `BankAcc...
codefeedback
You are tasked with implementing a Python function that takes a list of strings as input and returns a new list containing only the strings that are valid Python identifiers. A valid Python identifier is a non-empty string consisting of only letters, digits, or underscores, and not starting with a digit. Your function ...
codefeedback
You are tasked with implementing a class for audio device management in C++. The class, `ALAudioDevice`, is responsible for managing an OpenAL audio device. The provided code snippet includes a part of the class definition and some member functions. Your task is to complete the implementation of the class by adding nec...
codefeedback
You are tasked with creating a Python class decorator that adds a prefix to the fields of a form. The decorator should take the prefix as an argument and modify the field names accordingly. Your task is to implement the `add_prefix` decorator and apply it to the `Meta` class of the `SubscribeUserForm` class. The `Subsc...
codefeedback
You are tasked with creating a Python script to automate the generation of HTML and PDF files from LaTeX source files using the HeVeA and Imagen tools. The script should take a working directory, title, and basename as input and perform the following steps: 1. Construct the path to the HTML file using the working direc...
codefeedback
You are tasked with implementing a generic tree data structure in C#. The tree should consist of nodes, where each node holds an item of type T and maintains references to its parent nodes and child nodes. Your task is to implement the `Node<T>` class with the following properties and methods: - A public property `Ite...
codefeedback
You are tasked with implementing a custom error handling mechanism in Swift. Your goal is to create a custom error type and modify an existing function to throw this custom error when a specific condition is met. You are given a Swift code snippet that includes a function `value()` which is intended to return a string...
codefeedback
You are tasked with implementing a Java class that represents a person's physical attributes. The class should have methods to get and set the person's stature and weight. The class should also include appropriate data members and accessors/mutators for these attributes. Your task is to complete the implementation of ...
codefeedback
You are tasked with creating a program that determines whether a given positive integer is a power of two. A power of two is any number that can be expressed as 2^n, where n is a non-negative integer. Your program should take an integer input and output whether it is a power of two or not. For example, if the input is...
codefeedback
You are tasked with creating a program to manage and optimize the settings for a robotic hand. The robotic hand is represented by the object `i01.rightHand`, and it has individual components for the thumb, index finger, middle finger, ring finger, and pinky. Each component has default settings for its range of motion, ...
codefeedback
You are given a string containing a mix of alphanumeric characters and special symbols. Your task is to write a function to extract and return the alphanumeric characters from the input string in the order they appear, while ignoring the special symbols. Write a function `extractAlphanumeric(inputString: string): stri...
codefeedback
You are tasked with implementing a function that performs a custom sorting operation on a list of chunks. The function takes in a list of chunks and a boolean parameter `reverse`. If `reverse` is set to True, the list elements are sorted as if each comparison were reversed. The function should use a heap data structure...
codefeedback
You are tasked with creating a program to compute Gaussian kernel density estimates (KDE) for a set of data points representing protein structures. The program should read protein structure files from a specified directory, filter the data based on a B-factor threshold, and then compute the KDE densities for the filter...
codefeedback
You are tasked with creating a Python function that processes plot parameters and generates a plot for a given dataset. The function should read environment variables for font size and marker size, and utilize naming objects to handle file naming conventions. Additionally, the function should extract attributes from a ...
codefeedback
You are tasked with implementing a multithreaded vehicle information retrieval system for a game statistics application. The provided code snippet is a part of a larger system that manages the retrieval of statistics for players' vehicles from various data providers. The `self._configMain.recentStatProviders` contains ...
codefeedback
You are tasked with simulating a simple robotic control system using a simplified version of the Robot Operating System (ROS) in a C++ environment. The system consists of two publishers, one for sending commanded robot configurations and the other for sending measured robot configurations. The main loop of the program ...
codefeedback
You are tasked with implementing a custom JDBC driver for a specific environment. The driver needs to accept only URLs that contain a specific environment identifier. You are provided with a partial implementation of the `acceptsURL` method and are required to complete the implementation. Additionally, you need to impl...
codefeedback
You are tasked with implementing a custom GUID generator in C#. The GUID (Globally Unique Identifier) is a 128-bit integer used for unique identification purposes. Your task is to create a class that generates a new GUID using a custom algorithm. The GUID should be in the standard format, consisting of 32 hexadecimal d...
codefeedback
You are tasked with implementing a Swift class that handles JSON data for a fictional API endpoint. The class, named `APIDataHandler`, is responsible for parsing JSON data and managing the state of the API request. Your goal is to complete the implementation of the `APIDataHandler` class by adding a method to parse the...
codefeedback
You are tasked with implementing a method in the `ListaZasobowGrid` class that retrieves a list of resources from the database based on certain criteria. The `ListaZasobowGrid` class is part of a larger system and is responsible for managing resources within a grid. The method you need to implement is named `getResour...
codefeedback
You are tasked with implementing a function to calculate the great circle distance between two latitude-longitude coordinate pairs using the Haversine formula. The Haversine formula determines the distance between two points on the Earth given their latitude and longitude. The function should take four parameters: the ...
codefeedback
You are tasked with implementing a custom button component in a React application. The component should accept various props to customize its appearance and behavior. Your task is to create the `Button` component with the following requirements: - The component should be named `Button` and should be a functional compo...
codefeedback
You are tasked with implementing a function that manipulates a 32-bit unsigned integer by setting or clearing specific bits based on given input. The function should take the following parameters: - `value`: A 32-bit unsigned integer on which the bit manipulation will be performed. - `mask`: A 32-bit unsigned integer r...
codefeedback
You are tasked with implementing a namespace management system for a programming language. A namespace is a declarative region that provides a scope to the identifiers (names of types, functions, variables, etc.) inside it. Namespaces are often used to organize code into logical groups and to prevent naming conflicts. ...
codefeedback
You are tasked with implementing a function that calculates the total cost of a shopping cart, taking into account any applicable discounts. The function should take a list of items in the cart, where each item is represented as a dictionary with keys "name", "price", and "quantity". Additionally, there are discount ru...
codefeedback
You are tasked with creating a program to manage the positioning of a dialog box and overlay in a graphical user interface (GUI). The dialog box should be centered within a scroll area, and an overlay should be displayed while the dialog is visible. The dimensions and positions of the scroll area, dialog box, and overl...
codefeedback
You are tasked with implementing a Python function that retrieves metadata for a given CSV file from a remote server. The function should handle potential errors and retry the request with a query parameter if the initial request fails with a status code of 400 or higher. The function should also handle the case where ...
codefeedback
You are tasked with creating a program that processes a given text file and extracts specific information from it. The text file contains a series of comments written in a programming language, and your program needs to identify and extract the comments that are enclosed within a specific delimiter pattern. Your progr...
codefeedback
You are tasked with implementing a Python function to calculate the Fast Fourier Transform (FFT) of a given signal. The FFT is a widely used algorithm for computing the discrete Fourier transform and is essential in various signal processing and analysis applications. You are provided with a partial code snippet that ...
codefeedback
You are tasked with implementing a custom logging sink in C# that integrates with the Serilog logging framework. Your custom sink should be able to receive log events and process them accordingly. Your task is to complete the implementation of the `AnalogySink` class, which should implement the `ILogEventSink` interf...
codefeedback
You are tasked with implementing a Python function that simulates a simple file backup system. The function should take in a list of file paths and a backup directory path. It should then create a backup of each file in the backup directory, preserving the original directory structure. If a file with the same name alre...
codefeedback
You are tasked with creating a program that simulates the extraction of files from a compressed archive and then navigates into a specific directory. Your program should take a list of file names as input and perform the following operations: 1. Extract all files with the ".tar.gz" extension from the input list using ...
codefeedback
You are tasked with creating a program that simulates a simple neural network training process. Your program should generate a plot of the loss and accuracy metrics over multiple epochs and save the plot to a file. You are given the following information: - The neural network training process involves iterating over m...
codefeedback
You are working as a DevOps engineer for a company that uses Neo4j, a popular graph database management system. Your task is to automate the process of disabling authentication for the Neo4j server and starting it for testing purposes. The provided code snippet is a part of a shell script that accomplishes this task. ...
codefeedback
You are tasked with implementing a Python class that interacts with a gRPC service for managing validator activations in a blockchain network. The provided code snippet is a part of the implementation of this class. Your task is to complete the implementation of the class by adding the missing methods and functionaliti...
codefeedback
You are tasked with creating a Python function that parses a SoundFont 2 (SF2) file and extracts information about the samples it contains. SoundFont is a file format for sample-based synthesis, allowing the playback of musical instruments with various articulations and nuances. The SF2 file format is widely used in mu...
codefeedback
You are tasked with implementing a caching mechanism for a Python class that interacts with an external data source. The class has a method `_filter` that filters data based on a given indexer and a method `_clean` that performs a cleanup operation based on the class's locale attribute. Additionally, the class has an `...
codefeedback
You are tasked with creating a PHP function that processes an array of module information and returns a formatted string containing specific details. The module information is provided in the form of an associative array with the following keys: 'base', 'name', 'title', 'version', 'author', and 'description'. The funct...
codefeedback
You are working on a project that involves creating a web-based visualization tool. As part of this project, you need to generate SVG paths for various shapes and patterns. Your task is to write a function that takes in an array of objects, each representing a path, and returns the total area covered by these paths. E...
codefeedback
You are tasked with implementing a function that processes a list of blog posts and generates an XML sitemap based on certain criteria. The blog posts are represented as objects with attributes such as title, updated_at, and view_count. The sitemap should be ordered based on the view_count of the posts in descending or...
codefeedback
You are tasked with creating a Python function that parses a given code snippet and extracts the number of GitHub stars for a repository and the comment associated with the pylint disable directive. The code snippet will be provided as a string input to your function. The code snippet will consist of the following com...
codefeedback
You are tasked with creating a Python class that represents a hardware component, either a GPU or a CPU. The class should have specific attributes and methods to manage and retrieve information about the hardware component. Your task is to implement the GPU class with the given requirements. Requirements for the GPU c...
codefeedback
You are tasked with creating a middleware for an application verification process. The middleware is responsible for validating the app key and secret hash before allowing access to the application. The code snippet provided is a part of the unit test for this middleware. The test uses a mocking framework to set up exp...
codefeedback
You are tasked with implementing a custom data structure to store and manage a hierarchical tree of properties. The tree structure is represented by nodes, each containing a value and the ability to be marked as checked or unchecked. Additionally, you need to create a model and a view to display this tree structure wit...
codefeedback
You are tasked with implementing a simplified version of a data transmission system in Rust. The system consists of a `Transmitter` struct with several methods for writing data and finalizing the transmission. Your goal is to complete the implementation of the `Transmitter` struct by implementing the missing methods an...
codefeedback
You are tasked with implementing a custom deserializer for a JSON object using Java and the Jackson library. The custom deserializer should handle a specific scenario where the JSON object contains a field with a date in a non-standard format. Your task is to create a custom deserializer that can parse and deserialize ...
codefeedback
You are working on a project that involves analyzing the curvature of a line in 3D space. The given code snippet calculates the curvature of a line and returns it along with the line itself. The curvature is computed using the formula: curvature = sqrt(c1xc2_1^2 + c1xc2_2^2 + c1xc2_3^2) / (dlsfx^2 + dlsfy^2 + dlsfz^2)...
codefeedback
You are tasked with implementing a function to create a definition footprint based on a given instance collection parameter and a footprint. The function should take in the instance collection parameter and the footprint as input parameters and return a boolean value indicating the success of the operation. The functio...
codefeedback
You are tasked with creating a program to simulate a series of 1v1 card games between different bots. Each bot has a name and will play a specified number of games against each other. The outcome of the games will be used to rank the bots based on their win counts. You are given a code snippet that processes the resul...
codefeedback
You are tasked with implementing a custom data structure to represent tensor ranges in a programming language. A tensor range is a multidimensional range that can be used to index into a tensor (a multi-dimensional array). The code snippet provided defines the possible cases for representing tensor ranges and a compute...
codefeedback
You are tasked with implementing a class that represents an address. The class should have properties for street, house number, town, municipality, and province. Additionally, you need to write a method that validates the address based on certain criteria. Your task is to create a class called `Address` with the follo...
codefeedback
You are given a series of lines representing verses from a song, along with some directional indicators. Each verse is labeled with a prefix indicating the speaker or the location of the verse. The directional indicators `<` and `>` represent the direction of the song's progression, while the `Portal` indicator denotes...
codefeedback
You are given a snippet of code that is part of a string decoding algorithm. The code snippet is responsible for decoding a given string `S` using a provided `root` node. The `root` node represents the starting point of a tree-like data structure, and the characters in the string `S` are used to traverse the tree to de...
codefeedback
You are working on a content management system where users have different rights based on their roles. The code snippet provided is a part of a class method that sets the rights for a user based on their role. The `myRights` dictionary contains various permissions such as reading items, adding items, removing items, se...
codefeedback
You are tasked with writing a script to automate the process of aligning multiple DNA sequence files using the `augur` tool. The script should perform the following steps: 1. Iterate through all the files in the directory `onlyR1/CNS_5/` with the extension `.fa*`. 2. For each file, extract the base name and use it to ...
codefeedback
You are tasked with implementing a function that retrieves a resource bundle for a given class. A resource bundle is a directory containing resources such as images, localized strings, and nib files that can be accessed by an application. The provided code snippet contains an incomplete implementation of a function `re...
codefeedback
You are tasked with designing a memory system for a computer. The memory system consists of a Memory Processor (MP) with a capacity of 16MB. The MP is organized into lines, each with a width of 8 bytes. Your goal is to calculate the number of bits required for the memory system based on the given parameters. You are p...
codefeedback
You are tasked with creating a Python function that processes a list of product subscriptions and generates an appropriate HTTP response based on the input. The function should handle two scenarios: when the user is authorized to perform the action and when they are not authorized. The function should return a response...
codefeedback
You are tasked with creating a simple game using the ConsoleGameEngine library. The game involves a player-controlled character navigating through a maze to reach a goal while avoiding obstacles. The maze is represented by a 2D grid, where each cell can be either empty, representing a path, or contain an obstacle. The ...
codefeedback
You are working on a project related to ocean wave analysis and need to generate synthetic data for significant wave height and spectral peak. You decide to use the Weibull distribution to model the wave height and peak. The Weibull distribution is commonly used in oceanography to model wave characteristics. You have ...
codefeedback
You are tasked with implementing a trait for asynchronous delay in a Rust embedded system. The provided code snippet is a part of a module re-exporting two traits from the `delay` module: `AsyncDelayMs` and `AsyncDelayUs`. Your goal is to define and implement these traits to enable asynchronous delay functionality in a...
codefeedback
You are tasked with creating a TypeScript class that represents a query data transfer object (DTO) for finding users in a system. The class should extend an existing `FindAllQueryDTO` class and include specific fields and relations allowed for user queries. The existing constants `USER_ALLOWED_RELATIONS`, `USER_ALLOWED...
codefeedback
You are tasked with implementing a Python function that evaluates the type of a given node in an abstract syntax tree (AST) and returns a function representing the type signature. The function should take into account the node's body, scope, and bindings to determine the type. Your task is to write a Python function th...
codefeedback
You are tasked with creating a program to automate the process of generating SSL/TLS certificates and keys using OpenSSL commands. Your program should take input parameters and execute the necessary OpenSSL commands to produce the required output files. Your program should accept the following input parameters: - `-da...
codefeedback
You are tasked with creating a Python package for managing and analyzing electroencephalography (EEG) data for a research project on brain-computer interfaces for amyotrophic lateral sclerosis (ALS) patients. The package, named "bci4als," will include modules for conducting offline and online experiments, as well as ha...
codefeedback
You are tasked with creating a Python function that processes a list of stock transactions and calculates the total profit or loss. Each transaction is represented as a string in the format "action, quantity, purchase_price, selling_price, commission". The action can be either "buy" or "sell", and the quantity, purchas...
codefeedback
You are tasked with implementing a data processing system for handling different types of entry packets. The system needs to create either `FlatEntryData` or `UserTypeEntryData` objects based on certain conditions. The code snippet provided is a part of this system and contains logic for creating these objects. The `e...
codefeedback
You are tasked with creating a Python program to analyze and visualize the performance of a machine learning model. The program should load a pre-trained model from a file, evaluate its performance on a validation dataset, and then calculate and display the time taken per image for the evaluation. Your task is to impl...
codefeedback
You are working on a system that involves sensor fusion and dead reckoning algorithms for tracking the position and acceleration of an object. The code snippet provided is part of a larger system and is responsible for updating the dead reckoning algorithm based on certain conditions. Your task is to implement a funct...
codefeedback
You are tasked with creating a Rust module that manages timing and time-related functionality for a game engine. The module should provide various time-related structures and functionalities for game development. Your goal is to implement the necessary components for this timing module. You are provided with a code sn...
codefeedback
You are tasked with implementing a Swift initializer that parses a JSON dictionary and populates a data structure with the extracted information. The initializer takes in a dictionary representing a manifest, and an absolute project path. The manifest contains information about packages, and the project path is used to...
codefeedback
You are tasked with creating a program that simulates a simple database seeding process for categories in a web application. The program should utilize object-oriented principles and demonstrate the use of inheritance and polymorphism. Create a base class `Seeder` with the following specifications: - A constructor tha...
codefeedback
You are tasked with creating a Python program to process tweets from a specific Twitter user and store the cleaned text in a file. The program should use the Tweepy library to access the user's timeline, clean the tweets by removing URLs and punctuation, and then save the cleaned text to a file. Your task is to implem...
codefeedback
You are tasked with implementing a custom segmented head view in Swift. The segmented head view should allow users to select different segments and notify the delegate about the selected index. You are provided with a code snippet that includes a protocol definition and a class for the head view. Your task is to compl...
codefeedback
You are tasked with implementing a simple Android application that tracks the direction of touch gestures on the screen. The provided code snippet is a part of the touch event handling logic in the application. The `switch` statement handles different types of touch events, and the `case MotionEvent.ACTION_MOVE` block ...
codefeedback
You are tasked with implementing a function to initialize a security descriptor in a Windows environment. The security descriptor is a data structure that contains security information associated with a securable object. The function should take the necessary parameters and initialize the security descriptor with the a...
codefeedback
You are tasked with implementing a simplified version of a table view cell model in Swift. The `CellModel` struct represents the model for a cell in a table view, and it has two methods: `setup` and `didSelect`. The `setup` method is used to initialize the cell model with an index path and a delegate, while the `didSel...
codefeedback
You are tasked with creating a script to automate the management of database backups using the `pg_rman` tool. The script should analyze the output of the `pg_rman show` command and determine the number of purged backups based on the difference between two output files. The `pg_rman` tool is used to manage PostgreSQL ...
codefeedback
You are tasked with analyzing a dataset containing information about the annual transistor counts of various computer processors. The dataset is stored in a CSV file named `transcount.csv`. Each row in the dataset represents a different processor and includes the year of release and the corresponding transistor count. ...
codefeedback
You are tasked with creating a custom Django REST Framework viewset for a model called `VarType`. The viewset should include custom permissions and caching for authenticated users. Additionally, the viewset should use a read-only serializer for the `VarType` model. Your task is to complete the implementation of the cu...
codefeedback
You are tasked with implementing a Python class for a predictive modeling tool. The tool should support both regression and classification tasks, with the ability to handle binary predictors and surrogates. Your class should provide methods for training the model, making predictions, and evaluating the model's performa...
codefeedback