instruction_seed stringlengths 0 26.4k | source stringclasses 4
values |
|---|---|
You are tasked with implementing a Python class that interacts with a bookmaker's API. The provided code snippet includes an incomplete class `Nairabet` that inherits from `BookmakerBaseClass` and imports various modules. Your task is to complete the `Nairabet` class by implementing specific methods and attributes to i... | codefeedback |
You are tasked with creating a Python function that extracts the version number of a specified package using the `pkg_resources` module. The function should take the package name as input and return the version number as a string. You should also handle the case where the specified package is not found.
Create a funct... | codefeedback |
You are tasked with implementing a simple authentication decorator for a Python web application using the Tornado web framework. The provided code snippet is a simplified version of a Tornado RequestHandler class that handles POST requests for user-related operations. The `@authenticated` decorator is used to restrict ... | 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 integers, `start` and `end`, as input and return the sum of all prime numbe... | codefeedback |
You are tasked with implementing a filtering mechanism for MIME types in a Python web application. The MIME type consists of a major type and an optional minor type, separated by a forward slash (e.g., "text/html", "image/jpeg", "application/json"). The code snippet provided is a part of a class method used for filteri... | codefeedback |
You are tasked with creating a Python program that takes in two JSON files containing input data and produces an output JSON file. The program should use the argparse library to handle command-line arguments. The input JSON files contain new and existing values, and the output JSON file will be created based on the com... | codefeedback |
You are tasked with creating a custom plugin for a content management system (CMS) using Django. The CMS allows users to add various types of content to their web pages using plugins. Your goal is to create a custom Spacer plugin that adds empty space to the page for design purposes.
The given code snippet shows the b... | codefeedback |
You are tasked with implementing a cache management system for a web application. The cache is designed to store frequently accessed data to improve performance. The cache has a total cost limit, which is the maximum amount of memory it can consume. The cost of an item in the cache is determined by its size in bytes. W... | codefeedback |
You are tasked with implementing a method to render a mob in a 3D game environment. The method should take into account the size of the mob and adjust its position accordingly. You are given a code snippet that partially implements the rendering logic, and your task is to complete the method to ensure proper rendering ... | codefeedback |
You are tasked with creating a program that analyzes CSS code to identify and count the number of unique CSS properties used in a given stylesheet. A CSS property is a key-value pair that defines the style of an HTML element. Each property is defined by a name and a value, separated by a colon.
Your program should tak... | codefeedback |
You are tasked with creating a Python program to perform network scanning using the `scapy` library. The program should iterate through the network routes and extract relevant information about the network, netmask, interface, and address. Additionally, it should allow for the optional specification of a particular net... | codefeedback |
You are working on a program to analyze crime data from a file. The code snippet provided reads each line from the file, splits it into words, and then attempts to process the words to identify specific crime types. However, the code contains some errors and lacks the necessary logic to achieve the intended functionali... | codefeedback |
You are tasked with implementing a Python program that simulates a simple chat server using sockets. The server should be able to handle incoming connections from multiple clients and broadcast messages from one client to all other connected clients. The provided code snippet is a part of the server's main loop, handli... | codefeedback |
You are tasked with implementing a ConfigService class that manages configuration settings for a server. The ConfigService class interacts with an Authorizer class to ensure that only authorized users can access and modify the configuration settings. Additionally, the ConfigService class interacts with an AlertsService... | codefeedback |
You are tasked with implementing a class that represents a Pet. The class should have the following properties and methods:
Properties:
- `name` (string): The name of the pet.
- `age` (integer): The age of the pet.
- `species` (string): The species of the pet.
Methods:
- `make_sound()`: A method that returns a string... | codefeedback |
You are tasked with creating a function that manages the creation of directories for logging purposes. The function should take in the logs folder path, the application name, and the file manager as input parameters. It should then create a directory for the specified application within the logs folder. If the director... | codefeedback |
You are tasked with implementing a conditional generative adversarial network (GAN) for generating synthetic data. The GAN consists of a generator and a discriminator, and it uses conditional vectors to guide the generation process. The generator takes random noise as input and produces synthetic data conditioned on th... | codefeedback |
You are tasked with creating a Python script to automate the cleanup process for a Docker-based application. The script should stop and remove containers, delete specific volumes, and remove a network using the Docker Compose command-line tool.
Your script should perform the following tasks in sequence:
1. Stop all co... | codefeedback |
You are tasked with creating a simple Angular application for a book store. The application should have a landing page component, a menu toggle directive, and should utilize various Angular modules and features. Your goal is to implement the necessary Angular modules and components based on the given code snippet.
Giv... | codefeedback |
You are tasked with implementing a generic data structure that supports a doubly linked list with the ability to traverse the list in reverse order. The provided code snippet is a part of a C++ class template that defines a method for obtaining the previous entry in the list.
Your task is to complete the implementatio... | codefeedback |
You are tasked with creating a Python function that processes a list of options and returns a dictionary containing various pieces of information. The function should take in a list of options and perform the following tasks:
1. Calculate the count of units using the `compute_count` function and store it in the `unit_c... | codefeedback |
You are tasked with implementing a custom training loop for a machine learning model. The training loop consists of several methods that are called at different stages of the training process. Your goal is to implement these methods to perform specific actions before and after each training iteration and epoch.
You ar... | codefeedback |
You are tasked with implementing a Mean Average Precision (MAP) calculation module for object detection algorithms. The MAP is a popular metric used to evaluate the performance of object detection models. The MAP is calculated based on the precision and recall values obtained from the model's predictions.
Your task is... | codefeedback |
You are working on a web application that uses a database to store user information. The application has a testing module that utilizes fixtures to set up test data. The code snippet provided is from a testing module that uses the pytest framework and SQLAlchemy to create a fixture for a superuser for testing purposes.... | codefeedback |
You are tasked with implementing a simple CSS-in-JS library that allows users to define styled components using a JavaScript API. Your goal is to create a function that takes a component name and a style object as input and returns a string representing the CSS styles for the component.
The function should support the... | codefeedback |
You are tasked with implementing a custom asynchronous task spawner in Rust. The provided code snippet outlines a function `spawn` that takes a spawner and a future, and spawns the future as a task using the spawner. Your goal is to complete the implementation of the `spawn` function by addressing the TODO comments and... | 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. Your function should take two parameters, `start` and `end`, representing the inclusive range within whi... | codefeedback |
You are tasked with implementing a function that processes a given internet location (innetloc) and modifies it according to specific rules. The function should check if the input innetloc contains ".blogspot." but does not end with ".blogspot.com". If this condition is met, the function should extract the prefix befor... | codefeedback |
You are tasked with creating a script to automate the process of vetting Go modules within a specified directory structure. The script should iterate through all subdirectories within the `./src/` directory and, for each subdirectory containing a `go.mod` file, execute the `go vet` command. The script should be written... | codefeedback |
You are tasked with creating a command-line interface (CLI) tool for a data management application called "DataTug." The tool should support various options for serving the application, including the ability to disable optimization and enable source map generation.
Your task is to implement a function that parses the ... | codefeedback |
You are tasked with creating a Python function that generates a unique identifier for each user in a system. The function should take into account the user's name and age to create the identifier. The identifier should be a combination of the first three letters of the user's name, the last two letters of the user's na... | codefeedback |
You are working on a reinforcement learning algorithm for a robotic system that involves controlling the movement of its limbs. The code snippet provided is a part of the scoring mechanism used to evaluate the quality of the robot's actions. The code snippet is written in Python and uses the NumPy library for array ope... | codefeedback |
You are tasked with creating a Python class that simulates a network query interface. The class, named `NetworkQuery`, should have methods to retrieve a list of Service Provider Interfaces (SPIs), a list of network interfaces, and the Ethernet address of a specific interface. Additionally, you need to write unit tests ... | codefeedback |
You are tasked with implementing a class that interfaces with different EEPROM (Electrically Erasable Programmable Read-Only Memory) devices using the I2C (Inter-Integrated Circuit) protocol. The class should support two types of EEPROM devices: 24x256 and 24x512. The class should be able to calculate the maximum addre... | codefeedback |
You are tasked with creating a Python function that processes historical data for a specific device. The function will interact with a mock database and handle HTTP requests using the Falcon framework. Your goal is to implement the function `STHHistory.on_get` to retrieve historical data based on the provided parameter... | codefeedback |
You are tasked with implementing a deep learning model for fashion item classification using a subset of a large dataset. The dataset is organized into training, validation, and test sets. The deep learning model uses an embedding network (`emb_net`) for feature extraction and classification. The `emb_net` is then move... | codefeedback |
You are working on a project that involves evaluating the privacy of machine learning models. The `ml_privacy_meter` library provides various utilities for this purpose. In this scenario, you are tasked with using the `attack_data` and `attack_utils` modules from the `ml_privacy_meter` library to assess the vulnerabili... | codefeedback |
You are tasked with implementing a function that extracts the default export from a given JavaScript code snippet. The default export is the value that is exported by default from a module. Your function should take a string representing the JavaScript code snippet as input and return the default export value.
You are... | codefeedback |
You are tasked with creating a Python program that identifies the type of a given matrix. The program should prompt the user to input the dimensions of the matrix (number of rows and columns) and then input the elements of the matrix. The program should then determine whether the matrix is an identity matrix, symmetric... | codefeedback |
You are tasked with creating a class that manages tasks. The class should be able to update the name and description of a task, as well as set its status. Additionally, the class should handle validation of the task name.
You are provided with a code snippet that demonstrates the usage of the class. The snippet decode... | codefeedback |
You are tasked with implementing a matrix class in C++ that supports the functionality to set whether to use bias and to resize the matrix to a given size. The matrix class should have the following methods:
1. `setUseBias(bool useBias)`: A method to set whether to use bias in the matrix calculations. If `useBias` is ... | codefeedback |
You are tasked with implementing a function that checks whether a given string is a palindrome or not. A palindrome is a word, phrase, number, or other sequence of characters that reads the same forward and backward, disregarding spaces, punctuation, and capitalization.
You need to implement the function `isPalindrome... | codefeedback |
You are tasked with implementing a file encryption utility that encrypts file paths based on certain criteria. The utility should provide a method `GetEncryptedPath` that takes a file path and a boolean flag indicating whether the file must already exist. The method should return the fully encrypted path if it meets th... | codefeedback |
You are tasked with creating a Python class that manages SSL certificates for Cloud SQL instances. Your class should provide methods for creating, deleting, listing, and retrieving information about SSL certificates associated with Cloud SQL instances. The class should be designed to interact with the Google Cloud SDK ... | codefeedback |
You are tasked with creating a Python function that processes a list of numbers 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.
You are given the following code snippet as a starting point:
```python
def count... | codefeedback |
You are working on a project that involves analyzing porous materials using image processing techniques. You have been given a Python script that uses the `porespy` and `openpnm` libraries to generate and analyze images of porous materials. The script uses the `numpy` library for numerical operations and the `matplotli... | codefeedback |
You are tasked with creating a program that simulates a simple file system. The file system will consist of directories and files, and you need to implement basic operations such as creating directories, creating files, listing the contents of a directory, and navigating through the file system.
Your program should su... | codefeedback |
You are tasked with implementing a class that manages configuration sections for a network router. The provided code snippet is a partial implementation of the `RouterSection` class, which is used to represent a section of configuration for a router. Your task is to complete the implementation of the `RouterSection` cl... | codefeedback |
You are tasked with implementing a recommendation system for a polling application. The system should provide recommendations based on user preferences and interactions with the platform. To achieve this, you need to create a class that factors in common behaviors for all recommendation views.
Your task is to complete... | codefeedback |
You are tasked with implementing a simple drawing application using Python and OpenCV. The application should allow the user to draw either rectangles or circles on a blank canvas using the mouse. The user can switch between drawing rectangles and circles by pressing a specific key. When the left mouse button is presse... | codefeedback |
You are tasked with implementing a custom hook for tracking the intersection of a target DOM element with the viewport. The hook should provide functionality to determine whether the target element is intersecting with the viewport, calculate the intersection rate, and set the target DOM element to be observed.
You ar... | codefeedback |
You are tasked with implementing a Python function that rounds a given floating-point number to a specified number of decimal places. The function should take two parameters: the floating-point number to be rounded (`num`) and the number of decimal places to round to (`decimal_places`). The function should return the r... | codefeedback |
You are tasked with implementing a program that reads a sequence of integers from the standard input and calculates the sum of all the even numbers in the sequence. The program should continue reading integers until a non-positive integer is encountered, at which point it should output the sum of all the even numbers e... | codefeedback |
You are tasked with implementing a function that validates a given password based on certain criteria. The function should return `true` if the password is valid and `false` otherwise. The criteria for a valid password are as follows:
1. The password must be at least 8 characters long.
2. The password must contain at l... | codefeedback |
You are tasked with implementing a simple gradient descent algorithm to optimize a linear regression model. Given a set of input features X, corresponding target values y, and initial weights/parameters theta, your goal is to update the weights using gradient descent to minimize the mean squared error (MSE) loss functi... | codefeedback |
You are tasked with creating a custom decorator in TypeScript to validate whether a given string contains only Kana characters, which are the syllabic Japanese scripts Hiragana and Katakana. The decorator should be implemented using TypeScript decorators and should be able to be used on class methods.
Your task is to ... | codefeedback |
You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order, and each of their nodes contains a single digit. Add the two numbers and return the sum as a linked list.
Each linked list is represented by a class `ListNode` with the following structure:
```
stru... | codefeedback |
You are tasked with creating a Vue.js component for a customer portal that handles the registration process for a business internet service called "BiznetWifi". The component is intended to be included in a larger Vue.js application and will be used to facilitate the registration process for customers.
The provided co... | codefeedback |
You are tasked with creating a custom styled component for a mobile navigation item in a React application. The component should be styled using the `styled-components` library and should have specific properties based on the theme provided. The theme properties include breakpoints, palette, and other custom styles. Yo... | codefeedback |
You are tasked with implementing a custom weight initialization function for a neural network. The given code snippet shows a Python function `init_func` that initializes the weights of the neural network layers based on the type of initialization specified. The function takes in a module `m` and performs weight initia... | codefeedback |
You are tasked with implementing a simple serialization and deserialization library in Rust. The library should provide functionality to serialize and deserialize data structures into a custom binary format. The provided code snippet includes two modules: `serializer` and `util`. The `serializer` module is responsible ... | codefeedback |
You are tasked with implementing a simple testing framework for unit tests. The framework provides a function `print_report` to print the results of a test suite. The function takes in the test suite and an optional `printer_mod` argument, which defaults to the result of the `get_default` function. The `get_default` fu... | codefeedback |
You are tasked with implementing a function that calculates the average of a list of numbers, excluding any outliers. An outlier is defined as a number that is either significantly larger or smaller than the rest of the numbers in the list. To identify outliers, you will use the concept of Z-score, which measures how m... | codefeedback |
You are given an array `arr` of positive integers in ascending order and an integer `k`. Your task is to find the `k`-th positive integer that is missing from the array. If there are multiple possible answers, return the smallest one.
For example, given `arr = [2, 3, 4, 7, 11]` and `k = 5`, the missing positive intege... | codefeedback |
You are tasked with creating a Python function that processes a list of file extensions and returns a filtered list containing only the supported file extensions. The function should utilize the imported modules and their available functions to determine the supported file extensions.
Write a function called `filter_s... | codefeedback |
You are tasked with creating a program that reads a text file and counts the occurrences of each word in the file. Your program should ignore punctuation and consider words with different capitalizations as the same word. The program should then output the word count for each unique word in alphabetical order.
For exa... | codefeedback |
You are given a class `TreeLinkNode` representing a binary tree with an additional `next` pointer, which is used to connect nodes at the same level in a binary tree. The `connect` method is used to populate the `next` pointer for each node in the tree. Implement the `connect` method to connect the nodes at the same lev... | codefeedback |
You are tasked with creating a Python function that processes stock trading data and generates a report in an Excel file. The function should take a database connection, today's date, and an Excel writer object as input parameters. The function should retrieve information about stocks that have experienced three consec... | codefeedback |
You are tasked with implementing a Python function that calculates the Lomb-Scargle periodogram for a given time series data. The Lomb-Scargle periodogram is a method used in spectral analysis to find the dominant frequencies in unevenly sampled data. The function should take the time series data, including the time va... | codefeedback |
You are tasked with implementing a Python function to interact with the European Bioinformatics Institute's (EBI) Ontology Lookup Service (OLS) to retrieve information about Experimental Factor Ontology (EFO) terms. The EFO is used to describe experimental variables in ArrayExpress and other EBI databases. Your task is... | codefeedback |
You are tasked with creating a custom view for a video player in a Swift iOS app. The provided code snippet is a part of the process to embed a SwiftUI view into a UIKit-based app. Your task is to complete the implementation of the `SDKPlayerView` and `sdkPlayerViewModel` to create a functional video player view.
The ... | codefeedback |
You are tasked with creating a feature management system for a software application. The system should allow for the dynamic enabling or disabling of certain features based on configuration settings. To achieve this, you need to implement a feature management worker class that can read configuration options and determi... | codefeedback |
You are tasked with implementing a class for managing executables on a computing device. The class, named `ExecutableManager`, is responsible for handling the installation of executable files on a specific device. The provided code snippet is a part of the `ExecutableManager` class and demonstrates the installation pro... | codefeedback |
You are tasked with creating a Python program that simulates a simple network server for processing incoming data packets. The server will receive serialized data packets, parse them, and then print out specific information from the parsed packets. Your task is to implement the parsing and printing logic for the server... | codefeedback |
You are tasked with implementing a function to find and remove old Docker containers and images based on certain criteria. The code snippet provided is part of a larger system for managing Docker containers and images. Your task is to complete the implementation of the `_find_old_images` function, which is responsible ... | codefeedback |
You are tasked with implementing a logging system for an educational software application called Kolibri. The application has different types of interactions that need to be logged, such as hints, answers, and errors. The interaction types are defined in a Python file named `interaction_types.py` within the `kolibri/co... | codefeedback |
You are tasked with implementing a function that processes polygon data to generate a compressed mask representation. The function should take a list of polygons, scale values, and image dimensions as input, and produce a merged run-length encoded (RLE) mask as output.
You are given the following code snippet as a ref... | codefeedback |
You are tasked with simulating a series of coin tosses and calculating the probability of obtaining a specific outcome.
You are given a function `toss_Coin()` that simulates the tossing of a fair coin and returns either "Success" (representing a head) or "Failure" (representing a tail). The function `toss_Coin()` is ... | codefeedback |
You are tasked with implementing a custom mock class for a managed object context in a Core Data environment. The mock class should mimic the behavior of a real managed object context for testing purposes. Your goal is to create the `MockManagedObjectContext` class with specific functionalities to support testing scena... | codefeedback |
You are tasked with implementing a basic LZW (Lempel-Ziv-Welch) compression algorithm in Rust. LZW is a lossless data compression algorithm that works by replacing repeated occurrences of substrings with a single code. The algorithm maintains a dictionary of substrings encountered in the input data and assigns a unique... | codefeedback |
You are tasked with creating a Python function that processes a Django migration file and extracts information about the migration operations. The migration file is represented as a string, and it contains a series of migration operations that need to be parsed and analyzed.
Your task is to implement the function `par... | codefeedback |
You are tasked with implementing a method to post messages to a Facebook page using the Facebook Graph API. The provided code snippet is a part of an Android application that aims to facilitate posting messages to a specific Facebook page. The `PostMessages` class extends `AppCompatActivity` and implements the `View.On... | codefeedback |
You are tasked with creating a command-line utility for managing a simple file system. The utility should support basic file system operations such as creating, reading, updating, and deleting files. The utility will be invoked using the following command-line syntax:
```
./sfs -f <file_system_name> <operation> [opera... | codefeedback |
You are tasked with creating a Python function that simulates a simplified version of a database migration tool similar to Alembic. Your function will receive a list of database migration commands and should process them in the correct order. Each command can be one of the following types:
- `op.drop_index(index_name, ... | codefeedback |
You are tasked with implementing a simple alert system for a monitoring application. The system should be able to handle different types of alerts and notify the appropriate recipients based on the severity of the alert.
You are given a Python class `AlertSystem` with the following methods:
- `add_recipient(recipient... | codefeedback |
You are tasked with implementing a command-line interface for a teleportation system in a virtual world. The system supports various commands for managing teleporters and player teleportation. Each command is in the format: `tport <teleporter> <action> [parameters]`.
The available commands are as follows:
- `tport edi... | codefeedback |
You are tasked with creating a custom formatter for a web application using Yii framework. The formatter should be able to convert a given string into a specific format based on certain rules. The rules are as follows:
1. If the input string contains only lowercase letters, it should be converted to uppercase.
2. If th... | codefeedback |
You are tasked with implementing a memory allocation and management system. The system should support the allocation and deallocation of memory blocks, and it should handle errors such as attempting to allocate memory that has already been allocated.
You are given a series of commands in the form of strings, each repr... | codefeedback |
You are tasked with implementing a Python class that simulates a simple version of a 64-bit set, called `SimpleSet64`. The set will be based on a seed value and will support basic set operations. Your task is to complete the implementation of the `SimpleSet64` class by adding the necessary methods to support the specif... | codefeedback |
You are tasked with creating a Python class to manage the operations of various types of vehicles used in a space exploration program. The class should be able to handle rover vehicles and their specific functionalities. Your task is to implement the methods for controlling the rover's movements and actions.
You are p... | codefeedback |
You are working on a network automation project and need to implement a configuration mode for F5 devices. The F5 device has a method `config_mode` which takes a `config_command` as an argument and returns a string. However, the current implementation of `config_mode` simply returns an empty string and does not handle ... | codefeedback |
You are tasked with implementing a cache simulator in Rust. The cache simulator will have a method `misses` that calculates the number of cache misses based on a given memory access pattern. The cache is direct-mapped and uses a simple least recently used (LRU) replacement policy.
You are provided with the following c... | codefeedback |
You are working on a project to develop a neural network library in Python. As part of this project, you are tasked with implementing a function that sets the choice of layers for the neural network. The function takes in the layer number and a list of operations to be performed at each layer. Your task is to implement... | codefeedback |
You are tasked with creating a URL routing system for a web application using Django. The given code snippet is a part of the URL configuration for a Django project. The `urlpatterns` list contains several URL patterns, each associated with a specific view function. The `url` function is used to map a URL pattern to a ... | codefeedback |
You are tasked with implementing a simple garbage collection mechanism for a custom programming language. The provided code snippet is a part of a class definition for managing resources and garbage collection. The `_DoKids` function is responsible for invoking a given function on the internal objects `_bvr`, `_notifie... | codefeedback |
You are tasked with creating a Python package that automates the process of querying the Astrophysics Data System (ADS) and InSPIRE databases to fill a LATEX bibliography. Your package should be able to retrieve relevant bibliographic information and format it in LATEX style for easy inclusion in academic papers.
Your... | codefeedback |
You are tasked with creating a Python function that searches for files with a specific extension within a given directory and its subdirectories. The function should exclude certain files from the search based on a predefined list. Your task is to complete the implementation of the `find_puml` function, which takes a `... | codefeedback |
You are tasked with implementing a simple string class in C++. The class should have the following functionalities:
1. A constructor that takes a C-style string (const char*) as an argument and initializes the internal pointer to point to the same string.
2. A method to return the length of the string.
3. A method to r... | codefeedback |
You are tasked with implementing a custom validation framework in Swift. The `Validation` struct has been provided as a starting point, and you need to extend it with various validation functions. Each validation function should take a value of a specific type and return a boolean indicating whether the value passes th... | codefeedback |
You are given a list of non-negative integers. Your task is to arrange these numbers in such a manner that they form the largest number possible. The result may be very large, so you should return the result in the form of a string.
For example, given the numbers [64, 646, 648, 70], you need to arrange them to form th... | codefeedback |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.