instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with automating the versioning and deployment process for a web application. Your goal is to create a script that extracts the version number from the `package.json` file, updates the version number in specific files, installs dependencies, builds the application, and then copies the built files to a ser... | codefeedback |
You are tasked with implementing a function to validate whether a given matrix aligns with a specified slice membership pattern. The slice membership pattern is represented by a 2D array, and the function should return True if the matrix matches the pattern, and False otherwise.
The function signature is:
```python
de... | codefeedback |
You are tasked with implementing a function that subtracts a given value from a balance and returns the result. The function should also handle error cases where the full amount was not subtracted.
You are given the following code snippet as a reference:
```rust
let sub: TokenAmount = std::cmp::min(&available, req).cl... | codefeedback |
You are given a function `get_edge_bin(array)` that takes in an array of integers or booleans and returns a list of tuples representing the start and end indices of consecutive edges in the array. An edge is defined as a transition from 0 to 1 for integer arrays or from False to True for boolean arrays. The function us... | codefeedback |
You are given a code snippet that involves processing a collection of passports. Your task is to create a program that validates the passports based on certain criteria and counts the number of valid passports.
The passports are represented as a collection of key-value pairs, where each key-value pair corresponds to a... | codefeedback |
You are tasked with implementing a Python function that analyzes the entropy of a given file and generates a plot of the entropy distribution. Entropy is a measure of the amount of uncertainty or disorder in a set of data. The function should take two input parameters: `input_file` (the file to be analyzed) and `output... | codefeedback |
You are tasked with implementing a custom error type for parsing string literals in Rust. The error type, `StringLiteralParseError`, should encompass different parsing errors that may occur during the processing of string literals. Your goal is to define the error type and its associated variants, and then implement th... | codefeedback |
You are tasked with implementing a Python decorator that enhances the functionality of a service discovery system. The service discovery system is responsible for managing and providing information about available services in a distributed environment. The provided code snippet demonstrates the application of a decorat... | codefeedback |
You are tasked with creating a command-line tool to manage iOS simulators for testing and development purposes. The tool should allow users to perform various operations such as listing available simulators, creating new ones, deleting existing ones, and launching specific simulators.
Your task is to implement a simpl... | codefeedback |
You are tasked with implementing a Python plugin loader that can load and reload plugins based on a given set of dependencies. The plugin loader should be able to handle dependencies, reload modules, and fetch specific plugins.
Your task is to implement the `PluginLoader` class with the following methods:
1. `loaddeps... | codefeedback |
You are tasked with creating a Python function that interacts with Amazon Web Services (AWS) Transcribe service to transcribe an audio file stored in an S3 bucket. The function should take the AWS Transcribe client, the name of the uploaded file, and the locale as input parameters. It should then initiate a transcripti... | codefeedback |
You are tasked with creating a program to analyze a collection of text documents and generate a report on the frequency of words in each document. To accomplish this, you will need to perform the following steps:
1. Read the text data from multiple files in a specified directory.
2. Tokenize the text data to extract i... | codefeedback |
You are given a 2D grid representing a Voronoi diagram, where each cell in the grid belongs to a specific zone. The goal is to write a function to label the connected components within each zone.
Write a function `labelComponents(grid: List[List[int]]) -> List[List[int]]` that takes in a 2D grid of integers representi... | codefeedback |
You are tasked with implementing a function to find a resource file within a given directory structure. The function should take a directory path and a file name as input and return the full path to the file if it exists, or an empty string if the file is not found. The directory structure is represented as a tree, whe... | codefeedback |
You are tasked with implementing a firmware manager class in Swift. The firmware manager is responsible for handling firmware updates for a device. The firmware manager interacts with a backend service to download and manage firmware updates. Your task is to implement the `FirmwareManager` class and its associated meth... | codefeedback |
You are tasked with creating a Python function that simulates a simple database management system. The function should be able to create a database, retrieve the database instance, and close the database when necessary. Your task is to implement the `DatabaseManager` class with the following methods:
1. `create_databa... | codefeedback |
You are working as a DevOps engineer at a software company. Your team is responsible for automating the build and packaging process for a new software project. As part of this process, you need to write a script that automates the import of a GPG key, builds a binary, and creates a Debian package. Your task is to write... | codefeedback |
You are tasked with implementing a program to perform singular value decomposition (SVD) on a given set of movie ratings. Singular value decomposition is a technique used in linear algebra and matrix factorization, often applied in recommendation systems and data compression. The goal is to decompose the original matri... | codefeedback |
You are tasked with developing a command-line interface (CLI) for a machine learning model training and testing system. The CLI should allow users to specify various settings and parameters for the model, such as the type of classification (binary or multi-class), the classifier to be used, the time interval for testin... | codefeedback |
You are tasked with implementing a Python class that manages namespaces and type variables. The class should provide methods to check for errors and to find a specific name within the namespaces.
You are given a partial code snippet for the class:
```python
class TypeVariable:
def __init__(self, name, namespaces,... | codefeedback |
You are tasked with creating a script to manage a server process. The script should set resource limits, start the server process, and redirect its output to a log file. Your task is to write a Python script that accomplishes these tasks.
Your Python script should perform the following actions:
1. Set the maximum numb... | codefeedback |
You are tasked with implementing a function that constructs a SQL query based on a given base SQL statement and a list of filters. The function should take the base SQL statement and a list of filter conditions as input and return the final SQL query with the applied filters.
The function signature is as follows:
```p... | codefeedback |
You are given a list of integers representing the scores of a game. Your task is to write a function that calculates the average score of the game, excluding the highest and lowest scores.
Write a function `calculateAverage` that takes in a list of integers and returns the average score, rounded to the nearest integer... | codefeedback |
You are tasked with implementing a custom transformer class for feature engineering in a machine learning pipeline. The class, named `CustomTransformer`, is designed to perform a specific transformation on input data.
The `CustomTransformer` class has the following attributes and methods:
Attributes:
- `variables`: A... | codefeedback |
You are tasked with implementing a custom exception class in C++ to handle situations where a particular feature or functionality is not yet implemented. Your task is to create a class `NotImplementedException` that inherits from the standard `std::exception` class and includes additional functionality to store the nam... | codefeedback |
You are tasked with implementing a custom iterator for a class `FunctionGroup` that represents a group of function overloads. The class has a private member `mOverloads` of type `std::vector<Function>` to store the function overloads. Your goal is to create an iterator that allows iterating over the function overloads ... | codefeedback |
You are tasked with implementing a Python program to efficiently generate prime numbers using the Sieve of Eratosthenes algorithm. The Sieve of Eratosthenes is an ancient algorithm for finding all prime numbers up to a specified integer. The algorithm works by iteratively marking the multiples of each prime number star... | codefeedback |
You are tasked with creating a Python package version checker. Your program should take in a package name and a version number, and then determine if the provided version number is the latest version available for the given package. You can assume that the package versions follow the semantic versioning format (major.m... | codefeedback |
You are tasked with creating a Python function that processes a video stream to detect a specific color range and highlight it in the output. The function should take a video stream as input and return the processed video stream with the specified color range highlighted.
You are provided with the following code snipp... | codefeedback |
You are tasked with implementing a function that simulates a simple data storage system for a mobile application. The function should save data when the application is about to terminate and retrieve the saved data when the application is launched again. You are provided with a code snippet that represents the point in... | codefeedback |
You are tasked with implementing a function that converts a given SVG path string into an array of commands. Each command in the array should be represented as an object containing the command type and its corresponding parameters.
The SVG path string will consist of a sequence of commands, where each command is repre... | codefeedback |
You are tasked with implementing a function that compares two dictionaries and returns a new dictionary containing the key-value pairs that are common to both input dictionaries. Additionally, you need to handle the case where the values associated with the common keys are also equal.
Write a function `find_shared_it... | codefeedback |
You are given an array `nums` containing only 0, 1, and 2. Write a function to sort the array in-place in linear time complexity and constant space complexity without using any sorting algorithms.
For example, given the input array `nums = [2,0,2,1,1,0]`, after sorting, the array should be modified to `nums = [0,0,1,1... | codefeedback |
You are tasked with implementing a dependency resolution algorithm for a software application. The application is composed of modules, each with its own dependencies and initialization logic. The provided code snippet is a part of the application framework and includes a method to retrieve the dependencies of a module ... | codefeedback |
You are tasked with implementing a Python class to manage student information. The class should have methods to set and get the student's name, ID, gender, birthstone, age, and grade. Additionally, the class should keep track of the total number of students created. You need to implement the class and its methods based... | codefeedback |
You are tasked with implementing a Python function that simulates the behavior of a simple heat transfer system using the finite difference method. The system consists of a one-dimensional rod with a given initial temperature distribution. The goal is to evolve the temperature distribution over time according to the he... | codefeedback |
You are tasked with creating a Python decorator that retries a function a specified number of times with a delay between each attempt. The decorator should be able to handle any function, along with its arguments and keyword arguments. Your task is to implement the `retry` decorator function that takes the number of tr... | codefeedback |
You are tasked with implementing a parser for a simplified version of the SyGuS input language, which is used for specifying syntax-guided synthesis problems. The given code snippet is a part of the Python implementation of the parser. The parser is responsible for parsing sort expressions in the SyGuS input language.
... | codefeedback |
You are given a rectangular grid of size n x n, where n is a positive integer. The grid is divided into cells, and each cell is identified by its row and column indices. The top-left cell has coordinates (1, 1), and the bottom-right cell has coordinates (n, n).
You are also given two integers, h and w, where 1 ≤ h ≤ n... | codefeedback |
You are tasked with implementing a function to set the flash voltage for an ESP (Embedded Systems Processor) using the provided code snippet as a reference. The function `set_flash_voltage` takes three parameters: `esp` (the ESP object), `efuses` (a dictionary containing the efuse values), and `args` (additional argume... | codefeedback |
You are given a list of flight routes with their respective costs. Each route is represented as a tuple in the format (source, destination, cost). Your task is to write a function that finds the cheapest itinerary for a given trip.
Write a function `find_cheapest_itinerary(flights, start, end)` that takes in the follo... | codefeedback |
You are working on a deep learning project and are tasked with implementing a sequence of operations for processing input data. The operations include adding elements to a sequence, generating noise, performing convolution, applying normalization, and activating the output. Your task is to write a function that takes i... | codefeedback |
You are tasked with creating a Python function that processes a given text file and returns the frequency of each word in the file. The function should ignore punctuation and be case-insensitive. Additionally, the function should return the word frequencies in descending order based on their occurrence count.
Create a... | codefeedback |
You are tasked with implementing a C++ template meta-programming problem that involves understanding and manipulating type traits and function call expressions.
You are given the following code snippet as a starting point for your problem:
```cpp
typedef typename meta::as_logical<sA0>::type result_type;
BOOST_SIMD_FU... | codefeedback |
You are tasked with creating a program that reads a file containing a software license and extracts the name and email of the copyright holder. The license file is in the format specified by the code snippet below:
```
/*
* MIT License
*
* Copyright (c) 2020 John Doe <john.doe@example.com>
*
* Permission is hereb... | codefeedback |
You are tasked with implementing a macro in Rust that simulates the behavior of a function call using the provided `ffi_dispatch` macro. The `ffi_dispatch` macro takes a handle, a function name, and any number of arguments, and then calls the corresponding function on the handle with the provided arguments.
Your task ... | codefeedback |
You are tasked with implementing a class that manages a hash vector and a list of neighbors in a peer-to-peer network. The class has the following attributes and behaviors:
Attributes:
- `hashid`: a hexadecimal string representing the hash ID of the node.
- `vectorlength`: an integer representing the length of the has... | codefeedback |
You are tasked with implementing a function that fetches data from a RabbitMQ server using a set of parameters. The function should handle loading indicators, token-based authentication, and customizable headers. Your goal is to complete the implementation of the `fetchData` function by filling in the missing parts bas... | codefeedback |
You are tasked with creating a Python class that implements a similarity encoder for a given dataset. The similarity encoder is a type of neural network architecture used for encoding similarity information between data points. Your task is to implement the `SimilarityEncoder` class, which will utilize various utility ... | codefeedback |
You are tasked with implementing a configuration method for a Composable object in Swift. The method `configure` takes in an `Item` struct and a collection of `Spotable` objects to configure the child Composable. Additionally, the method also accepts an optional collection of `CompositeSpot` objects. Your goal is to im... | codefeedback |
You are tasked with implementing a function that takes a reference to a string slice and returns a new `String` containing the same content as the input slice. However, the function should not simply clone the input slice; instead, it should create a new `String` object and copy the content of the slice into it. You ar... | codefeedback |
You are tasked with implementing a CUDA kernel that performs element-wise addition of two arrays and stores the result in a third array. The CUDA kernel should be designed to handle arrays of arbitrary size and should utilize the CUDA API for memory management and error handling.
You are provided with the following co... | codefeedback |
You are working as a software developer for an e-commerce company that uses Laravel, a popular PHP framework, for its backend operations. Your task is to create a command-line interface (CLI) command using Laravel's Artisan console to facilitate the creation of new orders in the system. The command should accept input ... | codefeedback |
You are given an array of integers `arr`. Your task is to write a function that returns an array `vector` where each element at index `i` represents the nearest smaller element to the right of `arr[i]`. If there is no smaller element to the right of `arr[i]`, the value at index `i` in `vector` should be -1.
For exampl... | codefeedback |
You are given a string containing a series of comma-separated integers. Your task is to write a function to find the maximum sum of a contiguous subarray within the string. For example, given the input string "1,-3,2,1,-1", the contiguous subarray with the largest sum is "2,1", and the maximum sum is 3.
Write a functi... | codefeedback |
You are working on a web application that displays user information in a table format. The code snippet provided is a part of the HTML template used to generate the table rows. The snippet uses JavaScript template literals to dynamically insert user information into the table cells.
Your task is to write a function th... | codefeedback |
You are tasked with implementing a time formatting function for a mobile application. The function should take the current context and a given hour and minute as input and return the formatted time as a string. The formatting should consider whether the device is set to a 24-hour or 12-hour time format.
You are provid... | codefeedback |
You are tasked with creating a program that processes a series of binary expressions and performs specific operations based on the given keywords and operands. Each binary expression consists of an object, a keyword, an operand (which can be an object, number, string, or boolean), and a modifier (which can be a number ... | codefeedback |
You are tasked with implementing a function to simulate event injection and handling in a graphics rendering system. The system consists of a session for rendering, a renderer, and a set of input events. The goal is to ensure that the system correctly handles injected events and updates its state accordingly.
You are ... | codefeedback |
You are tasked with creating a Django REST framework API for managing ingredients in a recipe application. Your goal is to implement a view that retrieves all ingredients from the database and serializes them using the `IngredientSerializer`. Additionally, you need to write tests to ensure that the API endpoint returns... | codefeedback |
You are working on a data preprocessing task for a machine learning project. You have been given a dataset consisting of two parts: a training set and a validation set. Your task is to write a Python function that takes the training and validation datasets as input and performs the following operations:
1. Save the tra... | codefeedback |
You are tasked with implementing a command-line tool for image processing that includes an argument parser. The tool should support the option to specify the upsampler for alpha channels and the file extension for the output images.
Your task is to complete the implementation of the argument parser by adding the neces... | codefeedback |
You are tasked with creating a Python function that analyzes the performance of different machine learning models using various optimization methods and default parameters. Your function will take in three input lists: `models_to_use`, `methods_to_use`, and `sensible_defaults`. The function will iterate through these l... | codefeedback |
You are tasked with implementing a database management system for a company's inventory. The system should allow for the creation, updating, and deletion of product records. To achieve this, you need to create a Python class that interacts with a database using SQLAlchemy.
Your task is to implement a `ProductManager` ... | codefeedback |
You are tasked with creating a function that validates a user's input for a fax number. The input is expected to be in the format of a standard fax number, which consists of an optional country code, followed by the area code and the fax number itself. The function should return true if the input is in the correct form... | codefeedback |
You are tasked with creating a program to identify common elements between two arrays. Given two arrays of integers, you need to write a function to find the common elements between them and return the result as a new array.
Write a function `findCommonElements` that takes in two arrays of integers as input and return... | codefeedback |
You are tasked with creating a Python class that manages the configuration of data types and their properties for a data processing application. The class should allow for the definition and retrieval of data type configurations, including primitive types and their corresponding item types, as well as the ability to ma... | codefeedback |
You are tasked with implementing a custom SentenceStateGate class in Python. The SentenceStateGate class is responsible for creating gates used in natural language processing tasks, such as sentiment analysis or language modeling. Each gate takes a hidden state and an input, and produces an output based on specific ope... | codefeedback |
You are tasked with implementing a custom exception hierarchy in C++. Your goal is to create a set of exception classes that inherit from `std::exception` and `boost::exception`. The `std::exception` class is a base class for all standard C++ exceptions, while `boost::exception` is a class template that allows adding a... | codefeedback |
You are tasked with implementing a class for managing units in a measurement system. The class should allow for the addition of base and derived units, as well as the ability to append a specified number of units to a given unit. Your task is to complete the implementation of the `MeasurementSystem` class by adding the... | codefeedback |
You are tasked with implementing a class that can parse and interact with Ethereum contract ABIs (Application Binary Interface). An ABI is a JSON representation of a contract's interface, including its functions, inputs, and outputs. Your goal is to create a class `Abi` that can handle the parsing and interaction with ... | codefeedback |
You are tasked with implementing a plugin system for a software application. The application allows users to extend its functionality by creating and integrating plugins. Each plugin can modify the application's behavior, add new features, or customize existing ones. The application provides a plugin interface with the... | codefeedback |
You are given a 2D array `input` of size `n x m`. Each cell of the array contains an integer value. Your task is to write a function or method that determines if there exists a cell in the array that is greater than or equal to all the elements in its row and less than or equal to all the elements in its column.
The f... | codefeedback |
You are tasked with implementing a Python function that interacts with a financial transactions API. The function is responsible for constructing a POST request to retrieve transactions based on specified parameters. The code snippet provided is a part of the function and demonstrates the handling of optional parameter... | codefeedback |
You are tasked with creating a Python function that processes a list of GitHub repository information and returns a filtered list based on specific criteria. Each repository is represented as a dictionary with the following keys: "reponame" (the name of the repository), "filename" (the name of the file), and "gh_stars"... | codefeedback |
You are given a list of points in the 2D plane, each represented by a pair of integers (x, y). Your task is to write a function that finds the area of the largest rectangle that can be formed from these points, with sides parallel to the x and y axes. If there isn't any rectangle that can be formed, the function should... | codefeedback |
You are tasked with creating a parallel processing function for performing groupby and apply operations on a given dataframe. The function should allow the user to specify the number of processes to use for parallelization. The goal is to optimize the performance of the groupby/apply operation by leveraging parallel pr... | codefeedback |
You are tasked with implementing a 3D convolutional neural network (CNN) architecture for a computer vision project. The provided code snippet is a part of the network definition using PyTorch. Your task is to understand the given code and complete the network architecture by adding the remaining layers.
The `convbn_3... | codefeedback |
You are tasked with implementing a function that registers datasets for evaluation in a computer vision project. The function should take in a list of dataset names, their corresponding directories, and their split types, and register them for evaluation. Additionally, the function should set the evaluator type for eac... | codefeedback |
You are tasked with implementing a function that validates the structure of a given configuration object. The configuration object is represented as a nested data structure, and you need to ensure that it adheres to a specific format. The format consists of a list with a specific type and a member structure. The type c... | codefeedback |
You are tasked with implementing a Python function that encodes a sequence of symbols using a custom model. The custom model is provided as a Rust function, and your task is to call this function from Python and process the output.
The Rust function `encode_iid_custom_model` takes the following parameters:
- `py`: A P... | codefeedback |
You are working on a graph slicing algorithm that involves finding a slice at a particular step in the process. The algorithm involves scaling and has a complexity of O(n*(Slicer(n)+Ordering(n))) where n is the number of nodes in the graph. Additionally, the algorithm has a greedy complexity of O(2n^2). You need to imp... | codefeedback |
You are tasked with implementing a URL redirection system for a web application. The system should take a requested URL and redirect it to a specific endpoint with additional parameters. Your task is to write a function that takes a URL and a parameter, and returns a new URL with the parameter appended as a query strin... | codefeedback |
You are tasked with creating a Python program to manage a simple inventory system using the tkinter library for the graphical user interface (GUI). The program should allow users to input the number of items, update the inventory, and display the inventory in a tree view.
Your task is to implement a class `InventoryMa... | codefeedback |
You are tasked with creating a program that simulates a simplified version of a Leiningen build tool. Leiningen is a popular build automation tool for Clojure projects, used to manage dependencies, run tests, and build artifacts. Your program should be able to handle adding dependencies, running tests, and building art... | codefeedback |
You are tasked with implementing a class that applies a series of transformations to a given dataset. The class, `TransformDataset`, takes in a dataset and a set of transformations, and ensures that the transformations are valid before applying them.
The `TransformDataset` class has the following requirements:
- It sh... | codefeedback |
You are tasked with implementing a function to process account loading in a banking system. The function receives a list of lookup tables, each containing a certain number of accounts. The goal is to ensure that at least one account is loaded from each lookup table and to track the total number of loaded accounts.
You... | codefeedback |
You are tasked with creating a program that simulates a simplified version of a code generator tool used in a Laravel application. The tool is responsible for generating migration and model files based on a set of directives provided in a configuration file. The directives specify the structure and relationships of the... | codefeedback |
You are tasked with implementing a Python class that generates a table of contents for a document. The provided code snippet is a simplified version of a `TableOfContents` class, which is a subclass of `NoOptionsNoContentsItem`. The `TableOfContents` class has an `options` attribute that holds a sequence of strings rep... | codefeedback |
You are working on a game state management system for a two-player game. The game state is represented by a set of properties and their values. The code snippet provided is a part of the game state management logic. The `state` object is used to access and modify the game state.
The code snippet performs the following... | codefeedback |
You are tasked with implementing a simple banking system using Python. The system should support the creation of bank accounts, deposits, withdrawals, and transfers between accounts. Each bank account should have a unique account number, and the system should be able to handle multiple accounts.
Your task is to implem... | codefeedback |
You are tasked with creating a Python program that simulates a simple terminal management system using the Tornado web framework. The program will handle WebSocket connections for terminal sessions and serve static files using Tornado's web application features.
Your task is to implement a class `TerminalManager` that... | codefeedback |
You are tasked with implementing a Snake game using object-oriented programming in Python. The game will involve creating a Snake class with various methods to control the snake's movement and growth. Your task is to implement the `add_body_block` method within the Snake class.
The `add_body_block` method should add a... | codefeedback |
You are tasked with creating a Python decorator function that generates different permutations of a given input test class. The decorator function should take the input test class and return a new test class with all possible permutations of the original test class's methods. Each permutation should be a distinct test ... | codefeedback |
You are tasked with creating a routing configuration for a web application using Angular. The application has a layout component with a specific layout style, and it needs to load a module for managing movies. Your task is to define the routing configuration for the movies module, ensuring that it is lazy-loaded and re... | codefeedback |
You are given a list of chemical reactions in the form of "X A => Y B", where X and Y are the quantities of chemical A and B produced, respectively. Each reaction specifies the quantities of input chemicals required to produce a certain quantity of output chemicals. Additionally, you are given the quantity of a specifi... | codefeedback |
You are tasked with implementing a secret sharing scheme using Shamir's Secret Sharing algorithm. Shamir's Secret Sharing is a method for distributing a secret amongst a group of participants, where each participant is given a share of the secret, but only a subset of the shares is sufficient to reconstruct the secret.... | codefeedback |
You are tasked with implementing a Java class that manages access tokens for a User-Managed Access (UMA) system. The class should handle token generation, signing, and encryption based on the provided interfaces and properties.
Your task is to create a class named `UMATokenManager` that implements the following interf... | codefeedback |
You are tasked with simulating a traffic intersection using an agent-based modeling framework. The intersection consists of four arms, each with a traffic light and a set of agents representing vehicles. The agents move through the intersection based on the state of the traffic lights and their unique identifiers. Each... | codefeedback |
You are tasked with creating a Python function that processes a list of dependencies and operations related to database migrations. Your function should analyze the dependencies and operations to determine the correct order in which the operations should be executed, considering the dependencies between them.
You are ... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.