instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a command-line tool to generate icons for different platforms. The tool should accept various arguments and options to customize the icon generation process.
Your task is to implement the `IconsTask` class and its associated methods to fulfill the requirements. The `IconsTask` class should... | codefeedback |
You are tasked with creating a custom extension method for verifying code annotations in C# source files. The extension method should be able to asynchronously verify the correctness of the annotations using a specified analyzer.
Your task is to implement the `VerifyAsync` extension method for the `AnnotatedSourceFile... | codefeedback |
You are tasked with creating a Python class that processes text data to extract questions from a given input. Your class should implement a method that takes a string as input and returns a list of all the questions present in the text. A question is defined as a sentence that starts with a capital letter, followed by ... | codefeedback |
You are tasked with creating a secure user authentication system for a web application. The system should handle user login and session management securely to prevent unauthorized access to sensitive information.
Your task is to implement a function or method that handles user login and session management. The functio... | codefeedback |
You are tasked with creating a custom memory allocation system for a C++ application. The system should provide a simple interface for allocating and freeing memory, and it should be able to handle memory requests of varying sizes. To achieve this, you need to implement a custom memory allocator using a linked list dat... | codefeedback |
You are tasked with implementing a pagination system for fetching data from a remote server. The provided code snippet is a part of a Swift function that handles the pagination logic. The function is responsible for checking the current state of pagination, determining if there are more pages to fetch, and updating the... | codefeedback |
You are tasked with implementing a function that can parse and extract information from a nested object representing a file structure. The object contains information about files and directories, and your goal is to extract the paths of all the files within the structure.
You are given a JavaScript object representing... | codefeedback |
You are tasked with implementing a class for controlling a walking robot's trajectory. The class should have methods for setting the center of mass (CoM) height and the swing foot height. Additionally, the class should have protected members for a reference trajectory module, maximum vertical force, end time, contact d... | codefeedback |
You are tasked with implementing a Python function that emulates the behavior of the `os.spawnlpe` function using the `subprocess.Popen` module. The `os.spawnlpe` function is used to spawn a new process, and it allows specifying the environment for the new process. Your task is to create a function that takes the same ... | codefeedback |
You are tasked with creating a function to parse an XML file and handle Unicode errors. The function should read an XML file, identify any Unicode errors, and handle them appropriately.
You are given a code snippet from a Django test case that sets the stage for this problem. The `XMLParsingTest` class contains a met... | codefeedback |
You are working on a natural language processing (NLP) project and need to implement a metric aggregation function for evaluating the performance of a model. The given code snippet is part of a larger codebase for a model called MTBertModel, which utilizes various modules for prediction and evaluation. Your task is to ... | codefeedback |
You are tasked with implementing a function that calculates the total number of unique ways to reach the top of a staircase. You are allowed to climb either 1 or 2 steps at a time. The staircase has a total of `n` steps.
Write a function `climbStairs` that takes in an integer `n` and returns the total number of unique... | codefeedback |
You are given a list of software licenses, each represented as a string. Each license contains information about the permissions and conditions for using the software. Your task is to parse the licenses and extract specific details from them.
A software license is represented as a string in the following format:
```
/... | codefeedback |
You are tasked with implementing a function that processes a directional cross-reference section and extracts the referenced entries. A directional cross-reference section is represented as an array of strings, where each string contains a reference to another entry. The references are denoted by the `{dxt}` tag follow... | codefeedback |
You are tasked with implementing a function that takes an integer as input and returns the negation of that integer. However, there's a twist - you are not allowed to use the unary negation operator (-) or any arithmetic operators (+, -, *, /) in your implementation. You can only use bitwise operators and logical opera... | codefeedback |
You are tasked with implementing a Python module that provides functionality for handling personal account numbers (PANs). A PAN is a unique identifier for an individual's account, typically used in financial transactions. The module should include a class `PAN` that encapsulates the behavior and attributes of a PAN.
... | codefeedback |
You are tasked with implementing a command-line interface for a Python application using the `argparse` module. The application is designed to run various cron jobs, and you need to create a new cron job function and add the corresponding command-line argument parsing for it.
Your task is to complete the `cron_chiayi_... | codefeedback |
You are tasked with implementing a payload management system for a messaging protocol. The system should allow for the definition of payload types and their associated IDs, and ensure that the IDs are unique within their respective categories (sendable or receivable).
You are provided with a code snippet that demonstr... | codefeedback |
You are tasked with implementing a simple unit testing framework for a programming language. Your framework should be able to handle test cases, execute them, and report the results. You are given a code snippet of a test case written using the xUnit testing framework for inspiration.
Your task is to implement a TestR... | codefeedback |
You are tasked with implementing a function to calculate the Harmonic Pitch Class Profile (HPCP) based on given frequencies and magnitudes. The HPCP is a feature extraction method commonly used in music information retrieval to represent the pitch content of an audio signal. The HPCP is a 12-element vector representing... | codefeedback |
You are working for a real estate company that specializes in selling properties with mineral rights. Your task is to create a program that compares the mineral rights (MINE) of different properties and generates a visualization for the comparison. The mineral rights are represented as a list of integers, where each in... | codefeedback |
You are tasked with implementing a Clock class in Python that can perform addition and subtraction operations on time values in military format (hhmm) and AM/PM format (hh:mm AM/PM). The Clock class should have methods to convert time from military format to AM/PM format and vice versa. Additionally, the class should b... | codefeedback |
You are tasked with creating a Python script to automate the process of creating a database schema using SQLAlchemy and a given database URL. Your script should take the database URL as input and use SQLAlchemy to create the necessary tables based on the defined models in the microblogging application.
Write a Python ... | codefeedback |
You are tasked with implementing a class that manages configuration changes and allows listeners to be notified when a configuration change occurs. You need to create a `ConfigManager` class that provides methods to add, remove, and notify listeners about configuration changes.
Your `ConfigManager` class should have t... | codefeedback |
You are working on a hotel management system that includes a Booking class with various methods. One of the methods is `get_category`, which retrieves the category of a room based on the room's category code. Another method is `cancel_booking`, which generates a URL for canceling a booking.
Your task is to implement a... | codefeedback |
You are tasked with implementing a function to find the closest obstacle to an ellipsoid in a 3D space. The function takes the ellipsoid parameters and a set of obstacles as input and returns the closest obstacle to the ellipsoid. The ellipsoid is represented by its radii and orientation, while the obstacles are repres... | codefeedback |
You are tasked with creating a program that simulates a simple command-line utility for managing a list of tasks. The program should support adding tasks, marking tasks as completed, listing all tasks, and removing tasks. The tasks should be stored in memory and should persist for the duration of the program's executio... | codefeedback |
You are tasked with creating a Python function that simulates a simplified version of a database migration system. The function should take in a list of migration operations and apply them to a database schema. Each migration operation is represented as a tuple with the following format: (operation_type, model_name, fi... | codefeedback |
You are tasked with creating a custom inspector for a Unity game object that contains a list of topics related to TensorFlow (TF). The code snippet provided is a part of the custom inspector script. The `serializedObject` is a reference to the object being inspected, and it is used to find the property "m_TFTopics" whi... | codefeedback |
You are given a set of nested curly braces as shown in the code snippet below. Your task is to write a function that determines whether the braces are properly nested. A set of braces is considered properly nested if for every opening brace, there is a corresponding closing brace and they are properly nested within eac... | codefeedback |
You are tasked with implementing a custom LSTM layer in Python without using any external libraries such as TensorFlow or Keras. Your custom LSTM layer should be able to handle variable input sequence lengths and should include the ability to return sequences at each time step. Additionally, you need to implement the a... | codefeedback |
You are given a Java code snippet that includes a `Node` class and a `MyNode` class that extends the `Node` class. The `Node` class has a method `setData` that sets the data and prints "Node.setData", while the `MyNode` class has a method `setData` that overrides the `setData` method in the `Node` class and prints "MyN... | codefeedback |
You are tasked with creating a custom error type in Rust for handling serialization and deserialization errors when working with LTSV (Labeled Tab-separated Values) data format. The LTSVError type should be able to represent both serialization and deserialization errors using the From trait to convert from serde_value:... | codefeedback |
You are tasked with creating a program that simulates a simplified version of a cargo management system for a shipping company. The program should be able to handle the loading and unloading of cargo onto/from different types of transport vehicles.
Your task is to implement a Cargo class and a TransportVehicle class w... | codefeedback |
You are tasked with implementing a custom data structure called `State` which is a wrapper around `usize`. The `State` struct has a specific requirement that makes it very hard, if not impossible, to reach the limit manually. Your task is to implement the `State` struct and a method to increment its value, ensuring tha... | codefeedback |
You are tasked with implementing a function to serialize data along with metadata using a specific protocol version. The function should take three parameters: `data` (the main data to be serialized), `metadata` (additional information to be included), and `protocol_version` (the version of the serialization protocol t... | codefeedback |
You are tasked with creating a command-line utility that simulates the behavior of the `ln` command in Unix-based systems. The `ln` command is used to create links between files or directories. Your utility should support creating hard links, symbolic links, and force creating links if the target already exists.
Your ... | codefeedback |
You are tasked with implementing a simple endpoint throttling mechanism for an HTTP server. The goal is to limit the number of requests that can be made to a specific endpoint within a given time frame. You are provided with a Java class `AdHocThrottleEndpoint` that represents an endpoint and its associated throttling ... | codefeedback |
You are tasked with creating a script to generate a FindBugs filter file for a Java project. The script should parse all Java files in a given workspace directory and extract the package names from each file. The package names should then be used to populate the FindBugs filter file. The script should follow the given ... | codefeedback |
You are tasked with creating a mobile device detection system for a web application. The system should be able to identify whether a given user agent corresponds to a mobile device, a tablet, and retrieve the version of a specific device.
You are provided with a PHP class `MobileDetect` that contains the necessary met... | codefeedback |
You are tasked with implementing a function `parseStr` that takes a string as input and returns a dictionary containing the count of each character in the string. The function should ignore spaces and should be case-insensitive, meaning that 'A' and 'a' should be considered the same character.
For example, if the inpu... | codefeedback |
You are tasked with implementing a function that unserializes pairs of data from a given input string. The input string contains a series of key-value pairs in a specific format, and your function should parse and return these pairs as a dictionary.
You are given the following code snippet as a starting point for your... | codefeedback |
You are tasked with implementing a memory management system for a virtual environment. The system is responsible for creating and managing pools of different types of entities within the virtual environment. Each pool is represented by a class, and the memory for these pools is allocated dynamically using the `new` ope... | codefeedback |
You are tasked with implementing a command-line interface (CLI) adapter for a software system. The CLI adapter should provide a way for users to interact with the system through a command-line interface, executing various commands and receiving corresponding outputs. The adapter should be designed to handle different t... | codefeedback |
You are given a code snippet that contains a function named `Special`. Your task is to complete the function by implementing a specific functionality. The `Special` function takes an array of integers as input and should return the count of unique elements in the array.
The function signature is:
```python
def Special... | codefeedback |
You are tasked with creating a unit test for a Java class using the Mockito framework. The class under test is a service that interacts with a database to retrieve and manipulate data. Your goal is to write a unit test that verifies the behavior of the service class without actually interacting with the real database.
... | codefeedback |
You are tasked with implementing a function to perform private encryption using the RSA algorithm. The provided code snippet is a part of a larger cryptographic library and contains a function `private_encrypt` that takes an RSA private key and a byte array as input and returns a result of type `Tomb` or an error. The ... | codefeedback |
You are tasked with creating a program that formats and displays tabular data in a visually appealing manner. The program should take a list of records, where each record is a dictionary representing a row of the table, and a list of column names. The goal is to align the columns and display the data in a neat, organiz... | codefeedback |
You are tasked with implementing a Python class that manages a queue of asynchronous tasks. The class should support adding tasks to the queue, executing tasks in parallel, and retrieving the results of completed tasks. Each task is represented by a function and its arguments. The class should also provide a method to ... | codefeedback |
You are tasked with implementing a function that simulates a simple animation sequence using keyframes. The animation involves rotating a view to the right by a certain angle and then resetting it back to its original state. Your task is to write a function that takes a UIView as input and performs the specified animat... | codefeedback |
You are tasked with creating a program that simulates a simple file management system. The program should allow users to perform basic file operations such as creating, deleting, and listing files in a specified directory.
Your task is to implement a Python class `FileManager` with the following methods:
1. `__init__... | codefeedback |
You are tasked with creating a function that takes in a JavaScript object representing a React element and returns the corresponding HTML string. The React element is represented in the form of a JavaScript object, similar to what is created using `React.createElement()`.
The `React.createElement()` function takes thr... | codefeedback |
You are tasked with creating a Python class that performs static analysis on a codebase. Your class should have methods to display JavaScript dependencies, show toggles, show complexity, and send logs to a logger. Additionally, you need to implement a method to count the number of CouchDB model subclasses in the codeba... | codefeedback |
You are tasked with implementing a Connect Four game using Python. Connect Four is a two-player connection game in which the players first choose a color and then take turns dropping colored discs from the top into a vertically suspended grid. The pieces fall straight down, occupying the lowest available space within t... | codefeedback |
You are tasked with creating a Python function that processes a given list of dates and times and returns the earliest valid date and time in the list. The function should handle time zone localization and return the earliest date and time in the specified time zone, or in the default time zone if no time zone is provi... | codefeedback |
You are working on a text analysis project and need to implement a system that can efficiently extract key phrases from a given text. To achieve this, you decide to use a variety of algorithms for keyword extraction, including SCake, SGRank, TextRank, and YAKE. Each algorithm is implemented in a separate module, and yo... | codefeedback |
You are tasked with creating a custom view in an Android application that displays a list of items in a horizontal scrolling manner. The custom view should be implemented as a subclass of `ViewGroup` and should support adding child views dynamically. Each child view should display an image and some text.
Your task is ... | codefeedback |
You are tasked with implementing a function that calculates the sum of all prime numbers within a given range. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function should take two integer parameters, `start` and `end`, representing the inclusive range wit... | codefeedback |
You are working on a computer vision project and need to manipulate a series of images using the OpenCV library in Python. Your task is to write a function that takes a list of image file names, loads the images, and then concatenates them horizontally after cropping each image to only include the right half. The funct... | codefeedback |
You are tasked with implementing a reminder system using a custom data structure. The data structure supports the following operations:
1. `PopLast`: Remove the last reminder from the data structure.
2. `Continue(usize)`: Add a new reminder with the given index to the end of the data structure.
3. `Edit(usize)`: Modif... | codefeedback |
You are tasked with creating a Django migration for a model named `Channel`. The migration should alter two fields in the `Channel` model: `street` and `voivodeship`. The `street` field should be changed to a boolean field with a default value of `False`, and the `voivodeship` field should also be changed to a boolean ... | codefeedback |
You are working as a DevOps engineer for a company that uses Docker for containerization. Your team is responsible for building and maintaining Docker images for various applications. As part of this process, you need to create a script that automates the building of a Docker image using a specific Dockerfile.
You are... | codefeedback |
You are tasked with implementing a session verification system for an admin panel. The system should verify the session token and return the admin's name if the verification is successful. However, the given code snippet contains some missing parts and potential issues. Your task is to complete the code and identify an... | codefeedback |
You are tasked with implementing a simple TCP server in Rust that can handle multiple client connections concurrently. Your server should be able to receive messages from clients and broadcast those messages to all connected clients. To achieve this, you will need to use the `tokio` library for asynchronous I/O and the... | codefeedback |
You are tasked with creating a Python program that simulates a simple chat server using Flask-SocketIO. The server should handle multiple client connections and allow them to exchange messages in real-time. Your task is to implement the server-side code that initializes the SocketIO server and handles incoming client c... | codefeedback |
You are tasked with creating a chatbot for managing addresses and statistics. The chatbot should be able to display addresses, provide statistics, and allow users to perform various actions on the addresses. You need to implement a function that processes the user's input and returns the appropriate response based on t... | codefeedback |
You are tasked with implementing a C++ template class that serves as a base widget for a radio button in a graphical user interface (GUI) application. The provided code snippet is a partial implementation of this base widget class. Your task is to complete the implementation of the `radio_btn` class by adding necessary... | codefeedback |
You are given a Python code snippet that involves the use of PyTorch tensors and operations. Your task is to understand the code and implement a function that performs similar operations using PyTorch.
You need to implement a function `calculate_likelihood_loss(adj, mm_mask, mask)` that takes three inputs:
- `adj`: a ... | codefeedback |
You are tasked with implementing a Python function that takes a list of integers as input and returns the count of prime numbers in the list. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function should be named `count_primes` and should take a single para... | codefeedback |
You are tasked with implementing a command handler for a classroom application. The application uses the MediatR library for handling commands and queries. Your goal is to create a handler for the `LeaveClassroomCommand` that removes a student from a classroom.
The `LeaveClassroomCommand` class is defined as follows:
... | codefeedback |
You are working for a software development company that is building a time tracking system for its employees. The system needs to parse and process data from a CSV file containing time tracking information. Each row in the CSV file represents a time entry with the following columns: username, date, task, duration, work... | codefeedback |
You are tasked with implementing a LossStatistic class that calculates and tracks the loss statistics during the training process of a machine learning model. The LossStatistic class should inherit from RunningCallbackFreeStatistic and be initialized with the following parameters:
- platform: An instance of PlatformMan... | codefeedback |
You are tasked with creating a program that analyzes a given HTML file and extracts specific information from it. The HTML file contains various content boxes, each with a title and a paragraph of text. Your task is to extract the titles and the corresponding paragraphs from the content boxes and store them in a struct... | codefeedback |
You are tasked with implementing a Caesar cipher encryption and decryption program for Base64 encoded strings. The Caesar cipher is a simple encryption technique in which each letter in the plaintext is shifted a certain number of places down or up the alphabet. In this case, we will be applying the Caesar cipher to a ... | codefeedback |
You are tasked with creating a Python program that manages a dictionary of words and their definitions. The program should include functions to load the dictionary from a file, save the dictionary to a file, add new words and their definitions, look up the definition of a word, and delete a word from the dictionary.
Y... | codefeedback |
You are tasked with implementing a dropdown menu component for a web application. The dropdown menu should display a list of button elements, each representing a specific value. The dropdown menu should have the following functionality:
- When a button is clicked, it should trigger an event to handle the selected value... | codefeedback |
You are working on a project that involves managing different types of DNS records for various domain providers. The project uses a Python module that provides classes for handling MX records for different domain providers. The module contains the following classes:
1. `MXRecords`: A class for managing MX records for ... | codefeedback |
You are tasked with creating a script to validate and send an email using a shell script. The script should check if certain variables are empty and, if so, send an error email with specific details. The script should use the `SENDMAIL` command to send the email.
The script should perform the following checks:
- Check... | codefeedback |
You are tasked with implementing a parser for a custom language that supports string literals. The provided code snippet is a part of the parser's implementation. Your task is to complete the implementation of the `parse_string` method, which is responsible for parsing a string literal from the input.
The `parse_strin... | codefeedback |
You are tasked with creating a program to manage tasks using a mobile app. The app will utilize the MapKit framework to display task locations and the Realm database to store task information. You need to implement a function that calculates the distance between the user's current location and a given task location.
Y... | codefeedback |
You are tasked with implementing a simplified version of a stack data structure using a linked list. The stack should support the standard push, pop, and top operations. Additionally, you need to implement a function that returns the minimum element in the stack at any given time. You are given the following Node struc... | codefeedback |
You are tasked with creating a Python class that represents an inventory management system for a retail store. The class should be able to add items to the inventory, remove items from the inventory, and display the current inventory. Additionally, the class should have a method to calculate the total value of the inve... | codefeedback |
You are tasked with implementing a function that maps global coordinates to local coordinates in a parallel computing environment. The function takes in the lattice grid size in the x and y directions, as well as the number of processes in the x and y directions. It then returns the process coordinates along with the l... | codefeedback |
You are tasked with implementing a genetic algorithm to solve the traveling salesman problem (TSP). In this problem, you are given a set of cities and the distances between them. The goal is to find the shortest possible route that visits each city exactly once and returns to the original city. The fitness of a potenti... | codefeedback |
You are tasked with implementing a function that simulates a simple text-based game. The game involves a player navigating through a grid-based world, represented by a 2D array, and collecting treasures. The player's position is denoted by a pair of coordinates (x, y) within the grid. The grid contains various elements... | codefeedback |
You are tasked with implementing a generic codec system for encoding and decoding data. The provided code snippet shows the declaration of various codec instances and a constructor for a `SettingSelectProcProvider` class. Your task is to design and implement the generic codec system to support encoding and decoding of ... | codefeedback |
You are tasked with creating a Python class that simulates a simple banking system. The class should be able to handle basic banking operations such as account creation, deposit, withdrawal, and balance inquiry. Additionally, the class should be able to generate monthly bank statements for each account.
You are provid... | codefeedback |
You are tasked with creating a Python function that simulates a simple game of dice. The game involves rolling two dice and calculating the sum of their values. The function should take the number of rolls as input and return the frequency of each possible sum from 2 to 12.
The code snippet below shows the initial imp... | codefeedback |
You are tasked with creating a Python function that calculates the time it takes for the synodic new moon to return to the same nakshatra and the number of revolutions it completes during this period. The synodic month is the period between successive occurrences of the same phase (e.g., new moon to new moon). The new ... | codefeedback |
You are tasked with creating a Python program to automate the preprocessing of source code files for a machine learning model. The program needs to handle two scenarios: one for processing original source code files and another for analyzing mutant source code files. The preprocessing involves extracting features from ... | codefeedback |
You are tasked with creating a Python function that determines the relative position of a given point with respect to a set of other points on a 2D plane. The function should take in the coordinates of the reference point and a list of other points, and return a list indicating whether each point is to the left, right,... | codefeedback |
You are tasked with implementing a function that calculates the total number of occurrences of a given word in a list of strings. The function should be case-insensitive and should count partial matches as well. For example, if the word is "car" and the list contains "car", "cars", and "scar", the function should retur... | codefeedback |
You are tasked with implementing a Python module that manages the metadata for a software project. The module should maintain a list of allowed attributes and provide a mechanism for accessing and updating these attributes. Your task is to create a class that enforces the allowed attributes and their values.
You shoul... | codefeedback |
You are tasked with implementing a custom data structure to store and manage a collection of books in a library. The data structure should support operations for adding a new book, removing an existing book, and retrieving the total number of books in the library. Additionally, the data structure should allow for retri... | codefeedback |
You are working on a machine learning project and need to implement a scoring function using TensorFlow. The given code snippet is a part of the scoring function that combines confidence scores and class probabilities to calculate the final scores for different classes.
You are given the following information:
- `conf... | codefeedback |
You are working on a system monitoring tool that needs to extract specific information from a given command output. The tool needs to identify the process ID (PID) of a process named "Domino" and then change the current directory to a specific path if the process is found running.
You are given a code snippet that att... | codefeedback |
You are tasked with implementing a custom logging system for a software application. The application uses the Java programming language and the Apache Log4j library for logging. The provided code snippet initializes a logger instance using the `Logger.getLogger` method from the Log4j library.
Your task is to create a ... | codefeedback |
You are tasked with creating a program that simulates a simple card game called "War." In this game, two players are each dealt half of a standard deck of 52 playing cards. The players then reveal the top card from their respective decks, and the player with the higher card wins both cards, placing them at the bottom o... | codefeedback |
You are tasked with creating a Python package version checker. Your program should take a user-input version number and compare it to the latest version of the package. If the user's version is outdated, the program should inform the user and provide the option to update the package.
Create a Python function `check_pa... | codefeedback |
You are tasked with creating a class that can dynamically fill its properties based on an input array. Your task is to implement a method `fillObjectProperties` that takes an associative array and a `ReflectionClass` object as input and returns an instance of the class with its properties filled based on the input arra... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.