instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a script to automate the setup and configuration of a Python environment for a data science project. The script should perform the following tasks:
1. Activate the `conda` environment named `fis` using the `conda activate` command.
2. Install specific Jupyter Lab extensions using the `jupy... | codefeedback |
You are tasked with creating a custom assertion function for testing user interface elements in an iOS app using XCTest framework. The function should wait for a specific condition to be met before proceeding with the test. Your task is to implement the `waitUntil` function and the `tap` function that utilizes it.
The... | codefeedback |
You are tasked with implementing a function to invert the colors of a given RGB image. The function should take an input image, convert it to grayscale, and then invert the grayscale values to produce the final inverted image.
You are provided with a code snippet that partially implements the inversion process. Your t... | codefeedback |
You are tasked with implementing a message queue system that supports reading and peeking at data in a message. The provided code snippet is a part of the message queue system and includes a method for peeking at data in a message. Your task is to complete the implementation of the `Output_Buffers::peek` method.
The `... | codefeedback |
You are tasked with creating a Python class that handles platform-specific commands and exceptions. Your class should be able to run commands locally and handle various platform-related issues. You need to implement the class with the given requirements and exceptions.
Create a Python class `PlatformHandler` with the ... | codefeedback |
You are tasked with implementing a recursive function to draw a tree with two branches. The tree will be represented using ASCII characters, and the function should take the height of the tree as input. The tree will have a trunk represented by the character '|' and branches represented by the character '*'. The trunk ... | codefeedback |
You are tasked with implementing a cache system for storing and retrieving bit sets associated with specific queries in a search engine application. The cache system is designed to store the bit sets generated from queries and retrieve them efficiently when the same query is encountered again. Your task is to write a m... | codefeedback |
You are tasked with implementing a method to update a Spectacle object in a Java web service. The method signature is as follows:
```java
public EspectaculoDetailDTO updateEspectaculo(Long id, EspectaculoDetailDTO espectaculo) throws BusinessLogicException, UnsupportedOperationException
```
The `updateEspectaculo` me... | codefeedback |
You are tasked with creating a Python script to convert SVG files to PNG format using the Inkscape command-line tool. The script should iterate through all the files in a specified input directory, identify the SVG files, and then convert each SVG file to a PNG file with a specified width and height using the Inkscape ... | codefeedback |
You are tasked with implementing a function to calculate the power of a given number. The function should handle both positive and negative exponents. You are given a code snippet that partially implements the power calculation function. Your task is to complete the function and handle all edge cases.
You are provided... | codefeedback |
You are tasked with creating a shell script that processes command-line arguments and provides specific information about them. Your script should accept at least two parameters and then display the following information:
- The first parameter passed to the script.
- The second parameter passed to the script.
- All the... | codefeedback |
You are tasked with creating a Python program that interacts with a natural language generation (NLG) server to generate dynamic and personalized text content. The NLG server is provided by the `jady` library, which offers a range of functionalities for generating natural language text based on input data.
Your progra... | codefeedback |
You are tasked with creating a Python function that compares a list of actual results with a list of expected results and raises specific assertions for any discrepancies. The function should take in two parameters: `results` and `expected_results`. Each `results` list contains objects with attributes `type_name`, `tex... | codefeedback |
You are tasked with implementing a function that handles GraphQL types in Python. The function should be able to determine the nullable type of a given GraphQL type and handle cases where the type is not nullable.
Write a function `get_nullable_type` that takes a GraphQL type as input and returns its nullable counterp... | codefeedback |
You are tasked with implementing a simple 3D rendering engine in Rust. The `Model` struct represents a 3D model, and the `shade_views` method is responsible for shading the views of the model. The method returns a boolean value indicating whether the shading operation was successful or not. Your task is to complete the... | codefeedback |
You are tasked with implementing a Discrete Gaussian Distribution Polynomial Sampler in Python. The Discrete Gaussian Distribution is a probability distribution over the integers, and the sampler should generate random samples from this distribution for polynomials over a given ring.
Your task is to complete the imple... | codefeedback |
You are tasked with implementing a custom `Sentinel` class in Python that represents a special value used to indicate the absence of a "real" value. The `Sentinel` class should be designed to behave similarly to the `_NONE` class in the provided code snippet.
Your task is to create a `Sentinel` class that, when used a... | codefeedback |
You are tasked with creating a program to analyze salary data for employees in different departments of a company. The data is represented as a list of tuples, where each tuple contains the employee's name, department, current salary, and previous salary. Your task is to write a function that calculates the average sal... | codefeedback |
You are tasked with implementing a function to calculate the indices of vertices and faces for a 3D box mesh. The given code snippet provides some context and partial implementation for this task. The box is divided into segments along its length, width, and height, and the function needs to calculate the indices of ve... | codefeedback |
You are tasked with creating a custom dependency injection framework for a Java application. The framework should allow for the binding of interfaces to their respective implementations. To achieve this, you need to implement a simplified version of the dependency injection framework using Java.
Your task is to create... | codefeedback |
You are tasked with implementing a custom memory management system for a programming language that supports object-oriented features. The system should include a garbage collector to automatically deallocate memory for objects that are no longer in use. To achieve this, you need to implement a mark-and-sweep garbage co... | codefeedback |
You are tasked with implementing a binary data reader that can parse and interpret a specific file format. The file format consists of a sequence of records, each containing a fixed number of fields. Each field has a specific data type and length. Your task is to write a Python function that reads the binary data from ... | codefeedback |
You are tasked with implementing a transactional operation within a Laravel application. The provided code snippet is a part of a method within a Laravel Eloquent model. The `create` method is called to persist data to the database within a transaction, and a pagination value is retrieved from the input data or set to ... | codefeedback |
You are tasked with implementing a Python decorator that measures the execution time of a function and prints the result. The decorator should take into account any preload options specified by the user and handle them appropriately.
Your task is to complete the implementation of the `handle_preload_options` decorator... | codefeedback |
You are tasked with implementing a simplified version of a JavaScript Extension (JSX) object for handling attributes in an XML Forms Architecture (XFA) environment. The provided code snippet is a part of the CJX_Area class, which is responsible for managing the attributes of an area in an XFA form.
The `CJX_Area` clas... | codefeedback |
You are tasked with implementing a custom weight decay optimizer for a neural network training process. The optimizer is based on the Adam optimizer with the addition of a weight decay term. The provided code snippet is a part of the optimizer's update step, where the weight decay is applied to the parameters of the ne... | codefeedback |
You are tasked with creating a web application for a car rental company. The application should allow users to view available cars, make reservations, and manage their reservations. As part of this project, you need to implement a feature that allows users to update their reservation details, including the pickup and r... | codefeedback |
You are tasked with creating a task management system for a game. Each task has specific attributes and requirements. Your goal is to implement a function that calculates the total time required to complete a task at a given level, taking into account the time cost function and whether banking the resource is allowed.
... | codefeedback |
You are tasked with creating a Python function that parses a user-agent string to extract specific information about the client's browser and operating system. The user-agent string contains details about the client's browser, rendering engine, and operating system. Your function should extract and return the browser n... | codefeedback |
You are working on a software project that involves parsing and extracting information from a specific type of source code written in a language that includes Cyrillic characters. The code snippet provided is a part of a Python class method that is responsible for processing and formatting this source code. The method ... | codefeedback |
You are tasked with creating a script to manage software packages in a Linux distribution using the KISS package manager. The KISS package manager is a simple package manager that uses a file-based approach to package management. The script should iterate through a list of package categories and install the packages wi... | codefeedback |
You are tasked with implementing a function to calculate the Cramér-Rao lower bound (CRB) for a single particle state in a simulation. The CRB is a measure of the precision of parameter estimation in statistical models. The provided code snippet initializes a single particle state, updates it with different radii, and ... | codefeedback |
You are tasked with creating a program that simulates a version control system for a software project. The program should support the following operations:
1. `run_test -i`: Run the test suite in isolation mode.
2. `run_test -c`: Run the test suite in coverage mode.
3. `run_test -a committer`: Run the test suite in ac... | codefeedback |
You are tasked with creating a RESTful API for managing a list of products using Django and Django REST framework. Your task is to implement two views for the product model: one for listing and creating products, and another for retrieving, updating, and deleting individual products.
You are provided with the followin... | codefeedback |
You are tasked with implementing a function that filters a collection of art pieces based on various criteria. The function should take in a list of art pieces, each represented by a structure containing the following fields:
- `categoryId` (integer): The category ID of the art piece.
- `from` (string): The starting d... | codefeedback |
You are tasked with implementing a simple cache system using Python. The cache system should support the following operations: get(key), set(key, value), and delete(key). Additionally, the cache should have a maximum capacity, and when the capacity is reached, the least recently used item should be evicted to make spac... | codefeedback |
You are tasked with implementing a method for creating an `ObjectSet` from a raw pointer in the context of the Fontconfig library. The `ObjectSet` represents a set of font objects, and the method `from_raw` is responsible for constructing this set from a raw pointer to a `FcObjectSet`. The method assumes ownership of t... | codefeedback |
You are working on a natural language processing (NLP) project and need to manage various pre-trained models and resources stored in different locations. The provided code snippet shows a configuration file with paths to different resources stored in Amazon S3 buckets. Your task is to write a Python function that extra... | codefeedback |
You are working on a software project that involves generating reports using JasperReports, a popular Java reporting library. As part of this project, you need to implement a feature that allows users to save reports in multiple sheets within an Excel file. You have come across a code snippet from the JasperReports lib... | codefeedback |
You are tasked with creating a Python function that simulates a simple banking system. The function should allow users to deposit, withdraw, and check their balance. Additionally, the function should handle cases where the user tries to withdraw more money than their current balance allows.
Your task is to implement t... | codefeedback |
You are tasked with creating a Python function that processes a list of pictures and returns a dictionary containing the count of pictures processed and the average size of the pictures. You should also write unit tests for this function using the `unittest` framework.
Create a Python function `process_pictures(pictur... | codefeedback |
You are tasked with implementing a function that sends an SMS signature application using the provided code snippet as a reference. The function should construct a request payload based on the given parameters and make a POST request to a specific endpoint. Your task is to create the function that accomplishes this tas... | codefeedback |
You are given a list of integers representing the heights of a series of buildings. Each integer represents the height of a building at a specific position. Your task is to write a function `max_area` to find the maximum area that can be formed by selecting two buildings. The area is calculated by multiplying the minim... | codefeedback |
You are tasked with creating a Java class that implements a specific data access pattern using the Spring Data JPA framework. Your goal is to define a custom repository interface that extends the JpaRepository interface and provides additional functionality for interacting with a database table.
Create a Java interfac... | codefeedback |
You are tasked with implementing a Python class that represents a simple bank account. The class should have methods to deposit funds, withdraw funds, and check the current balance. Additionally, the class should keep track of the total number of transactions (deposits and withdrawals) made on the account.
Your task i... | codefeedback |
You are tasked with creating a script to automate the retrieval of the IP address of a specific Kubernetes node and setting it as an environment variable. The Kubernetes cluster has a node named "test-gslb1-${NODE_ROLE}" where ${NODE_ROLE} is a placeholder for the role of the node. The IP address of this node needs to ... | codefeedback |
You are tasked with implementing a priority queue data structure using Python. A priority queue is a data structure that stores elements along with their associated priorities and allows for efficient retrieval of the element with the highest priority. In this problem, you will be implementing a priority queue using a ... | codefeedback |
You are tasked with implementing a function to parse and analyze a Python script containing functions related to a job application interface. The script contains functions for opening a new tab in a web browser, resuming a job application, and creating a cover letter. Your task is to extract and display the names of th... | codefeedback |
You are working on a project that involves managing multiple packages, each containing various files and directories. Your task is to write a script that will remove specific files and directories from all the packages based on a given list of file and directory names.
You are given the following list of files and dir... | codefeedback |
You are given a snippet of code that contains an `else` statement. Your task is to create a program that simulates the behavior of this `else` statement in a specific context.
Write a Python function called `check_number` that takes an integer `num` as input. The function should return a string based on the following ... | codefeedback |
You are tasked with creating a web application for managing agricultural records. The application uses the Laravel framework, and you are working on the "FincaController" which is responsible for handling farm-related operations. The controller has two methods: "index" and "guardar".
The "index" method is used to disp... | codefeedback |
You are given a code snippet for a function `smallestRepunitDivByK` that takes an integer `K` as input. The function is intended to find the length of the smallest positive integer `N` such that `N` is a multiple of `K`, and `N` consists only of the digit 1 repeated one or more times.
Your task is to complete the impl... | codefeedback |
You are tasked with creating a Swift function that interacts with Core Data, a framework provided by Apple for managing the model layer of an application. Your function should retrieve a specific entity from the Core Data persistent store and return the results in a structured format.
Write a function `fetchEntity` th... | codefeedback |
You are tasked with implementing a function to decode a specific type of action from a JSON file in Swift. The action to be decoded is a navigation action called "pushView" used in a mobile application framework. The action contains a route with a URL that may include a placeholder for a variable. Your task is to write... | codefeedback |
You are tasked with implementing a Rust function that processes asynchronous operations and handles potential errors using the `expect` method. Your goal is to create a function that initializes a communication channel and returns a sender and receiver pair. The function should handle potential errors using the `expect... | codefeedback |
You are tasked with implementing a class that interacts with a web API to retrieve user information and game data. The class has a method that is responsible for initializing the API connection, loading user information, and retrieving a list of all games associated with the user. The provided code snippet is a part of... | codefeedback |
You are tasked with implementing a function to scan a list of equities for potential diagonal butterfly spreads. A diagonal butterfly spread is an options trading strategy that involves buying and selling options at different strike prices and expiration dates. The goal is to identify equities that exhibit the potentia... | codefeedback |
You are tasked with implementing a class that manages account information using the provided interface `IAccountContext`. The interface has three properties: `Id`, `HashedId`, and `PublicHashedId`. Your goal is to create a class `AccountManager` that implements the `IAccountContext` interface and provides functionality... | codefeedback |
You are tasked with creating a Python function that validates the methods of a class based on certain criteria. The function should take in a dictionary representing the methods of a class and a regular expression pattern, and it should perform the following tasks:
1. Check if the method names are valid by matching the... | codefeedback |
You are tasked with creating a Swift package manager tool that automates the process of adding dependencies to a Swift package. The tool should be able to parse a given configuration file and modify the package's dependencies based on the specified conditions.
The configuration file is in JSON format and contains the ... | codefeedback |
You are tasked with creating a Vue plugin for text highlighting called "TextMarker". The plugin should be implemented as a Vue constructor and a plugin object. The "marker" variable is declared as the instance of the "TextMarker" type.
Your task is to implement the "TextMarker" plugin using Vue and TypeScript. The plu... | codefeedback |
You are tasked with implementing a custom PyTorch module for a sequence-to-sequence model. The module includes a forward method that takes source and answer embeddings as input and processes them using a bidirectional GRU (Gated Recurrent Unit) layer. The forward method also utilizes pack_padded_sequence and pad_packed... | codefeedback |
You are tasked with creating a Python program that utilizes the `pywatchman` library to monitor changes in a specified directory. Your program should be able to connect to the Watchman service, subscribe to changes in the directory, and then print out the details of any changes that occur.
Your program should perform ... | codefeedback |
You are tasked with implementing a JSON patch operation to remove a specific field from a JSON object. The patch operation is represented as a list of operations, and each operation specifies the type of operation (in this case, "remove") and the path to the field to be removed.
You are given a code snippet that demon... | codefeedback |
You are tasked with implementing a Python decorator that performs stack checking for a given function. The decorator should check if the stack is empty before calling the function and raise an exception if it is not. Your task is to complete the implementation of the `check_stack` decorator and apply it to the `Cleanup... | codefeedback |
You are working on a Python package for data analysis, and you need to implement a function that calculates the correlation coefficient between two sets of data. The `getters` module provides two functions: `get_dist_url` to retrieve the URL of the dataset and `scatter_values` to obtain the scatter plot values for the ... | codefeedback |
You are tasked with implementing a Python class that manages the alignment tools for a graphical user interface (GUI) application. The class, `AlignDistributeToolBar`, is responsible for providing alignment functionalities for various GUI elements. The provided code snippet initializes the `AlignDistributeToolBar` clas... | codefeedback |
You are tasked with creating a Swift function that processes a given file and returns the line and column numbers of a specific character within the file. The function should also check if the iOS version is available and handle any conditional compilation directives present in the file.
You are provided with a code s... | codefeedback |
You are working on a graphics rendering engine and need to implement a method for transforming world positions to screen positions. The method should handle both orthographic and perspective projections. You are given a code snippet that contains the logic for this transformation, but it seems to have some issues. Your... | codefeedback |
You are tasked with creating a Java program that simulates a simple library management system. The system should allow users to add books, remove books, and display the list of available books. Each book in the library has a unique identifier, title, and author.
Your task is to implement the `Library` class with the f... | codefeedback |
You are tasked with implementing a class for managing a gaming platform's user data. The class should provide methods for validating user input, checking if a user is registered, retrieving all user data, and fetching high scores within a specified time frame and category.
You are given the following method signatures... | codefeedback |
You are tasked with implementing a memory allocation tracking system similar to the one used in the code snippet provided. Your goal is to create a program that can track memory allocation and deallocation statistics for a custom memory management system.
Your program should provide the following functionalities:
1. I... | codefeedback |
You are given an array of non-negative integers, where each element represents the maximum jump length from that position. Write a function `can_jump` to determine if you can reach the last index.
The function should take in a single parameter:
- `nums`: a list of non-negative integers representing the maximum jump le... | codefeedback |
You are tasked with implementing a message queue system using Java. The system should support subscribing to channels and receiving messages from those channels. You are provided with a partial code snippet for a `SubscribeManager` class, which extends an `AbstractSubscribeManager` class from the `com.pubnub.api` packa... | codefeedback |
You are tasked with implementing a temperature sensor query service using the DS18B20 temperature sensor. The provided code snippet is a simplified version of a RESTful API endpoint that queries the availability of DS18B20 temperature sensors.
Your task is to extend the functionality of the `DS18B20Query` class to inc... | codefeedback |
You are tasked with implementing a Python module that provides a custom context manager for handling file operations. The module should utilize the `elib` library and the `Context` class from the `_context` module. The custom context manager should ensure that a file is properly opened, its contents are read, and then ... | codefeedback |
You are tasked with implementing a file download manager that communicates with a remote server. The provided code snippet is a part of the client-side logic for initiating a file download. The snippet includes error handling and a message for starting the download process.
Your task is to complete the implementation ... | codefeedback |
You are given a list of integers representing the scores of a game. The game has a rule that a player can only play if their score is greater than the average score of all players. Your task is to write a function that takes the list of scores and returns the number of players who can play the game.
Function Signature... | codefeedback |
You are given a Python function `product_sans_n(nums)` that takes a list of integers `nums` as input. The function is intended to return a new list where each element is the product of all the elements in the input list except for the element at that index. However, there are special cases to consider:
- If there are ... | codefeedback |
You are tasked with creating a Python class that simulates a simple library management system. The class should be able to add books to the library, lend books to borrowers, and display the current inventory of books. Additionally, the class should keep track of the borrowers who have borrowed books and the due dates f... | codefeedback |
You are working on a data processing system that involves executing functions on a database node. The system uses a `db` object to interact with the database and a `df` object representing a data frame. The `run` function takes a database node `db_node` as input, retrieves an executable function from the database using... | codefeedback |
You are tasked with creating a custom validation system for a form input using Python. The goal is to implement a `Validator` class that can be used to validate user input based on a given function and error message. The `create_validator` function is provided as a starting point, but you need to extend it to create a ... | codefeedback |
You are given a Python function that takes a list of tuples as input and calculates a specific value based on the elements of the tuples. Your task is to understand the given code snippet and implement a function that achieves the same result.
You need to implement a Python function called `calculate_value` that takes... | codefeedback |
You are tasked with implementing a Python class for managing plans in an invoicing system. The class should be able to create, update, and retrieve plan details from the invoicing system's API. Your task is to complete the implementation of the `Plan` class by adding the necessary methods to interact with the API and e... | codefeedback |
You are tasked with creating a Python function that interacts with an external API using the `opsramp` library. The `opsramp` library provides a set of functions to manage and monitor IT operations. Your function should authenticate with the API, retrieve a list of devices, and then return the count of devices that are... | codefeedback |
You are tasked with implementing a function to process a 2D grid of points based on certain conditions. The grid is represented by its dimensions `size_x` and `size_y`, and the function is responsible for determining the properties of each point in the grid. Two helper functions, `check_point_asph` and `check_point_sph... | codefeedback |
You are tasked with implementing a Python function to parse a connection string for an Azure Event Hubs service bus. The connection string contains various parameters such as the endpoint, shared access key name, shared access key, and entity path. Your task is to create a function that can extract and validate these p... | codefeedback |
You are tasked with implementing a simple physics simulation using the Box2D library. Your goal is to create a class representing a joint in the physics world and implement its functionality for updating and drawing.
You are provided with a partial code snippet that sets up a test suite for the Box2D joint class. The ... | codefeedback |
You are tasked with implementing a shell script that processes IP address ranges and outputs the corresponding range in CIDR notation. The script should handle three different cases: single IP address, IP address with subnet mask, and no input.
Your task is to complete the shell script by implementing the missing func... | codefeedback |
You are tasked with implementing a shell script function that automates the setup and execution of a development environment using the `ddev` tool. The `ddev` tool is a local development environment management tool commonly used for web development projects.
Your task is to complete the `ddev-install` function, which ... | codefeedback |
You are tasked with creating a Python class that processes and analyzes video data from a dataset. The dataset contains information about various videos, including their titles, durations, and upload dates. Your goal is to create a class that can perform specific operations on this video data.
Create a Python class ca... | codefeedback |
You are tasked with implementing a Variational Autoencoder (VAE) using Pyro, a probabilistic programming language built on top of PyTorch. Your goal is to define the model and guide functions for the VAE, which involves creating an encoder and decoder network, setting up the model for the conditional probability distri... | codefeedback |
You are tasked with implementing a function to calculate the sector number based on the given global angle in a coordinate system. The global angle is represented in degrees, and the sector number is determined based on the sector's angular range. The sector number is calculated by subtracting a constant offset from th... | codefeedback |
You are tasked with creating a Python program to manage NFC (Near Field Communication) tags. The program should continuously poll for NFC tags and store their information in a Parse database. NFC tags are unique identifiers that can be read by NFC-enabled devices. The code snippet provided is a part of the program and ... | codefeedback |
You are tasked with implementing a message storage system that allows adding new base messages and checking for the existence of exactly the same message. The system is represented by a class with a method `add_new_base_message` that takes a new base message as input and returns the added message. The method should als... | codefeedback |
You are tasked with implementing a URI redirection mechanism in a web application. The application receives URIs and needs to check if the URI is a protocol request, and if so, redirect it to a specific URI based on certain conditions. You are given a code snippet that partially implements this functionality. Your task... | codefeedback |
You are tasked with implementing a caching mechanism for a document retrieval system. The system retrieves documents based on a query and two document identifiers. To optimize performance, the system employs a caching strategy to store previously computed preferences for document pairs. Your task is to design and imple... | codefeedback |
You are tasked with implementing a function that calculates the number of times a given character appears in a string and its subsequent substrings. The function should take two parameters: a string and a character. The function should return an array of integers, where each element represents the count of the characte... | codefeedback |
You are tasked with creating a custom annotation in Java that can be used to specify the MIME type for a reactive socket. The annotation should allow developers to override the default MIME type if needed. Your task is to implement the custom annotation and demonstrate its usage in a sample class.
Create a custom anno... | codefeedback |
You are tasked with implementing a graph-based recommendation system using a heterogeneous graph. The system involves constructing a heterograph, setting node features, and handling self-relations. Your task is to complete the function `construct_heterograph` that takes in the following parameters:
- `target_node_type`... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.