instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with creating a command-line tool that processes an Xcode asset catalog and generates a Swift file containing an enum representing the asset names. The tool should take the following command-line arguments:
- `-path <path_to_asset_catalog>`: The path to the Xcode asset catalog directory.
- `-exportPath <... | codefeedback |
You are tasked with creating a Python script to fetch and process court calendar data from the Vermont Judiciary website. The script should be able to write the fetched data to a Git repository if the corresponding environment variable is set to true. The script should also be able to handle cases where the environment... | codefeedback |
You are tasked with implementing a module resolution system for a JavaScript project. The system should be able to resolve and import modules based on the provided import statements. The import statements follow the ES6 module syntax, where modules are imported using the `import` keyword and exported using the `export`... | codefeedback |
You are given a list of intervals, where each interval is represented by a pair of integers [start, end]. The intervals may overlap, and you need to merge overlapping intervals to produce a list that contains only mutually exclusive intervals.
Write a function `mergeIntervals` that takes a vector of pairs of integers ... | codefeedback |
You are tasked with implementing a method to validate a chat room's configuration based on certain criteria. The chat room configuration is represented by a DataForm object, which contains various fields with their corresponding values. Your task is to write a method that checks if the chat room configuration satisfies... | codefeedback |
You are tasked with implementing a clustering algorithm to analyze an SMS spam dataset using SciPy. The dataset contains a collection of SMS messages labeled as spam or non-spam. Your goal is to use the SciPy library to perform clustering on the dataset and identify patterns that can distinguish between spam and non-sp... | codefeedback |
You are tasked with implementing a function to create and update statistics in an ordered dictionary. The function `create_stats_ordered_dict` takes in the statistic name, value, and optional parameters such as `stat_prefix` and `always_show_all_stats`. The statistics are then updated in an ordered dictionary called `s... | codefeedback |
You are tasked with creating a program that simulates a simple file loading system. The program should be able to load files and modules based on specific commands provided in a script file.
Your program should read a script file containing a series of commands, each of which can be one of the following types:
1. `Loa... | codefeedback |
You are tasked with implementing a Python class that provides a wrapper around a service catalog client and offers convenience methods for operations that would otherwise need to be chained together. Your task is to create a class `ServiceCatalogClientCompositeOperations` with the following requirements:
1. The class ... | codefeedback |
You are tasked with implementing a function that creates a new work item in a project management system. The function takes in a list of child work item IDs, an ID for the new work item, and a title for the new work item. The function should create the new work item with the given ID and title, and then associate it wi... | codefeedback |
You are tasked with implementing a rocket launch control system. The system is responsible for determining whether a rocket launch should proceed based on various criteria. One of the key components of the system is a function that evaluates the readiness of the rocket for launch. The function takes into account multip... | codefeedback |
You are tasked with implementing a serialization and deserialization mechanism for a custom form object. The form object represents a user input form with various fields such as text, checkboxes, and radio buttons. Your goal is to create a serialization method that converts the form object into a dictionary, and a dese... | codefeedback |
You are tasked with implementing a Python function that generates a module for a given namespace. The function should take a class name and a string representing the namespace as input and return a string representing the generated module.
The function should follow the following format:
```python
def gen_module_for_n... | codefeedback |
You are tasked with implementing a Python function that simulates a simple text-based game. The game involves navigating through a grid-based map, avoiding obstacles, and reaching the goal. To enhance the user experience, the game should utilize ANSI escape codes to display colorful text in the terminal.
You are provi... | codefeedback |
You are tasked with creating a Python class that utilizes SQLAlchemy and Pandemic to define a data model for a library management system. The system should have two entities: `Book` and `Author`. Each book can have multiple authors, and each author can have multiple books. The `Book` entity should have the following at... | codefeedback |
You are tasked with implementing a RESTful API for a simple todo list application using Python and Flask. The application has a database with two models: `TodoList` and `TodoItem`. The `TodoList` model represents a collection of todo items, and the `TodoItem` model represents individual todo items. The code snippet pro... | codefeedback |
You are tasked with creating a Rust function that calculates the total size of all files within a given directory using the Tokio asynchronous runtime. You will need to utilize the `tokio::fs::metadata` function to retrieve the metadata of each file and sum up their sizes.
Your task is to implement the `calculate_dire... | codefeedback |
You are tasked with implementing a Python class that calculates the BLEU (Bilingual Evaluation Understudy) score for a given input file containing reference and candidate sentences. The BLEU score is a metric used to evaluate the quality of machine-translated text by comparing it to one or more reference translations. ... | codefeedback |
You are tasked with creating a function that processes and organizes language locale messages for a Vue.js application. The function should load locale messages from JSON files in a specific directory and format them into a structured object.
Write a function `loadLocaleMessages` that takes no parameters and returns a... | codefeedback |
You are tasked with creating a Python package for a company's internal use. The package should implement a simple command-line tool for performing basic arithmetic operations. The tool should be able to add, subtract, multiply, and divide two numbers provided as command-line arguments.
Your task is to write the necess... | codefeedback |
You are tasked with implementing a class to manage a collection of items and track changes to the collection. The class should provide methods to add new items, update existing items, and retrieve the new and updated items.
You are given a code snippet that asserts the behavior of the class. The `step_result` object r... | codefeedback |
You are tasked with implementing a visitor pattern for processing expressions in a programming language. The provided code snippet outlines the signature of the visit methods that need to be implemented. The `SubExpression` type represents a sub-expression within a larger expression, and the `Step` type represents a st... | codefeedback |
You are tasked with implementing a program to tokenize sentences extracted from a PDF document. The program should make an API call to retrieve all the paragraphs from the PDF and then tokenize the sentences from each paragraph. The tokenized sentences should be written to an output file.
Your task is to write a Pytho... | codefeedback |
You are tasked with implementing a Python class that manages dependencies for a project. The class should utilize caching to improve performance when accessing certain properties.
You are provided with a partial code snippet for the class, which includes a method and two cached properties. The `Pip` class is used to m... | codefeedback |
You are tasked with implementing a Python class that can execute SQL statements. The class should support executing SELECT, INSERT, UPDATE, and DELETE SQL statements on a given database.
Your task is to complete the implementation of the `ExecuteSQL` class by adding methods for executing different types of SQL stateme... | codefeedback |
You are tasked with creating a Python script that processes command-line arguments to generate statistics from the differences between two XML files. The script should take in the following command-line arguments:
- `-d`: A flag indicating that detailed statistics should be generated.
- `prog0:p0:<file_path_0>`: A key-... | codefeedback |
You are tasked with creating a Python function that processes and inserts person data into a database. The function should handle potential exceptions and print error messages when necessary. The function will receive several parameters representing person and travel information, and it should insert this data into a d... | codefeedback |
You are given a list of strings, each representing a pair of coordinates in the format "x1,y1 -> x2,y2". Your task is to calculate the Euclidean distance between each pair of coordinates and return the distances as a list of floating-point numbers rounded to two decimal places.
Write a function `calculate_distances(li... | codefeedback |
You are tasked with creating a Python function that processes a list of student records and returns a filtered list based on specific criteria. Each student record is represented as a dictionary with the following keys: "name", "age", "grade", and "school".
Your task is to implement the function `filter_students` that... | codefeedback |
You are tasked with implementing a custom adapter class in Android for displaying ticket information in a list view. The provided code snippet is the beginning of the `TicketAdapterEx` class, which extends `BaseAdapter` and is intended to work with a `TicketInfo` class. Your task is to complete the implementation of th... | codefeedback |
You are tasked with implementing a function that handles the deletion of items based on their archetype reference IDs. The function takes an array of archetype reference IDs as an argument and should remove the corresponding items from the system. However, there is a catch - if an archetype reference ID does not exist ... | codefeedback |
You are tasked with implementing a method to add resource dictionaries to a collection in a C# WPF application. Resource dictionaries are used to define and manage resources such as styles, templates, and other resources that can be shared and reused throughout the application.
You need to create a method `AddResource... | codefeedback |
You are tasked with creating a dynamic dropdown menu for a web form that allows users to select a category for a quotation. The code snippet provided is a part of the HTML and PHP code for generating the dropdown menu. The PHP code is used to dynamically select the option that matches the category stored in the `$resul... | codefeedback |
You are given a string `S` and a character `C`. Your task is to write a function to return an array of integers representing the shortest distance from the character `C` in the string `S`.
The distance between two indices `i` and `j` is calculated as `abs(i - j)`.
You need to implement the following function:
```pyt... | codefeedback |
You are tasked with implementing a Python function that recursively merges the contents of a source directory into a destination directory. The provided code snippet offers a starting point for the implementation. Your task is to complete the function `merge(src, dst)` so that it correctly merges the contents of the so... | codefeedback |
You are tasked with creating a Bash script that securely transfers a file to a remote server using SFTP (Secure File Transfer Protocol). The script will take in several parameters and perform the file transfer using the provided credentials and software information.
The script should accept the following parameters in... | codefeedback |
You are tasked with implementing a class that simulates a proportional-integral-derivative (PID) controller for a system. The PID controller is a control loop feedback mechanism widely used in industrial control systems. It continuously calculates an error value as the difference between a desired setpoint (SP) and a m... | codefeedback |
You are tasked with implementing a function to calculate the derivative of the arctan2 function for complex numbers. The arctan2 function returns the angle in radians between the positive x-axis of a plane and the point given by the coordinates (x, y). The derivative of the arctan2 function with respect to the input co... | codefeedback |
You are given a code snippet that appears to be part of a larger algorithm. Your task is to understand the code and implement a function that performs the same computation as the given code.
The code snippet is as follows:
```python
is quite costly though.
"""
stype = type(a)
e = (stype.bit_length - 1... | codefeedback |
You are tasked with creating a React component for a technology level selector. The component should display a set of technology level images, allowing the user to select a specific level. The selected level should be highlighted, and clicking on an image should update the current selection.
The code snippet provided ... | codefeedback |
You are tasked with implementing a Python class that handles HTTP requests using the `pycurl` library. Your class should have methods for performing HTTP requests, building request bodies, and extracting response headers and body.
Your task is to complete the implementation of the `HttpClient` class by adding the miss... | codefeedback |
You are tasked with creating a validation system for a project worker information management application. The application uses a PHP-based framework and the provided code snippet is a part of the validation process for adding project worker information. The `validate` function is used to create a validation instance, a... | codefeedback |
You are tasked with implementing a simple task scheduler using Rust's `ispc` module. The task scheduler will be responsible for executing a set of tasks in parallel. Each task is represented by a function that takes no arguments and returns no value. Your goal is to implement the `TaskScheduler` struct with the followi... | codefeedback |
You are tasked with implementing a function that processes the output of a Unity process and returns a specific result based on the process's exit status. The function takes in a Unity process and an aggregator for the standard output as input. The Unity process emits a 'close' event, and based on the exit status of th... | codefeedback |
You are tasked with implementing a simplified version of a keyboard input handling system. The provided code snippet is a part of a larger system and contains a function `IsKeyDown` that takes a `GT::Script` object as a parameter. The `IsKeyDown` function is responsible for checking if a specific key is currently press... | codefeedback |
You are tasked with creating a program that analyzes the frequency of words in a given text. Your program should take a string of text as input and output a list of unique words along with their frequencies in descending order.
For example, given the input string:
```
"Hello world, this is a beautiful world."
```
The ... | codefeedback |
You are tasked with implementing a function that processes a given JavaScript code snippet and extracts specific information from it. The code snippet will contain a class definition and an export statement. Your task is to extract the name of the class and the type of export (default or named).
Write a function `extr... | codefeedback |
You are tasked with creating a Bash script to automate the setup of a node for a blockchain network. The script should prompt the user for certain configurations and set corresponding variables based on the user input. Your task is to complete the script by adding the necessary code to handle user input and set the var... | codefeedback |
You are tasked with creating a signal handling mechanism for a multi-platform application. The application needs to handle cleanup operations when receiving termination signals on both Unix-like and Windows systems. The provided code snippet is a part of the signal handling functionality for Unix-like systems. Your tas... | codefeedback |
You are tasked with creating a Python class that monitors changes in a directory's files and sends notifications for added, removed, or modified files. Your class should have the following functionalities:
1. Initialize with a target directory and an identifier name.
2. Continuously monitor the target directory for fi... | codefeedback |
You are tasked with implementing a Python class for a 3D Cartesian coordinate system with elastoplastic material properties. The provided code snippet imports a module `_GMatElastoPlasticQPot3d` and its `Cartesian3d` class, which is used to define the 3D Cartesian coordinate system with elastoplastic material propertie... | codefeedback |
You are tasked with creating a program to generate a word cloud from a given text file. A word cloud is a visual representation of the frequency of words in a given text, where the size of each word indicates its frequency. The program should read the text from a file, process it, and generate a word cloud image using ... | codefeedback |
You are working on a project that involves interfacing with a Java Virtual Machine (JVM) from Rust code. The Rust code needs to interact with various types of Java objects and arrays. To facilitate this interaction, you have been provided with a set of Rust traits and structs that represent different Java types. Your t... | codefeedback |
You are tasked with creating a custom collection view in an iOS app. The collection view should display a list of pinned items, and each item should have a specific layout and behavior. Your task is to implement the necessary code to achieve this functionality.
You are provided with a code snippet that initializes and... | codefeedback |
You are tasked with creating a custom hook for managing the selected channel in a messaging application. The provided code snippet is a starting point for the custom hook using the Zustand library, which is a small, fast, and scaleable state management library. Your goal is to complete the custom hook by adding the nec... | codefeedback |
You are tasked with creating a Python program that utilizes TensorFlow Lite to perform image classification on a given set of images. TensorFlow Lite is a lightweight machine learning framework designed for mobile and embedded devices. In this problem, you will need to load a pre-trained model using TensorFlow Lite and... | codefeedback |
You are tasked with implementing a function to clone a data structure that contains import and type declarations. The given code snippet provides a partial implementation of the cloning process for import and type declarations. Your task is to complete the implementation of the cloning function based on the provided co... | codefeedback |
You are tasked with creating a unit test for a report updating functionality in a software system. The code snippet provided is a part of the unit test setup using the Moq framework for mocking dependencies. Your task is to complete the unit test setup and verify the behavior of the report updating functionality.
The ... | codefeedback |
You are tasked with implementing a Python function that processes a list of strings and returns the count of unique strings that contain a specific substring. The function should ignore case sensitivity when comparing the strings and the substring. If a string contains the substring multiple times, it should only be co... | codefeedback |
You are tasked with implementing a subscription management system for a website. The provided code snippet is a part of a React component that handles the subscription button functionality. The button is initially enabled, and when clicked, it triggers a subscription status update through an API call. Upon successful s... | codefeedback |
You are tasked with creating a Swift function that processes a given array of tuples representing software products and their corresponding supported operating systems. The function should filter the products based on the specified minimum macOS version and return the names of the products that support the given versio... | codefeedback |
You are tasked with implementing a function that processes embeddings using layer normalization, dropout, and masking. The function takes as input a 3D tensor representing embeddings, the length of the input sequence, and the stride value. The function performs the following operations:
1. Apply layer normalization to ... | codefeedback |
You are tasked with creating a custom viewset in a Django REST framework application. Your custom viewset should handle both read and write operations for a specific model. The model represents a library of books, and you need to implement the necessary viewset to perform CRUD (Create, Read, Update, Delete) operations ... | codefeedback |
You are tasked with creating a program that can parse and extract the date and time information from a given code snippet. The code snippet is written in Java and contains a comment with a date and time stamp in the Chinese language. Your program should be able to extract this information and convert it into a standard... | codefeedback |
You are working on a data processing pipeline for a geospatial analysis application. The pipeline involves merging a Dask DataFrame with another DataFrame derived from a Dask array. The code snippet provided is a part of a method in the pipeline that performs this merging process. The `meta.M` is a matrix, and `xyz_arr... | codefeedback |
You are tasked with implementing a progress tracking system for a software application. The system should include a class `ProgressWindowController` that manages a window displaying the progress of a task. The window should have the ability to update and display the progress in real-time.
Your task is to design and im... | codefeedback |
You are tasked with implementing a Python class for managing a dataset. The class should have the ability to calculate the number of batches required to process the dataset, handle any remaining data that does not fit into a complete batch, and provide a method to reset the dataset to its initial state.
Your task is t... | codefeedback |
You are tasked with implementing a complex number class in C++ to perform arithmetic operations on complex numbers. The complex number class should support addition, subtraction, multiplication, and division operations, as well as the ability to raise a complex number to a power.
Your task is to implement the missing ... | codefeedback |
You are tasked with implementing a token revocation system for a web application that uses JSON Web Tokens (JWT) for authentication. Your goal is to create a function that handles revoked tokens and returns a specific response when a revoked token is encountered.
You are provided with a code snippet that includes a re... | codefeedback |
You are tasked with creating a Python function that calculates the angle between two lines and plots the angle on a graph. The function `get_angle_plot` takes in two lines, a radius, color, origin, and the lengths of the x and y axes. It then calculates the angle between `line1` and the x-axis and plots the angle on a ... | codefeedback |
You are given a snippet of code that appears to be incomplete. Your task is to complete the code by implementing a function that checks whether a given string is a palindrome. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, ignoring spaces, punctuation, ... | codefeedback |
You are tasked with implementing a simplified version of a migration script for a database schema. The script is responsible for applying a series of operations to modify the structure of a database table. Each operation is represented as a migration step, and the script must execute these steps in the correct order to... | codefeedback |
You are tasked with implementing a function that compresses a given list of values into a string representation based on the number of consecutive repetitions of each value. For example, given the input list [1, 1, 2, 3, 3, 3, 4], the function should return the compressed string "1x2, 2, 3x3, 4", where "1x2" indicates ... | codefeedback |
You are tasked with implementing a function to calculate the factorial of a given number. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example, the factorial of 5 (denoted as 5!) is calculated as 5 x 4 x 3 x 2 x 1 = 120.
Write a Python function `factori... | codefeedback |
You are tasked with implementing a Python class that utilizes the ELMo (Embeddings from Language Models) library to process text data and extract contextual word embeddings. ELMo is a deep contextualized word representation model that takes into account the context of each word in a sentence. Your task is to create a c... | codefeedback |
You are tasked with implementing a network packet fragmentation algorithm. In networking, when a packet exceeds the Maximum Transmission Unit (MTU) of a network, it needs to be fragmented into smaller packets that fit within the MTU. The given code snippet defines the MTU value as 1600 bytes.
Your task is to write a f... | codefeedback |
You are tasked with creating a Python class to manage network configurations. Your class should have methods to add, remove, and display network configurations. Each configuration should consist of a setting and a value, such as "speed auto" or "duplex auto". Additionally, the class should have a method to generate a c... | codefeedback |
You are tasked with implementing a function to calculate the sum of all the even Fibonacci numbers up to a given limit. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1. The first few numbers in this sequence are 0, 1, 1, 2, 3, 5, 8, ... | codefeedback |
You are working on a data analysis project and need to create a program to model the joint probability density function of two random variables, X and Y. The given code snippet is part of a larger program and includes the calculation of marginal probabilities and fitting of normal distribution curves for X and Y.
Your... | codefeedback |
You are tasked with implementing a function to summarize numerical variables in a given dataframe. The function should calculate various statistical measures for each numerical variable in the dataframe and return a summary table.
You are given the following code snippet as a starting point:
```python
def summarize(v... | codefeedback |
You are given a 2D grid represented as a list of binary numbers. Each binary number represents a row in the grid, and each bit in the binary number represents a cell in the row. A '1' bit represents an obstacle, and a '0' bit represents an empty space. Your task is to write a function that determines the number of conn... | codefeedback |
You are tasked with implementing a PHP interface for a recovered entities functionality of a database repository. The interface, named `RecoverableRepository`, contains a single method `recover` that takes a `DomainEntity` as a parameter.
Your task is to create a PHP class that implements the `RecoverableRepository` i... | codefeedback |
You are tasked with implementing a class that simulates a bagging system for a retail store. The bagging system should keep track of the items being added to the bag and provide functionality to dump the bag's contents. Additionally, the system should maintain a flag to indicate whether an item has been added to the ba... | codefeedback |
You are tasked with creating a command-line build tool that simulates the behavior of the given Gradle command. Your tool should support cleaning the project, building the project, skipping tests, and publishing artifacts to a local Maven repository.
Your command-line tool should accept the following options:
- `clean... | codefeedback |
You are given a code snippet from a shell script that includes comments describing the expected output and some diagnostic checks. Your task is to write a program that processes the output of the given shell script and performs the diagnostic checks mentioned in the comments.
Write a program that reads the output of t... | codefeedback |
You are tasked with implementing a simplified version of a composite component system in a hypothetical UI framework. The framework provides a `Component` protocol and a `CompositeComponent` class, which can contain other components. Your goal is to create a function that generates a composite component based on a give... | codefeedback |
You are tasked with implementing a Python class for a financial modeling application. The class is responsible for processing financial data and generating forward returns. Your task is to complete the implementation of the `generate_forward_return` method in the given class. The method takes in the `scaler`, `sigma`, ... | codefeedback |
You are tasked with implementing a SQL query parser that can handle a specific set of SQL queries. The SQL queries are represented as strings, and your parser should be able to parse these strings into a structured query representation and then convert the structured representation back into the original string form. Y... | codefeedback |
You are tasked with implementing a custom error handling mechanism for the `spawn` function in an asynchronous Rust framework. The `spawn` function is used to execute a given asynchronous task, represented by a `Future`, within the context of an Actix system. However, the current implementation lacks proper error handl... | codefeedback |
You are tasked with creating a script to automate the installation and setup of the JAGS (Just Another Gibbs Sampler) software on a Linux system. JAGS is a program for analysis of Bayesian hierarchical models using Markov Chain Monte Carlo (MCMC) simulation. The installation process involves downloading the JAGS source... | codefeedback |
You are tasked with implementing a depth-first search algorithm to traverse a tree-like data structure. The data structure is represented as a collection of objects, each containing a set of fields and their corresponding values. The goal is to visit each object in the data structure and perform a specific operation on... | codefeedback |
You are tasked with creating a script that starts the Visor console for Apache Ignite, a distributed database, caching, and processing platform. The script should be able to handle different operating systems and set various Java Virtual Machine (JVM) options.
Write a shell script that starts the Visor console based o... | codefeedback |
You are tasked with implementing a stack data structure using a linked list. The stack should support the standard push and pop operations, along with a method to retrieve the minimum element in constant time. You need to design the stack to have O(1) time complexity for all operations.
You are given the following Nod... | codefeedback |
You are working on a simulation program for a residential area (RA) management system. The program simulates the behavior of resident assistants (RAs) in response to neighbor warnings and their assignment of chores. Each RA has a set of predefined tasks to perform when neighbor warnings are issued and when chores need ... | codefeedback |
You are tasked with implementing a function to read YAML-based configuration files from a specified folder and its subfolders. The function should return a dictionary containing all the found configuration objects.
You are given the following function signature:
```python
def read_yaml_configs(config_folder: str, con... | codefeedback |
You are tasked with implementing a binary tree data structure in Python. The binary tree should support the following operations: creating a new binary tree, inserting a new node, and traversing the tree in different orders.
Your task is to implement the `BinaryTree` class with the following methods:
1. `__init__(self... | codefeedback |
You are tasked with implementing a Python function that simulates a simple game. The game involves a player navigating through a grid-based world, represented by a 2D list of characters. The player starts at a given position and can move up, down, left, or right within the grid. The goal is to reach a specific target c... | codefeedback |
You are tasked with implementing a load balancing algorithm for a server pool. The algorithm should select servers from the pool in a round-robin fashion, ensuring that each server is utilized equally. You are given a code snippet that initializes a list of servers and selects a server using a random index. Your task i... | codefeedback |
You are tasked with implementing a SIMD (Single Instruction, Multiple Data) operation in a Rust program. SIMD operations allow for parallel processing of data using special CPU instructions, which can significantly improve performance for certain types of computations.
Your task is to write a function that performs a ... | codefeedback |
You are tasked with implementing a function that extracts the URLs from a given HTML snippet. The function should take the HTML snippet as input and return a list of unique URLs found within the snippet. A URL is defined as a string that starts with "http://" or "https://" and ends with a non-whitespace character or a ... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.