instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a Python class for a board game. The game board is represented by a 2D grid of cells, and the class should provide methods for placing game pieces, checking for winning conditions, and displaying the current state of the board.
Your task is to complete the implementation of the `Board`... | codefeedback |
You are tasked with creating a Python script to automate the generation of SSL/TLS certificates for a server. The script should use the `openssl` command-line tool to generate a private key, a certificate signing request (CSR), and a self-signed certificate with Subject Alternative Name (SAN) extension.
Your script sh... | codefeedback |
You are working on a machine learning project and have a dataset that needs to be preprocessed and used for training a model. The dataset is represented as a tensor and needs to be shuffled before being passed to the training function. Additionally, a model needs to be trained using the preprocessed dataset. Your task ... | codefeedback |
You are working on a security testing tool that manipulates HTTP requests to identify potential vulnerabilities in web applications. Your task is to implement a function that generates a list of modified HTTP requests based on different sources of input data.
You are given the following code snippet as a starting poin... | codefeedback |
You are tasked with implementing a Python function to perform a network connectivity check for a given SMTP server. The function should take in a dictionary containing the SMTP server's details and return a boolean value indicating whether the server is reachable.
The dictionary will contain the following key-value pa... | codefeedback |
You are tasked with implementing a custom type alias system in Swift. Type aliases are used to provide alternative names for existing types. Your goal is to create a function that takes an array of type alias declarations and returns a dictionary mapping the original type to its alias.
You are given the following code... | codefeedback |
You are tasked with creating a Python program that simulates a simple communication test framework. The program should include a class for sending test data and a mechanism for running automated tests.
Your task is to implement the `BaseCommunicationTestDataSender` class and the test execution logic.
The `BaseCommuni... | codefeedback |
You are tasked with creating a program that generates a specific type of plot using Python's matplotlib library. The plot should display a set of data points and a regression line. Your task is to write a function that takes in the data points and generates the plot as described.
Write a Python function called `genera... | codefeedback |
You are tasked with creating a Python function that parses a configuration file and extracts specific information from it. The configuration file follows a specific format, with key-value pairs separated by an equal sign (=) and each pair on a new line. The keys and values may contain alphanumeric characters, underscor... | codefeedback |
You are tasked with implementing a reinforcement learning algorithm for training a neural network to control an agent in a simulated environment. The given code snippet is part of the training process and involves splitting the data into training and testing sets, defining the dimensions of the observation and action s... | codefeedback |
You are tasked with implementing a chess move validation function for a basic pawn move in a chess game. The function should take into account the current position of the pawn and the intended destination, and determine whether the move is valid according to the rules of chess.
The chess board is represented using al... | codefeedback |
You are tasked with implementing a function to read a configuration file based on the XDG Base Directory Specification. The XDG Base Directory Specification defines the base directory paths for configuration files, among other things. Your task is to create a function that reads the configuration file and returns the c... | codefeedback |
You are tasked with creating a custom code transformation plugin for a documentation tool. The plugin should parse and transform specific code blocks within the documentation content. The code snippet provided is a TypeScript function that serves as the foundation for the plugin. Your task is to extend this function to... | codefeedback |
You are tasked with implementing a URL routing system for a web application framework. The framework uses a list of tuples to define the URL patterns and their corresponding view functions. Each tuple contains the following elements:
1. URL pattern: A string representing the URL pattern with placeholders for dynamic pa... | codefeedback |
You are tasked with creating a Django model for a blog post. The model should include fields for the post's title, author, publication date, content, excerpt, category, image, and publication status. Your task is to implement the model class for the blog post according to the given requirements.
Your task is to comple... | codefeedback |
You are tasked with creating a data augmentation pipeline for image processing. The pipeline should apply a series of random transformations to input images to increase the diversity of the training dataset. The transformations include random brightness or contrast adjustment, vertical and horizontal flips, and the pos... | codefeedback |
You are tasked with creating a chatbot that responds to user input with predefined messages. The chatbot should randomly select a response from a set of predefined answers and handle specific commands such as retrieving the weather or providing a status update. Your task is to implement the logic for the chatbot's resp... | codefeedback |
You are working on a compiler for a new programming language called "VLang." As part of the compiler's optimization phase, you need to implement a transformation that involves manipulating abstract syntax trees (ASTs). The provided code snippet is a part of the transformation function that you need to complete.
The tr... | codefeedback |
You are working on a project to develop a parser for a specific text format. The code snippet provided is a part of the parser implementation in C#. The parser is designed to parse and process a specific type of text data. Your task is to understand the given code snippet and create a parser for a similar text format u... | codefeedback |
You are tasked with implementing a custom DataLoader for a computer vision project using PyTorch. The provided code snippet is a part of a larger codebase for a CCTV (Closed-Circuit Television) learning system. The `cctv_learning.register_experiment` decorator is used to register an experiment for the CCTV learning sys... | codefeedback |
You are tasked with implementing a function that takes an array of integers and returns the maximum product that can be obtained by multiplying any three integers from the array. If the array contains fewer than three integers, the function should return 0.
You need to write a function `maxProductOfThree` that takes a... | codefeedback |
You are tasked with implementing a simple device management system for IoT devices using Swift. The system will handle the registration and monitoring of devices, as well as counting the total number of registered devices.
You are given a code snippet that declares a variable `device` of type `ESPDevice` and initializ... | codefeedback |
You are tasked with creating an Observable that emits the values from two given Singles as soon as possible. The Singles `s1` and `s2` emit strings "a" and "b" respectively, after a delay of 1 and 2 seconds. Your goal is to combine these Singles into an Observable that emits both values "a" and "b" as soon as they are ... | codefeedback |
You are tasked with creating a Swift protocol for managing detachable disk properties. The protocol should include specific properties and methods for detaching a disk. Your task is to define the `DetachDiskPropertiesProtocol` in Swift, adhering to the given code snippet and additional requirements.
Your `DetachDiskPr... | codefeedback |
You are tasked with implementing a class to manage a library of books. The class should allow for adding, removing, and searching for books, as well as displaying the entire library. Each book has a title, author, and unique ISBN (International Standard Book Number). The library should be able to hold a maximum of 100 ... | codefeedback |
You are tasked with implementing a Python function that processes a YAML file to build a darknet backbone model. The function should read the model configuration from the YAML file, extract relevant information, and use it to construct the backbone model. Additionally, the function should handle the normalization param... | codefeedback |
You are tasked with implementing a class for stereo camera calibration in Python. The class should be able to read calibration parameters from XML files and perform stereo calibration and rectification. The provided code snippet shows the initialization of file paths and the usage of a `StereoCalibration` class to read... | codefeedback |
You are tasked with creating a program to manage a library's book borrowing system. The program should track the availability of books and allow users to borrow and return books. To achieve this, you need to implement a class for managing books and a class for managing library members.
Create a class `Book` with the f... | codefeedback |
You are tasked with creating a web application that tracks the number of times a user visits a specific page and displays a questionnaire. The code snippet provided is a part of the PHP backend logic for this application. The `$_SESSION['pageCount']` variable is used to track the number of times the user has visited th... | codefeedback |
You are tasked with creating a program to simulate a deck of playing cards and perform various operations on it. The deck consists of 52 cards, with 4 suits (spades, clubs, hearts, diamonds) and 13 ranks (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A). Your program should be able to shuffle the deck, deal a specified number o... | codefeedback |
You are tasked with creating a Python script that processes a configuration file for VNC server services and performs various operations based on the directives specified in the file. The configuration file contains a series of directives, each specifying an action to be taken for a VNC server service.
The directives ... | codefeedback |
You are tasked with implementing a memory write function for a custom kernel. The provided code snippet is a part of the existing implementation and contains error handling, assertions, and logging statements. Your task is to complete the implementation of the memory write function based on the given code snippet and a... | codefeedback |
You are tasked with implementing a generic repository interface for managing the progression of character classes in a role-playing game system. The interface should provide standard CRUD (Create, Read, Update, Delete) operations for class progression data.
You are given the following code snippet as a starting point:... | codefeedback |
You are tasked with creating a script to automate the deployment and testing of a Docker container. The script should perform the following tasks:
1. Mount the `/dev/net/tun` device inside the container.
2. Add the `NET_ADMIN` capability to the container.
3. Start a Docker container named `mir-stackv4-ukvm`.
4. Retriev... | codefeedback |
You are tasked with implementing a Python class for a neural network layer. The class should have the following properties and methods:
Properties:
- `type`: a string representing the type of layer, which is always 'conv' for convolutional layers.
- `name`: a string representing the name of the layer.
- `neural_struct... | codefeedback |
You are tasked with creating a user authentication system for a web application. The system should allow users to register, log in, view their profile, and update their profile information. The system should also handle cases where users attempt to perform unauthorized actions, such as accessing another user's profile ... | codefeedback |
You are tasked with implementing a class for surface registration in a medical imaging application. The class, `SurfaceRegistration`, is responsible for registering surface data to a reference coordinate system. The provided code snippet is a part of this class and involves the use of a matrix list and a method to retr... | codefeedback |
You are tasked with creating a Python class that processes and renders files based on the provided PeeweeORM subclasses. Your task is to implement the `render_files` method in the `PeeweeCombustionChamber` class, which takes a list of PeeweeORM subclasses as input and processes them to render the files.
The `PeeweeCom... | codefeedback |
You are tasked with implementing a program to perform a depth-first search (DFS) on a graph to discover all the nodes reachable from a given starting node. The graph is represented using an adjacency list, and the nodes are labeled with unique integers. Your program should output the order in which the nodes are discov... | codefeedback |
You are tasked with implementing a method to sort a list of polygons based on their total perimeter. The method should take an ArrayList of Polygon objects as input and return a new ArrayList containing the polygons sorted in ascending order of their total perimeter. The total perimeter of a polygon is the sum of the l... | codefeedback |
You are tasked with implementing a function to retrieve music releases from the Bandcamp API based on specified criteria. The function `get_bandcamp_releases` takes in parameters such as `tag_str`, `page_count`, `location_id`, `region_str`, and `sort_str` to customize the search. The function constructs a list of post ... | codefeedback |
You are tasked with creating a Python function that processes a dictionary containing package dependencies and their respective installation requirements. The function should analyze the dependencies and return a list of unique packages that are required for both development and documentation purposes.
You are given a... | codefeedback |
You are tasked with implementing a timeout mechanism for a parallel processing system. The system consists of multiple threads running in parallel, and you need to ensure that certain operations do not exceed a specified time limit. Additionally, there is a global stop flag that, when set, should immediately halt all p... | codefeedback |
You are tasked with implementing a custom asynchronous service in Rust. Your service will need to handle asynchronous requests and produce responses using the `futures` crate. The provided code snippet defines a type `IntoServiceFuture` which represents a future that resolves to a response. Your task is to create a fun... | codefeedback |
You are working with Apache Spark and need to manipulate data using the JavaPairRDD API. Your task is to create a program that takes an input JavaPairRDD, repartitions and sorts it within partitions using a specified partitioner, and then examines the output by printing the contents of each partition.
You are given a ... | codefeedback |
You are tasked with creating a script to automate the process of cleaning and building a snap package for a software project. Snapcraft is a tool used to build and package software as snaps, which can be installed and run across a range of Linux distributions. The provided code snippet is a part of the automation scrip... | codefeedback |
You are tasked with implementing a DNS resolver class that supports caching of DNS records. The resolver should be able to add DNS records to the cache and resolve DNS queries using the cached records. Additionally, you need to implement a method to set up a DNS-over-HTTPS (DoH) client using the resolver.
You are prov... | codefeedback |
You are tasked with creating a Python function to preprocess and train a neural network model for classifying Kannada digits. The Kannada digits dataset consists of images of handwritten digits in the Kannada script. The dataset includes training and testing data for both the input images and their corresponding labels... | codefeedback |
You are tasked with creating a program that can parse and extract localized strings from a C# source code file. The localized strings are embedded within properties of a class and are used for internationalization and localization of the application.
Your program should be able to read the C# source code file, identif... | codefeedback |
You are tasked with creating a program that analyzes a given text file to count the occurrences of each unique word. For the purpose of this problem, a word is defined as a sequence of alphanumeric characters (a-z, A-Z, 0-9) separated by any non-alphanumeric character. The program should ignore the case of the words, t... | codefeedback |
You are tasked with implementing a function that parses a time source and extracts the time property from the source object. The source object can be of various types, including `ItemDeltaItem`, and may contain a `PrismProperty` of type `XMLGregorianCalendar`. Your task is to write a function that takes the source obje... | codefeedback |
You are tasked with implementing a version control system for a software project. The system needs to support adjusting and managing different versions of modules within the project. To achieve this, you need to create a module version adjuster that can handle mutable lists and their items.
Your task is to implement t... | codefeedback |
You are tasked with creating a function that calculates the total cost of a swap transaction on a decentralized exchange. The function takes in the gas price and requests the current swap fees from a smart contract. The swap fees are returned as an object containing the base fee and a percentage fee. The total cost of ... | codefeedback |
You are tasked with implementing a Python module that calculates the overall health score of a person based on their skin condition and weight valence. The module should provide functions for assessing skin health and weight valence, and then combining these assessments to produce an overall health score.
The module s... | codefeedback |
You are tasked with implementing a function that retrieves HTML documents from a list of URLs. Your goal is to create a function `get_htmls(urls)` that takes a list of URLs as input and returns a list of HTML documents corresponding to those URLs. You should handle any potential errors that may occur during the retriev... | codefeedback |
You are working on a medical imaging project and need to develop a function to estimate tumor volume from MRI images. The given code snippet is a part of this project and involves processing MRI data using the SimpleITK library in Python. Your task is to implement the `estimate_tumour_vol` function that takes in a mask... | codefeedback |
You are tasked with implementing a cookie management system in TypeScript. The `Cookie` type is defined in a separate file and needs to be imported for use in the main codebase. The `Cookie` type has the following structure:
```typescript
interface Cookie {
name: string;
value: string;
expirationDate: Date;
}
```... | codefeedback |
You are tasked with implementing a blockchain network registry for a Key Management System (KMS). The registry maintains a set of registered blockchain chains and provides methods for adding new chains, updating existing ones, and retrieving information about registered chains.
The provided code snippet is a part of t... | codefeedback |
You are tasked with implementing a generic data access object (DAO) in Swift. The DAO should be capable of interacting with various types of entities and persisting them using a Core Data-based DAO implementation. Additionally, the DAO should support storing default values using a `DefaultsStorage` protocol.
Your task... | codefeedback |
You are tasked with creating a Rust module that manages scheduled tasks. The provided code snippet includes some relevant imports and a module declaration. Your goal is to implement a function within the `registered_task` module that registers a new task with the task scheduler.
Your task is to implement the `register... | codefeedback |
You are tasked with implementing a terminal event handler for a custom terminal application. The terminal event handler has three methods that need to be implemented: `handle_key`, `handle_mouse`, and `handle_resize`. Each method takes specific input parameters and returns a `Result` containing a `Modes` enum.
The `ha... | codefeedback |
You are tasked with implementing a function to process an array of integers and return a new array containing the squares of each integer incremented by 1. You should write a Python function that accomplishes this task efficiently.
Your task is to implement the function `find_squares_opt(array)` where:
- `array` is a ... | codefeedback |
You are tasked with implementing a function that converts a given SVG path data string into an array of commands and parameters. SVG path data strings are used to define the outline of a shape. Each command in the path data string is represented by a single character, followed by a series of parameters. For example, "M... | codefeedback |
You are tasked with simulating the behavior of prey and predator teams in a 2D environment. The provided code snippet initializes the simulation configuration and sets up the interaction between the prey and predator teams. Your goal is to implement the logic for the prey and predator teams' behavior based on the given... | codefeedback |
You are tasked with implementing a Python class that performs mathematical operations on a given value. The class should support addition and division operations, and it should be able to resolve the final mathematical expression based on the operations performed.
Your task is to complete the implementation of the `Ma... | codefeedback |
You are tasked with creating a user registration system for a website. The system should generate a unique username, email, and password for each user. The username should be a combination of a fixed string "TKori" and a number, the email should be in a specific format, and the password should be a randomly generated s... | codefeedback |
You are tasked with creating a web application that utilizes Bootstrap for styling and Google Fonts for typography. Your task is to write a function that extracts the version numbers and integrity keys from the given HTML code snippet. The version number is the part after the '@' symbol in the URL, and the integrity ke... | codefeedback |
You are tasked with implementing a memory allocator for a custom heap in Rust. The allocator should support allocation and deallocation of memory blocks using the `alloc` and `dealloc` functions. The `dealloc` function is already provided, and you need to implement the `alloc` function to complete the memory allocator.... | codefeedback |
You are tasked with implementing a CRC (Cyclic Redundancy Check) calculation module in Rust. The provided code snippet is a part of a Rust module that handles CRC calculations. Your task is to complete the implementation of the CRC calculation function based on the given specifications.
Your task is to implement the `... | codefeedback |
You are tasked with implementing a custom annotation processor for a Java application. The application uses the Jackson library for JSON serialization and deserialization. Your goal is to create a custom annotation that can be used to ignore specific fields during the serialization process. The annotation should be nam... | codefeedback |
You are tasked with implementing a rating system for a sports competition using the Elo rating system. The Elo rating system is a method for calculating the relative skill levels of players in two-player games such as chess. In this problem, we will adapt the Elo rating system for a sports competition where teams compe... | codefeedback |
You are given a dataset containing 2000 data points, each represented by a pair of values. Your task is to write a program to calculate the distance between each pair of points and then find the pair of points with the maximum distance between them. The distance between two points (x1, y1) and (x2, y2) can be calculate... | codefeedback |
You are tasked with implementing a program to calculate the energy levels of a hydrogen atom using the Gaussian quadrature method. The energy levels of a hydrogen atom are given by the formula:
E_n = -13.6 / n^2 electron volts
Where n is the principal quantum number. The Gaussian quadrature method is a numerical inte... | codefeedback |
You are tasked with creating a lexer for a simple programming language. The lexer should be able to tokenize input code into distinct tokens for further processing. However, the given code snippet contains some commented-out lines that need to be properly integrated into the lexer implementation.
Your task is to compl... | codefeedback |
You are tasked with creating a Python function that processes a given CSV file and returns a summary of the data. The function should read the CSV file, perform some data manipulation, and then generate a summary report based on the data. You are provided with a code snippet that imports the necessary modules and libra... | codefeedback |
You are given a string containing only lowercase English letters. Your task is to write a function that finds the length of the longest substring without repeating characters.
For example, given the input string "abcabcbb", the longest substring without repeating characters is "abc", which has a length of 3. For the i... | codefeedback |
You are tasked with creating a simple web API for a book management system. The API should allow users to perform basic CRUD (Create, Read, Update, Delete) operations on a collection of books. You will need to implement the necessary HTTP methods and routes to achieve this functionality.
Your task is to complete the i... | codefeedback |
You are tasked with creating a PHP class that manages services for a landing page. The class should be able to retrieve, add, update, and delete services. You are provided with a code snippet that includes the initial setup for the Service class.
Your task is to complete the Service class by implementing the following... | codefeedback |
You are tasked with implementing a code lens provider for a language server using Python's `asyncio` library. Code lenses are visual indicators displayed in the source code, often used to provide additional information or actions related to the code. Your goal is to create a function that resolves code lenses and exten... | codefeedback |
You are tasked with implementing a function that trains a machine learning model using a custom training loop. The function takes in several parameters, including session, model_dict, time_steps, centralities, train_instance_loader, batch_size, test_batch_size, batches_per_epoch, test_instance_loader, epoch_logging_fil... | codefeedback |
You are tasked with creating a Python program that measures the average time taken to execute a given executable file a specified number of times. Your program should take two command-line arguments: the path to the executable file and the number of times to execute it. The program should then execute the given executa... | codefeedback |
You are tasked with implementing a simple action server for averaging a list of numbers. The action server will receive a list of numbers as a goal, compute the average of the numbers, and provide feedback on the progress of the averaging process. The action server will then return the computed average as the result.
... | codefeedback |
You are tasked with creating a custom view component for a web application using the Kastra framework. The view component, named "SettingsViewComponent," is intended to be accessible only to users with the "GlobalSettingsEdition" claim. The Kastra framework provides the necessary infrastructure for creating and managin... | codefeedback |
You are tasked with creating a program to calculate the sum of all odd numbers that are multiples of three within a given range. Your program should take two integers, `start` and `end`, as input and then calculate the sum of all odd numbers between `start` and `end` (inclusive) that are multiples of three. Finally, th... | codefeedback |
You are tasked with creating a function that checks for duplicate arguments in a GraphQL query. In GraphQL, a query is a string that specifies the data requirements for a client application. The query is structured as a set of fields and arguments, and each argument is specified with a unique name. However, it is possi... | codefeedback |
You are working on a project to support the semantic web, which involves creating symbolic links in a specific directory structure. The directory structure consists of multiple levels, and each level contains a set of files and subdirectories. Your task is to write a program that creates symbolic links for all the file... | codefeedback |
You are tasked with creating a Python script that automates the process of checking and updating the required packages for a software project. The script should read the `INSTALL_REQUIRES` list from a `setup.py` file and then check if the latest versions of these packages are installed. If not, it should update the pac... | codefeedback |
You are tasked with creating a Python function that validates and processes a dictionary of coordinates. The function should handle potential exceptions and provide meaningful error messages for invalid input.
Write a function `process_coordinates(data)` that takes a dictionary `data` as input. The dictionary `data` c... | codefeedback |
You are tasked with implementing a custom dataset class for loading data from an HDF5 file in a machine learning project. The provided code snippet is a part of the dataset class definition. The class is designed to load image and label data from an HDF5 file for either training or validation purposes. The class has at... | codefeedback |
You are tasked with creating a Python class that simulates a simple online review system. The class should allow users to submit reviews for various products and provide functionality to retrieve and display these reviews. Additionally, the class should be able to calculate and display the average rating for each produ... | codefeedback |
You are tasked with implementing a class that provides memory-related functionality for debugging purposes. The class should include methods to retrieve memory bytes and memory context for debugging. Your task is to complete the implementation of the class by providing the necessary code for the `GetMemoryBytes` and `G... | codefeedback |
You are tasked with implementing a custom deserialization logic for a class using the ObjectMapper library in Swift. The provided code snippet shows the beginning of a class called `SHIPMENT_List` that inherits from `BaseBean`. Your task is to complete the implementation of the `SHIPMENT_List` class by adding the neces... | codefeedback |
You are tasked with creating a Python class that manages activities and their associated segments. The class should have methods for deleting segments and handling office location fallbacks. You are provided with a partial code snippet that includes two test cases for these methods. Your task is to implement the missin... | codefeedback |
You are tasked with creating a Python function that processes data from an Excel file containing information about drug reports in different states. The function should read the Excel file, extract the data, and then write the data to separate Excel files for each state. The function should be able to handle missing or... | codefeedback |
You are tasked with implementing a function that calculates the area of a rectangle based on the given style object. The style object contains properties such as borderRadius, color, outline, borderColor, and padding. The borderRadius property specifies the radius of the rectangle's corners, the color property determin... | codefeedback |
You are tasked with implementing a simple class that represents a basic bank account. The class should have methods for depositing funds, withdrawing funds, and checking the current balance. Additionally, the class should enforce a minimum balance requirement, and if a withdrawal would result in the balance falling bel... | codefeedback |
You are tasked with creating a program that processes and analyzes the file structure of a given directory. Your program should be able to identify and count the number of Java source files (.java) within the directory and its subdirectories. Additionally, it should calculate the total number of lines of code across al... | codefeedback |
You are given a Python class `D` and its method `func`. The behavior of the `func` method is determined by the inheritance and method overriding. Your task is to analyze the code and determine the output of the `print` statement.
```python
class A:
def func(self):
return 'A.func'
class B(A):
def func(... | codefeedback |
You are tasked with implementing a custom padding modifier for a SwiftUI-like framework. The `padding` function takes two parameters: `edges` and `length`. The `edges` parameter specifies which edges of the view should be padded, and the `length` parameter specifies the amount of padding to be applied. If `length` is n... | codefeedback |
You are tasked with implementing a Python class for a singly linked list. The class should have the following functionalities:
1. `append(value)`: Add a new node with the given value to the end of the linked list.
2. `prepend(value)`: Add a new node with the given value to the beginning of the linked list.
3. `display(... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.