instruction_seed
stringlengths
0
26.4k
source
stringclasses
4 values
You are tasked with creating a script to extract system information from different Unix-like operating systems. The script should handle variations in command options and output formats across different systems. Your task is to implement a function that takes the kernel name as input and returns the appropriate command...
codefeedback
You are tasked with implementing a function to process a series of images and generate a mesh representation. The function should take a list of image objects as input and return the mesh representation of the combined images. You are given the following code snippet as a starting point: ```python imgs_pil.append(im)...
codefeedback
You are tasked with implementing a function that processes a given input and returns a specific output based on the input type. The function should follow the rules outlined below: - If the input is an integer, the function should return the input multiplied by 2. - If the input is a string, the function should return...
codefeedback
You are tasked with implementing a custom SQL function in Rust for calculating the square root of a floating-point number. The function should return the square root if the input is non-negative, and an error if the input is negative. The provided code snippet serves as a starting point for the implementation. Your ta...
codefeedback
You are tasked with implementing a Python class that processes a set of genes associated with a specific disease. The class, `DiseaseAssociatedGeneSet`, should be designed to store and process gene information related to a given disease. Additionally, you need to implement a method to validate whether a set of gene IDs...
codefeedback
You are tasked with implementing a simple routing system for a mobile application using Swift. The routing system should allow navigation between different view controllers based on a route identifier. You are provided with a partial implementation of the `HomeRouter` class, which conforms to a protocol named `Router`....
codefeedback
You are tasked with implementing a function that resizes an input image to a specified dimension using a specific interpolation method. The function should take the original image and the target dimensions as input and return the resized image. You are given the following code snippet as a starting point: ```python fr...
codefeedback
You are working on a network server application that requires secure communication using SSL/TLS. The given code snippet is a part of a Python class that manages SSL/TLS certificates and permissions for user access. The `ssl_file` method constructs the file path for SSL certificates, and the `allow` method grants permi...
codefeedback
You are tasked with creating a Python function that reads a type mapping file and constructs a nested dictionary representing the mapping relationships between source and target attributes. The type mapping file is a CSV file containing information about the mapping between source and target attributes, along with addi...
codefeedback
You are tasked with creating a command-line utility that simulates a simple version control system. Your program should support two main operations: `push` and `log`. The `push` operation takes three arguments: 1. The path to the directory to be pushed. 2. The message associated with the push. 3. The current timestamp...
codefeedback
You are tasked with implementing a data structure to manage movie ticket sales at a box office. The box office system should support operations for adding new movies, selling tickets, and retrieving sales statistics. You need to design a class `DataBoxOffice` that encapsulates the functionality of the box office system...
codefeedback
You are tasked with implementing a function that generates a raw message based on a given input. The raw message is expected to follow a specific format and encoding rules. The input will consist of a string representing a series of data points, and the output should be a raw message adhering to the specified format. ...
codefeedback
You are tasked with creating a neural network model to classify handwritten digits from the MNIST dataset using TensorFlow and Keras. The MNIST dataset consists of 28x28 grayscale images of handwritten digits (0-9). Your goal is to build, train, and evaluate a neural network model to achieve high accuracy in classifyin...
codefeedback
You are working on a project that involves implementing the K-Means clustering algorithm in Java. As part of the project, you need to compile the KMeans.java file, create a JAR file, and organize the compiled classes into a directory structure. The provided code snippet demonstrates the commands to achieve this. Your ...
codefeedback
You are tasked with implementing a simple web service client in Swift. Your task is to create a class that interacts with a web service to fetch data and present it to a view. You will need to implement a presenter class that conforms to a specific protocol and interacts with a view controller and a router. The present...
codefeedback
You are tasked with implementing a simplified version of a symbolic expression (S-expression) parser in C++. An S-expression is a nested list data structure commonly used in Lisp programming languages. Each S-expression can be either an atom or a list. An atom is a single data element, such as a number or a symbol. A l...
codefeedback
You are tasked with implementing a function that takes in a string and returns a new string with the characters reversed. However, there is a twist - you are not allowed to use any built-in string reversal functions or methods. You must implement the reversal algorithm manually. Write a function `reverseString` that t...
codefeedback
You are tasked with creating a custom decorator in TypeScript for Angular applications. Decorators are a design pattern that is used to separate modification or decoration of a class without modifying the original source code. In Angular, decorators are extensively used for various purposes such as component, directive...
codefeedback
You are tasked with implementing a Java class that represents a simple database schema for storing information about archived class type information. The provided code snippet is a partial implementation of the `ArchivedClassTypeInfoSchema` class, which extends the `AbstractSchema` class and is used to define the schem...
codefeedback
You are tasked with implementing a simplified version of a write operation for a custom networking library. The provided code snippet outlines a part of the library's API for sending data over a network connection. Your task is to create a function that simulates the behavior of the `Write` struct's `send` method. You...
codefeedback
You are tasked with creating a language translation service using Python. Your goal is to implement a class that can interact with a translation API to retrieve available translation models and to translate text from one language to another. The API provides two methods: `get_available_models` and `translate`. The `ge...
codefeedback
You are tasked with creating a Python program to simulate a simple rock-paper-scissors game. The game should allow a user to play against the computer, which will randomly select its move. The game should display the user's choice, the computer's choice, and the outcome of the round. The program should also keep track ...
codefeedback
You are tasked with implementing a simplified version of an ActiveRecord pattern for managing course information. The `Course` class should be able to store and retrieve information about various courses. The class should support basic CRUD (Create, Read, Update, Delete) operations for course objects. Your task is to ...
codefeedback
You are tasked with creating a Python function that securely retrieves an authentication token from a file or generates a new one if the file does not exist. The function should handle file operations and token generation securely and efficiently. Your task is to implement the `get_auth_token` function, which takes no...
codefeedback
You are tasked with creating a script to automate versioning and packaging of a Python project using Poetry. The script should take a single argument, which can be "major", "minor", or "patch", indicating the type of version bump to perform. The script should perform the following steps: 1. Check if the provided argume...
codefeedback
You are tasked with implementing a dynamic programming algorithm to solve a specific optimization problem. The problem involves finding the maximum value of a function given certain constraints. The function is represented by a two-dimensional array `DP`, and the constraints involve setting specific values at certain i...
codefeedback
You are tasked with implementing a change detector class that monitors a series of values and determines if the values are within a warning zone. The change detector class has a method to retrieve the warning zone status and another method to predict the next value in the series. You are given the following code snipp...
codefeedback
You are tasked with creating a RESTful API for managing a collection of programming languages. The API should support the following operations: retrieving all languages, retrieving a specific language, adding a new language, updating an existing language, and deleting a language. You are given a partial implementation...
codefeedback
You are tasked with creating a web application that displays a table of suppliers using DataTables, a popular jQuery plugin for enhancing HTML tables. The provided code snippet is a part of the JavaScript code for this application. The DataTable is configured to retrieve data from a server-side endpoint using AJAX and ...
codefeedback
You are tasked with implementing a simplified version of a call stack mechanism in a programming language. The call stack is a fundamental concept in computer science and is used to manage function calls and their associated data. In this problem, you will need to create a data structure to represent the call stack and...
codefeedback
You are tasked with creating a PHP class that simulates a simple banking system. The class should have methods to deposit funds, withdraw funds, and check the current balance. Additionally, the class should keep track of the account holder's name and account number. Implement the class with the following requirements: ...
codefeedback
You are tasked with creating a program that analyzes a given text file to count the occurrences of specific words. The program should read the text file, count the occurrences of each word, and then display the word count for a specified set of words. Your task is to implement a function `wordCountAnalyzer` that takes...
codefeedback
You are tasked with implementing a program to generate a grid-based image with specific properties. The program should create a grid of cells, each of which can be colored black or white. The grid should have a minimum area size of 30x30 cells. Additionally, the program should have the capability to rotate semicircles ...
codefeedback
You are tasked with creating a Python function that simulates the behavior of a simplified version of the `urllib3-mock` library. The `urllib3-mock` library is used for mocking out the `urllib3` Python library, and it is an adaptation of the `responses` library. Your task is to implement a function that can handle HTTP...
codefeedback
You are tasked with implementing a Python class that facilitates file transfer between two endpoints using the Globus Transfer service. The class should handle the transfer of a specified file from a source endpoint to a destination endpoint, ensuring data integrity through checksum verification and synchronization. Yo...
codefeedback
You are tasked with implementing a distributed system for processing and storing sensor data. The system consists of a master node and multiple slave nodes. The master node is responsible for receiving sensor data, processing it, and storing the results in a Redis database. Each slave node is responsible for processing...
codefeedback
You are tasked with creating a program to analyze log entries from a web server. Each log entry contains a timestamp, log level, and a message. Your program needs to parse the log entries and extract specific information from them. You are given a sample log entry in the following format: ``` DEBUG - 2020-08-15 13:45:...
codefeedback
You are tasked with implementing a custom extension for the `Zip2Sequence` type in Swift. The `Zip2Sequence` type represents a sequence of pairs built out of two underlying sequences. Your goal is to create an extension method that takes a closure as a parameter and applies this closure to each pair of elements in the ...
codefeedback
You are given a Python code snippet that takes an integer input `a` and performs a series of operations to calculate the value of `n1`, `n2`, and `n3` based on the input. The code then prints the sum of these calculated values. Your task is to understand the operations performed in the code and write a function to achi...
codefeedback
You are tasked with creating a Python Flask application for managing categories. The application has a route for deleting a category, which requires the user to be logged in. The code snippet provided is a part of the Flask application and handles the deletion of a category based on the given ID. Your task is to implem...
codefeedback
You are tasked with implementing a type-checking algorithm for a custom grammar representation in Rust. The grammar is represented using the `FGrammar` type, and the type-checking function `typecheck` takes an `FGrammar` as input and returns a `TGrammar` as output. The code snippet provided gives a glimpse of the type-...
codefeedback
You are tasked with creating a Python program to automate the downloading and zipping of manga chapters. Your program should be able to download images from a given URL, organize them into chapters, and optionally zip the chapters into a single file. You are provided with a code snippet that performs some of these task...
codefeedback
You are tasked with creating a Discord bot command that generates a random "Fumo" character, represented by the emoticon ᗜˬᗜ. The bot should be able to select a random Fumo character from a predefined list and display it in the chat. Additionally, the bot should display information about the author and version of the "...
codefeedback
You are tasked with creating a Swift class that manages the presentation and dismissal of a debug view controller. The debug view controller should be presented modally and dismissed when a specific action is triggered. Additionally, you need to handle a type alias that has been marked as unavailable and renamed. Your...
codefeedback
You are working on a project to optimize the hyperparameters of a neural network for a machine learning task. The code snippet provided is a function call to train a neural network with the best hyperparameters obtained from a hyperparameter tuning process. Your task is to implement a function that performs hyperparame...
codefeedback
You are tasked with creating a script to monitor the CPU usage on a Linux system. The script should calculate the CPU usage percentage and display it along with a CPU icon. Your task is to implement a function `cpuicon` that returns the CPU icon and a function `cpu` that calculates and displays the CPU usage percentag...
codefeedback
You are tasked with implementing a script that updates the version numbers of various tools based on the latest available versions from their respective Git repositories. The script uses a custom function `latest_version` to fetch the latest version from the Git repositories and then updates the version numbers in the ...
codefeedback
You are tasked with implementing a function to train a recurrent neural network (RNN) model using the Keras library for time series forecasting. The provided code snippet includes a function `compile_model` that sets up the architecture of the RNN model. Your task is to complete the implementation of the `compile_model...
codefeedback
You are tasked with implementing a Python class for managing ad networks in a mobile app. The class should be able to decode and store information from various ad networks. You are provided with a code snippet that includes the beginning of the `AdNetwork` class and a method `_decode` for handling the decoding of ad ne...
codefeedback
You are tasked with creating a simple web application using Flask, a popular Python web framework. Your goal is to implement a basic RESTful API for a library management system. The application should allow users to perform CRUD (Create, Read, Update, Delete) operations on books in the library. You are provided with a...
codefeedback
You are tasked with creating a Python program to manage a simple menu system for a text-based application. The program should allow users to navigate through different menu options and perform actions based on their selections. Your task is to implement a Python class called `MenuSystem` that provides the functionalit...
codefeedback
You are tasked with implementing a custom runtime decorator that measures the execution time of functions in Python. Your goal is to create a decorator `@meter.runtime(REPORT_NAME)` that can be applied to any function to measure its execution time and report the results using the provided `REPORT_NAME`. Additionally, y...
codefeedback
You are tasked with implementing a movie search feature in a movie database application. The application uses a testing framework and a networking component for fetching movie data. The provided code snippet includes a test case and a test assembler for the movie search feature. Your task is to create a function that ...
codefeedback
You are tasked with implementing a function `sum_between` that takes a list of two integers as input and returns the sum of all integers between the two input integers, inclusive. If the input list does not contain exactly two integers, the function should raise a TypeError. For example, given the input [3, 7], the fun...
codefeedback
You are tasked with creating a function that processes a list of image filenames and performs specific operations based on the filenames. The function should handle cases where the input filename is an empty string. Write a function `processImageList` that takes a list of image filenames as input and performs the fol...
codefeedback
You are given an array of integers `nums`. Your task is to write a function that removes all duplicate occurrences of elements in the array, such that each element appears only once, and returns the modified array. The function should not allocate extra space for another array, but instead modify the input array in pla...
codefeedback
You are tasked with creating a Python function that simulates a simple text-based game. The game involves a player navigating through a grid-based world, collecting treasures, and avoiding obstacles. The grid is represented as a 2D list, where each cell can contain one of the following characters: - '.' representing an...
codefeedback
You are tasked with implementing a pitch-shifting audio effect in a music player application. The application has an `audioPlayer` object with a `play()` method to start playing audio. You need to implement the `changePitchEffect(_:)` method, which takes a `pitch` value as a parameter and adjusts the pitch of the audio...
codefeedback
You are tasked with creating a script to automate the process of copying RPM packages from a development YUM repository to a production YUM repository. The script should take into account the package name, version, release, and provide an option to test the operation before actually performing the copy. Your script sh...
codefeedback
You are tasked with implementing a class in TypeScript for creating and manipulating VRF (Verifiable Random Function) key link transactions. The provided code snippet outlines the interface for the `EmbeddedVrfKeyLinkTransactionBuilder` class, which is used to construct VRF key link transactions. Your task is to create...
codefeedback
You are tasked with implementing a simple ping-pong messaging system using Rust's asynchronous programming features. The system consists of two components: a sender and a receiver. The sender periodically sends a "ping" message to the receiver, and the receiver responds with a "pong" message. The sender and receiver co...
codefeedback
You are given a code snippet that sets up a 2D grid and computes a discretized probability distribution over this grid. Your task is to write a function that takes this discretized distribution and calculates the probability of a given event occurring within a specified region of the grid. You are provided with the fo...
codefeedback
You are tasked with creating a script to manage language datasets. The script should handle the creation of a specified data directory and then navigate into it. Your task is to write a Bash script that accomplishes this, taking into account error handling and verbose output. Your script should perform the following s...
codefeedback
You are tasked with implementing a custom method in the `Order` model class of a Laravel application. The `Order` model represents orders placed by customers in an e-commerce platform. The method should calculate the total price of an order, taking into account the quantity and unit price of each item in the order. Th...
codefeedback
You are tasked with creating a script to automate the process of updating microcode on a Linux system. Microcode updates are essential for resolving firmware bugs and improving system stability. Your script should check for the presence of a specific error message related to microcode in the bootup screen or dmesg logs...
codefeedback
You are tasked with creating a Python class to manage the training and saving of machine learning models. Your class should include methods for starting the training process, fitting the model, and saving the final trained model. Additionally, the class should have the ability to display the training progress and handl...
codefeedback
You are tasked with implementing a custom data structure that supports efficient insertion, deletion, and retrieval of key-value pairs. The data structure should have a fixed size and use a specific collision resolution strategy. Your task is to implement a hash table with linear probing as the collision resolution s...
codefeedback
You are tasked with implementing a Python unit test for a translation function using the `unittest` framework. The translation function, `trans_ch_eng`, takes a Chinese word as input and returns its English translation. Your goal is to write a test case that verifies the correctness of the translation function. Your t...
codefeedback
You are tasked with implementing a file management system for a version control software. The system should handle the creation and management of temporary files, as well as the generation of filenames for specific purposes. You are provided with a Python class snippet that partially implements the file management sys...
codefeedback
You are tasked with implementing a function to create an EGL context for an X11 window in a C++ program. The function should take in context parameters, a window handle, and a shared context, and return a boolean indicating whether the creation was successful or not. The function signature is as follows: ```cpp bool E...
codefeedback
You are tasked with implementing a multithreaded application for performing BLAST (Basic Local Alignment Search Tool) sequence alignment. The provided code snippet imports a `BlastThread` class from a module named `blast`. The `BlastThread` class is responsible for executing BLAST sequence alignment in a separate threa...
codefeedback
You are tasked with creating a web application that displays a breadcrumb navigation bar based on the given HTML code snippet. The breadcrumb navigation bar should dynamically display the path to the current page based on the URL and the structure of the website. Your task is to implement a function or method that tak...
codefeedback
You are given a list of elements, some of which may be nested lists. Your task is to write a Python function that counts the total number of elements in the list, including the elements within nested lists. You should implement a recursive approach to solve this problem. Write a function `count_total_elements` that ta...
codefeedback
You are tasked with creating a simple program to simulate a button-clicking game. The game will consist of a series of buttons, each with a specific point value. When a button is clicked, the player earns the designated points for that button. The goal is to accumulate the highest total score by strategically clicking ...
codefeedback
You are tasked with creating a Python function that simulates an authentication process for a web application. The function should take in a JSON payload representing user credentials and return a response indicating the success or failure of the authentication attempt. You are provided with a code snippet that tests t...
codefeedback
You are given a list of full file paths, where each path consists of directories and a file name separated by a forward slash '/'. Your task is to write a function that returns the longest common directory path shared by all the file paths. If there is no common directory path, the function should return an empty strin...
codefeedback
You are tasked with implementing a data extraction utility for a custom data format. The utility needs to extract specific values from a given data object and handle certain edge cases. You are given a class `DataExtractor` with the following properties and methods: - `ObjectId` (string): Represents the ID of the data...
codefeedback
You are working on a project that involves fetching and integrating external libraries. As part of this process, you need to automate the fetching of these libraries from their respective repositories. Your task is to write a script that automates the fetching of the "libb64" and "tinyxml2" libraries from their GitHub ...
codefeedback
You are tasked with implementing a message queue system using the provided list of commands and frame types. The message queue system should support various operations such as identifying a client, subscribing to a topic, publishing messages, acknowledging message receipt, and handling errors. You are given the follow...
codefeedback
You are tasked with implementing a simple rendering system for a virtual reality application. The provided code snippet is a part of the `Renderer` module, which is responsible for managing the rendering process. The `Renderer` struct has a method `new` for initializing a new renderer with a shared mutable reference to...
codefeedback
You are tasked with implementing a function that calculates the factorial of a given non-negative integer. 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 5 * 4 * 3 * 2 * 1 = 120. Write a function `calculateFa...
codefeedback
You are tasked with creating a Python function that efficiently reads and processes a large CSV file. The function should be able to handle files that are too large to fit into memory and should return the sum of a specific column in the CSV file. You are provided with a code snippet that demonstrates the creation of ...
codefeedback
You are tasked with implementing a caching system that utilizes both memcache and NDB (a data storage service in Google Cloud Platform). Your goal is to create a function that retrieves values from the cache, first checking memcache and then NDB if the value is not found in memcache. If the value is found in NDB, it sh...
codefeedback
You are tasked with creating a Python package for web scraping called "UJSPortalScraper." The package should include a module for scraping data from a university job portal and a schema module for defining the structure of the scraped data. Your task is to implement the necessary classes and functions to fulfill the r...
codefeedback
You are tasked with creating a Python function that simulates a simple banking system using FastAPI and EdgeDB. The system should allow users to create accounts, deposit and withdraw funds, and check their account balance. You are provided with a code snippet that sets up the FastAPI application and connects it to an E...
codefeedback
You are tasked with creating a Python script that processes input arguments and performs specific operations based on the provided inputs. The script is intended to be used for processing data related to the CMS experiment at CERN. The script is expected to accept command-line arguments and perform the following tasks...
codefeedback
You are tasked with creating a Python class that simulates a job registry system. The system should allow users to register and manage various job listings. Each job listing should have attributes such as title, company, location, and salary. Additionally, the system should provide functionality to display all register...
codefeedback
You are tasked with implementing a class that manages the execution of function objects and tracks whether the `read()` function was called while the execution is ongoing. The class should have a switch to control the execution of the function objects and a flag to track if `read()` was invoked during execution. Your ...
codefeedback
You are tasked with creating a script to automate the process of calculating k-nearest neighbors for different subsets of a large dataset. The script should iterate through a range of sizes, calculate the k-nearest neighbors for each subset, and store the results in separate log files. The given code snippet is a part...
codefeedback
You are given a directed acyclic graph (DAG) represented as an adjacency matrix `graph[][]` with `n` vertices. Each cell `graph[from][to]` contains the weight of the edge from vertex `from` to vertex `to`. Additionally, an array `indegrees[]` is used to store the indegree of each vertex in the graph. Your task is to i...
codefeedback
You are tasked with implementing a pagination utility for a threaded messaging application. The provided code snippet is a simplified version of the pagination logic used to handle thread invitations. The `Paginate` class is responsible for paginating a list of thread invitation models based on the specified start and ...
codefeedback
You are working for a cloud infrastructure management company that uses Terraform to provision resources on various cloud platforms. Your team is responsible for automating the deployment of Kubernetes clusters using Terraform. As part of the deployment process, you need to ensure that the Kubernetes cluster is secured...
codefeedback
You are tasked with creating a program to organize and display a hierarchical list of items and item categories. Each item category can contain multiple items, and the items are to be displayed in a collapsible format on a web page. Your task is to implement a function that takes in a list of item categories and their ...
codefeedback
You are tasked with implementing a class that handles the preparation and retrieval of data in the context of Abstract Syntax Notation One (ASN.1) encoding. ASN.1 is a standard interface description language for defining data structures that can be serialized and deserialized in a cross-platform way. Your goal is to cr...
codefeedback
You are tasked with implementing a role-based access control system for a web application. The system should allow different levels of access to certain fields based on the user's role. You are given a Python class `RoleBased` that extends a class `FieldPerm`. The `RoleBased` class has an `__init__` method that takes a...
codefeedback
You are tasked with creating a custom testing framework for asynchronous Rust functions. The framework should support defining asynchronous test functions and running them, while also handling panics and reporting test results. Your task is to implement the `mimicaw_framework` crate, which will provide the necessary m...
codefeedback
You are tasked with implementing a neural network architecture using TensorFlow for a specific problem. The architecture will have a customizable number of input variables, hidden layers, and activation functions. Your goal is to create a Python function that takes in the number of input variables, a list specifying th...
codefeedback
You are tasked with creating a script to automate the installation of software packages on a Linux system. The script should handle the following scenarios: 1. Check if a specific file exists and remove it if it does. 2. If a `curl` command to download a file returns a non-zero exit code, handle the error appropriatel...
codefeedback
You are tasked with implementing a Python class that manages a directory structure for a software project. The class should provide functionality to identify components within the project directory based on certain criteria. Your task is to complete the implementation of the `ProjectManager` class, which has the follo...
codefeedback
You are tasked with creating a script to automate the testing of a Kubernetes cluster using the `podman` tool. The script should run a container with specific configurations and execute a test suite inside the container. Your task is to write a Bash script that accomplishes this automation. The script should perform t...
codefeedback