source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
magic_instruct_75k
46,205
Write a Python function to analyze a given software license text and count the occurrences of specific keywords. The function should be case-insensitive when counting the occurrences of keywords. The license text is provided as a string, and the keywords to be counted are provided as a list of strings. The function sho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_keywords_in_license(license_text: str, keywords: List[str]) -> Dict[str, int]: """ Counts the occurrences of specific keywords in a given software license text. Args: license...
magic_instruct_75k
46,248
Write a Python function to calculate the average value for each feature across all the properties in a given dataset. The dataset is provided as a single line of comma-separated values, where each group of values represents the features of a single property. The features are in the same order for each property, and the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_average_features(data: str) -> List[float]: """ Calculate the average value for each feature across all properties in the given dataset. Args: data (str): A single line of comm...
magic_instruct_75k
46,294
Write a Python function to parse a configuration list into a dictionary. The configuration list is a sequence of key-value pairs where keys are always strings and values can be strings or integers. The function should correctly identify and convert string representations of integers into actual integers. The function s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union def parse_configuration(config_list: List[str]) -> Dict[str, Union[str, int]]: """ Parses a configuration list into a dictionary. Args: config_list (List[str]): A list of string...
magic_instruct_75k
46,311
Write a Python function to manage user profiles. The function should allow updating the user's name, age, and email address, and retrieving the user's information. The function should start with: ```python from typing import Dict def manage_user_profile(initial_profile: Dict[str, str], updates: Dict[str, str]) -> Dict...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def manage_user_profile(initial_profile: Dict[str, str], updates: Dict[str, str]) -> Dict[str, str]: """ Manages a user profile by applying updates to the initial profile and returning the updated profil...
magic_instruct_75k
46,325
Write a Python function `generate_url_patterns` that takes in a list of tuples, where each tuple contains the URL path, view function, and name of the URL pattern. The function should return a dictionary where the keys are the URL paths and the values are the corresponding view functions and URL pattern names. The fun...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def generate_url_patterns(url_tuples: List[Tuple[str, str, str]]) -> Dict[str, Tuple[str, str]]: """ Generates a dictionary of URL patterns from a list of tuples. Args: url_tupl...
magic_instruct_75k
46,338
Write a Bash script that automates the process of updating the Nagios configuration files. The script should: 1. Check if the configuration archive file (`${OUTPUT_DIR}${CONF_ARCHIVE}`) is newer than the one in the temporary directory (`${TEMP_DIR}${CONF_ARCHIVE}`). 2. If the configuration archive is newer, copy it to ...
Here is the Python code to solve the given problem in the markdown block: ```bash #!/bin/bash TEMP_DIR="/tmp/" OUTPUT_DIR="/path/to/output/dir/" CONF_ARCHIVE="nagios_conf.tar" NAGIOS_DIR="/etc/nagios/" # Check if the configuration archive in the output directory is newer than the one in the temporary directory if [[ ...
magic_instruct_75k
46,339
Write a Python function to simulate the security scanning process for WordPress plugins. The function should take a list of WordPress plugin names as input and return a dictionary where the keys are the plugin names and the values are lists of security issues found in each plugin. If no security issues are found for a ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def scan_wordpress_plugins(plugins: List[str]) -> Dict[str, List[str]]: """ Simulates the security scanning process for WordPress plugins. Args: plugins (List[str]): A list of WordPres...
magic_instruct_75k
46,353
Write a Python function to determine if a session is still valid based on its creation time and the current time. The session lifetime is defined by the `SESSION_LIFETIME` variable, which represents the duration of a session in minutes. The function should take two parameters: - `session_creation_time` (datetime): The ...
Here is the Python code to solve the given problem in the markdown block: ```python from datetime import datetime, timedelta SESSION_LIFETIME = timedelta(minutes=5) def is_session_valid(session_creation_time: datetime, current_time: datetime) -> bool: """ Determine if a session is still valid based on its cre...
magic_instruct_75k
46,355
Write a Python function to count the frequency of each word in a list of strings, ignoring case sensitivity and excluding non-alphanumeric characters. The function should return a dictionary where the keys are the words (in lowercase and without non-alphanumeric characters) and the values are the counts of those words....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import re def word_frequency_counter(words: List[str]) -> Dict[str, int]: """ Counts the frequency of each word in a list of strings, ignoring case sensitivity and excluding non-alphanumeric charac...
magic_instruct_75k
46,368
Write a Python function to filter device pools based on a requested NUMA affinity policy and count. The function should return a list of device pools that meet the allocation criteria. The function should handle three types of NUMA affinity policies: "REQUIRED", "PREFERRED", and "NONE". The function signature should b...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union def filter_device_pools(device_pools: List[Dict[str, Union[int, str]]], requested_policy: str, requested_count: int) -> List[Dict[str, int]]: """ Filters the device pools based on the reques...
magic_instruct_75k
46,370
Write a Python function to generate a unique service name based on the input service name. The generated service name should be in the format "service_name_X", where X is a unique number. If the generated service name already exists in a given list of existing service names, the function should increment X until it fin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_unique_service_name(service_name: str, existing_service_names: List[str]) -> str: """ Generates a unique service name based on the input service name and a list of existing service names. ...
magic_instruct_75k
46,379
Create a Python function called `custom_method_decorator` that takes two arguments: 1. `decorator_func`: A function decorator that will be applied to the target method. 2. `name`: The name of the method to which the decorator will be applied. The function should return a new class with the specified method decorated b...
Here is the Python code to solve the given problem in the markdown block: ```python def custom_method_decorator(decorator_func, name): """ A custom decorator that applies a specified function decorator to a class method. Args: decorator_func (function): The function decorator to be applied to the m...
magic_instruct_75k
46,388
Write a Python function to calculate the sum of all 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. For example, the first few Fibonacci numbers are 0, 1, 1, 2, 3, 5, 8, 13, 21, and so on....
Here is the Python code to solve the given problem in the markdown block: ```python def even_fibonacci_sum(limit: int) -> int: """ Calculate the sum of all even Fibonacci numbers up to a given limit. Args: limit (int): The upper limit for the Fibonacci numbers to be considered. Returns: ...
magic_instruct_75k
46,389
Write a Python function to filter a dataset containing students' test scores in subjects A and B. The function should return a new dataset containing only the rows where the score in subject A is less than 2 or the score in subject B is greater than or equal to 14. The dataset is represented as a list of dictionaries, ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def filter_dataset(dataset: List[Dict[str, int]]) -> List[Dict[str, int]]: """ Filters a dataset containing students' test scores in subjects A and B. Returns a new dataset containing only the ...
magic_instruct_75k
46,406
Write a Python function to calculate the sum of all even numbers in a given list of integers without using any conditional statements (if, else, etc.) or the modulo operator (%). The function should start with: ```python from typing import List def sum_even_numbers(nums: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_even_numbers(nums: List[int]) -> int: """ Calculate the sum of all even numbers in the given list of integers. Args: nums (List[int]): A list of integers. Returns: int: ...
magic_instruct_75k
46,425
Implement a Python class `ServiceRegistry` that provides methods for registering and retrieving services by their unique keys. The class should have the following methods: 1. `register_service(key: str, service: Any)`: This method should register a service with the given key. If a service with the same key already exis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Any class ServiceRegistry: """ A class to manage the registration and retrieval of services by unique keys. Methods: - register_service(key: str, service: Any) -> None: Registers a service with the g...
magic_instruct_75k
46,426
Write a Python function to process a list of software versions and their licenses. The function should take a list of dictionaries, where each dictionary represents a software version and its corresponding license. The goal is to transform the license data from a single string to a list of strings, splitting the origin...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def process_licenses(versions: List[Dict[str, str]]) -> List[Dict[str, List[str]]]: """ Process a list of software versions and their licenses. This function takes a list of dictionaries, wher...
magic_instruct_75k
46,439
Write a Python function to process a form submission in a web application. The function should extract the form data from a request object and return a dictionary containing the user ID and all other form fields. The request object has a `form_data` dictionary containing the form fields and their values, and a `user` o...
Here is the Python code to solve the given problem in the markdown block: ```python def processFormSubmission(request) -> dict: """ Processes a form submission by extracting the form data and user ID from the request object. Args: request: An object containing form data and user information. ...
magic_instruct_75k
46,448
Write a Python function to determine if a given string is a valid IPv4 address. An IPv4 address consists of four decimal numbers (each ranging from 0 to 255) separated by periods. The function should return `True` if the input string is a valid IPv4 address, and `False` otherwise. The code should start with: ```python...
Here is the Python code to solve the given problem in the markdown block: ```python def is_valid_ipv4_address(ip_address: str) -> bool: """ Determines if the given string is a valid IPv4 address. Args: ip_address (str): The string to be checked for IPv4 address format. Returns: bool: T...
magic_instruct_75k
46,454
Implement the `create_dataset` and `delete_dataset` methods of a client class that interacts with a data processing application. The `create_dataset` method should create a dataset with a unique name, specified format, base64-encoded content, and tags. The `delete_dataset` method should delete a dataset using its UUID....
Here is the Python code to solve the given problem in the markdown block: ```python import base64 import uuid class DataProcessingClient: def __init__(self): self.datasets = {} def create_dataset(self, unique_name: str, dataset_format: str, content: str, tags: list) -> str: """ Create ...
magic_instruct_75k
46,489
Write a Python function to generate a detailed report for processing laboratory plates. The function should take the number of input plates, the number of output plates, and a dictionary representing the output artifacts with their respective volumes. The function should then generate a report detailing the input and o...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def process_plates(num_input_plates: int, num_output_plates: int, output_artifacts: Dict[str, List[str]]) -> str: """ Generates a detailed report for processing laboratory plates. Args: ...
magic_instruct_75k
46,514
Write a Python function to join a list of strings with a newline character (`\n`) between each string. The function should return a single string where each element of the input list is separated by a newline character. The function should handle an empty list by returning an empty string. The code should start with: ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def join_with_newline(rows: List[str]) -> str: """ Joins a list of strings with a newline character between each string. Args: rows (List[str]): A list of strings to be joined. Returns:...
magic_instruct_75k
46,518
Write a Python function `process_browser_options(options: list, app_env: str) -> list` that processes a list of web browser options and modifies them based on certain conditions. The function should: 1. Add the argument `--no-sandbox` to the options. 2. Add the argument `--disable-dev-shm-usage` to the options. 3. Add ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def process_browser_options(options: List[str], app_env: str) -> List[str]: """ Processes a list of web browser options and modifies them based on certain conditions. Args: options (list): A...
magic_instruct_75k
46,538
Write a Python function to calculate the sum of all positive integers in a given array. If the array is empty or contains no positive integers, the function should return 0. The function should be named `calculate_positive_sum` and should start with: ```python from typing import List def calculate_positive_sum(arr: Li...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_positive_sum(arr: List[int]) -> int: """ Calculate the sum of all positive integers in the given array. Args: arr (List[int]): The array of integers from which to calculate the...
magic_instruct_75k
46,575
Write a Python function `setup_environment` that takes a directory path `DIR` as input and generates the necessary shell commands to set up a Python virtual environment and install the required packages. The function should activate the virtual environment, install the required packages from a `requirements.txt` file, ...
Here is the Python code to solve the given problem in the markdown block: ```python def setup_environment(DIR: str) -> str: """ Generates the necessary shell commands to set up a Python virtual environment and install required packages. Args: DIR (str): The directory path where the virtual environm...
magic_instruct_75k
46,586
Write a Python function to determine if a given string contains all unique characters. The function should return `True` if all characters in the string are unique, and `False` otherwise. The function should be efficient and handle edge cases such as empty strings and strings with a single character. The code should s...
Here is the Python code to solve the given problem in the markdown block: ```python def isunique(s: str) -> bool: """ Determines if a given string contains all unique characters. Args: s (str): The input string to check for unique characters. Returns: bool: True if all characters in th...
magic_instruct_75k
46,592
Write a Python function to implement a circular buffer for converting strings of digits to integers. The circular buffer is represented by a list of integers with a maximum size of `BUFFER_SIZE`. The variable `buffer_index` represents the current index in the circular buffer. The goal is to write a function that takes ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def convert_and_store(input_str: str, buffer: List[int], buffer_index: int) -> int: """ Converts a string of digits to an integer and stores it in a circular buffer. Args: input_str (str): A...
magic_instruct_75k
46,599
Write a Python function to filter out dataset names from a dictionary where the dataset sizes exceed a specified threshold. The function should return a list of dataset names that have sizes less than or equal to the given threshold. The code should start with: ```python from typing import Dict, List def filter_datas...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def filter_datasets(dataset_sizes: Dict[str, float], threshold: float) -> List[str]: """ Filters dataset names from a dictionary based on their sizes, returning only those that are less than or equ...
magic_instruct_75k
46,656
Write a Python function to generate a command-line string for a bioinformatics tool that performs multiple sequence alignment. The function should take the input file path, model type, thread count, alignment option, and bootstrapping option as arguments and return the command-line string. The command-line string shoul...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_alignment_command(input_file: str, model_type: str, thread_count: int, alignment_option: str, bootstrapping_option: str) -> str: """ Generates a command-line string for a bioinformatics tool that performs multiple s...
magic_instruct_75k
46,666
Write a Python function to categorize a list of music genres into three distinct groups: "Rock-based", "Pop-based", and "Other". A genre is considered "Rock-based" if it contains the word "Rock" or "Metal" in its name. A genre is considered "Pop-based" if it contains the word "Pop" or "Dance" in its name. If a genre do...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def categorize_genres(genres: List[str]) -> Dict[str, int]: """ Categorizes a list of music genres into "Rock-based", "Pop-based", and "Other" based on their names. Args: genres (List[...
magic_instruct_75k
46,669
Create a Python class `TimeSystem` that simulates a simplified time system for a game engine. The class should manage the game's time and update the game state at regular intervals. The class should have the following methods: - `__init__`: Initializes the current time in milliseconds to 0. - `process_frame`: Updates t...
Here is the Python code to solve the given problem in the markdown block: ```python class TimeSystem: def __init__(self): """ Initializes the TimeSystem with the current time set to 0 milliseconds. """ self.current_time_ms = 0 def process_frame(self): """ Updates...
magic_instruct_75k
46,694
Create a Python function that simulates the management of multiple services in a large-scale enterprise application. The function should initialize and perform operations using these services. Each service is represented as a class with specific methods. The function should demonstrate the usage of these services by ca...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List class WorkerService: def work(self) -> str: return "WorkerService is working" class BusinessService: def operate(self) -> str: return "BusinessService is operating" class ProjectService...
magic_instruct_75k
46,703
Write a Python function to convert references in a given text to a specific format. A reference is defined as a string that starts with the '@' symbol followed by a sequence of alphanumeric characters. The function should take a string as input and return a new string with all references converted to a different format...
Here is the Python code to solve the given problem in the markdown block: ```python import re def convert_references(text: str) -> str: """ Converts references in the given text to a specific format. A reference is defined as a string that starts with the '@' symbol followed by a sequence of alphanumeric ...
magic_instruct_75k
46,721
Write a Python function to automate the process of building and deploying a web application. The build process involves installing necessary dependencies using npm and displaying a message upon completion. The function should handle any errors that may occur during the build process and provide appropriate feedback to ...
Here is the Python code to solve the given problem in the markdown block: ```python import subprocess def build_web_app() -> None: """ Automates the process of building and deploying a web application. The function performs the following steps: 1. Installs the required dependencies for the web applica...
magic_instruct_75k
46,726
Write a Python function to validate and process the input parameters for creating an Elastic IP resource in AWS using Pulumi. The function should take `allocation_id` as a parameter, validate it, and then return a dictionary containing the processed properties for creating an Elastic IP resource. The function should p...
Here is the Python code to solve the given problem in the markdown block: ```python def process_elastic_ip(allocation_id: str) -> dict: """ Validates and processes the input parameters for creating an Elastic IP resource in AWS using Pulumi. Args: allocation_id (str): The allocation ID for the Elas...
magic_instruct_75k
46,736
Create a Python class `RefineModel` that takes a configuration object as input and refines the model based on the provided configuration. The class should have a method `refine` that applies the configuration settings to the model. The configuration object is assumed to have attributes that correspond to various model ...
Here is the Python code to solve the given problem in the markdown block: ```python class RefineModel: """ A class to refine a model based on a provided configuration object. Attributes: config: An object containing configuration settings for the model. model: A placeholder for the model ob...
magic_instruct_75k
46,739
Write a Python function to calculate the total number of nodes in a binary tree. The binary tree is represented using a simple binary tree node class with left and right child pointers. The function should take the root of the binary tree as input and return the total number of nodes in the tree. The binary tree node ...
Here is the Python code to solve the given problem in the markdown block: ```python class TreeNode: def __init__(self, value=0, left=None, right=None): self.value = value self.left = left self.right = right def count_nodes(root: TreeNode) -> int: """ Calculate the total number of no...
magic_instruct_75k
46,751
Write a Python function to compare two strings based on a custom collation order. The collation order is defined by a table and a specified collation strength. The function should return -1 if the first string comes before the second string in the custom collation order, 0 if they are equivalent, and 1 if the first str...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def compare_strings(str1: str, str2: str, table: List[int], strength: int) -> int: """ Compare two strings based on a custom collation order defined by a table and a specified collation strength. ...
magic_instruct_75k
46,763
Write a Python function to resolve a view function for a given URL path based on a list of URL patterns. Each URL pattern is a tuple containing a regular expression pattern and the corresponding view function. The function should return the view function if a matching pattern is found, otherwise it should return `None`...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List, Tuple, Optional def resolve_view_function(url_patterns: List[Tuple[str, str]], url_path: str) -> Optional[str]: """ Resolves the view function for a given URL path based on a list of URL patte...
magic_instruct_75k
46,773
Create a Python function to simulate a simple notification system that can display toast notifications with different content and actions. The function should be able to handle basic toast notifications and notifications with associated actions. The code should start with: ```python from typing import Optional class ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional class NotificationManager: """ A class to manage and display toast notifications. Methods: show_toast_notification(message: str) -> None: Display a toast notification with th...
magic_instruct_75k
46,807
Write a Python function to simulate the behavior of a `NativeFunctionManager` class that manages delegates and function pointers to handle native function calls. The function should set up a native function delegate and link it to a specific function, allowing for the invocation of the native function from managed code...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Callable, Any, Dict # Dictionary to map function names to their corresponding Python functions function_map: Dict[str, Callable] = { "add": lambda x, y: x + y, "subtract": lambda x, y: x - y, "multiply": ...
magic_instruct_75k
46,812
Write a Python function to perform a symbol table lookup. The symbol table is represented as a list of dictionaries, where each dictionary contains information about a symbol, such as its name, precedence, fixity, domain, and definition. The function should take the symbol name as input and search the symbol table for ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Optional def lookup(symbol_table: List[Dict[str, any]], name: str) -> Optional[Dict[str, any]]: """ Perform a symbol table lookup to find a record with the given symbol name. Args: sy...
magic_instruct_75k
46,826
Write a Python function to deduplicate a list of elements while preserving the original order of the elements. The function should take a list as input and return a new list with duplicate elements removed. The function should not use the `set` data structure. The code should start with: ```python from typing import L...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def deduplicate_list(input_list: List[str]) -> List[str]: """ Deduplicates a list of elements while preserving the original order. Args: input_list (List[str]): The list of elements to dedup...
magic_instruct_75k
46,848
Write a Python function to convert a given integer into its Roman numeral representation. The function should adhere to the standard rules of Roman numeral representation, where smaller symbols can be placed before larger symbols to denote subtraction. The input integer `num` will be between 1 and 3999 inclusive. The ...
Here is the Python code to solve the given problem in the markdown block: ```python def int_to_roman(num: int) -> str: """ Convert a given integer into its Roman numeral representation. Args: num (int): The integer to be converted, where 1 <= num <= 3999. Returns: str: The Roman numera...
magic_instruct_75k
46,863
Write a Python function to filter a list of integers based on a given condition. The function should take two arguments: a list of integers and a filtering function. The filtering function should accept an integer as input and return a boolean value indicating whether the integer meets the filtering condition. The func...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Callable def filter_numbers(numbers: List[int], func_filter: Callable[[int], bool]) -> List[int]: """ Filters a list of integers based on the given condition. Args: numbers: A list of integ...
magic_instruct_75k
46,876
Write a Python function to process a GCM (Google Cloud Messaging) message payload according to specific constraints and requirements. The function should take in a dictionary representing the GCM message payload and an integer representing the recipient's ID. The function should check if the payload dictionary contains...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def process_gcm_payload(data: Dict[str, any], toshi_id: int) -> Dict[str, any]: """ Processes a GCM message payload according to specific constraints and requirements. Args: data (Dict[str, ...
magic_instruct_75k
46,880
Write a Python function to automate the cleanup process on a remote server. The function should perform the following steps: 1. Use the provided authentication credentials (username and token) to authenticate and gain access to the remote server. 2. Issue a command to shut down the server. 3. Change directory to the ho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def cleanup_remote_server(username: str, token: str) -> None: """ Automates the cleanup process on a remote server. This function simulates the following steps: 1. Authenticate using the provid...
magic_instruct_75k
46,892
Write a Python function to anonymize error logs for a mentoring platform called "mentornity". The function should take a list of error logs as input and return the anonymized logs. Each error log is represented as a dictionary with the following keys: `timestamp`, `user_id`, `email`, `ip_address`, and `error_message`. ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def anonymizeErrorLogs(error_logs: List[Dict[str, str]]) -> List[Dict[str, str]]: """ Anonymizes the error logs by replacing sensitive information with placeholders. Args: error_logs (...
magic_instruct_75k
46,928
Write a Python function to generate a migration script for a hypothetical database migration tool. The migration script should take in a list of database table names and generate a migration file in the format used by Django's migration system. The migration file should include the necessary code to create the specifie...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_migration_script(table_names: List[str]) -> str: """ Generates a migration script for Django's migration system. Args: table_names (List[str]): A list of table names to be creat...
magic_instruct_75k
46,941
Write a Python function to extract the migration number and timestamp from a given file path representing a migration file in a Django project. The file path is in the format `<app_name>/migrations/<migration_number>_auto_<timestamp>.py`, where: - `<app_name>` is the name of the Django app. - `<migration_number>` is a ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Tuple def extract_migration_info(file_path: str) -> Tuple[str, str]: """ Extracts the migration number and timestamp from a given file path representing a migration file in a Django project. Args: ...
magic_instruct_75k
46,946
Write a Python function to validate whether a given string is a valid IPv4 address. An IPv4 address is a 32-bit numerical address written in the form of four octets separated by periods. Each octet can range from 0 to 255. For example, "192.168.10.10" is a valid IPv4 address. Your task is to implement the `is_ip_addres...
Here is the Python code to solve the given problem in the markdown block: ```python def is_ip_address(ip: str) -> bool: """ Validates whether the given string is a valid IPv4 address. Args: ip (str): The string to be validated as an IPv4 address. Returns: bool: True if the string is a ...
magic_instruct_75k
46,948
Write a Python function to count the number of comparisons made during the execution of the selection sort algorithm on a given list of integers. The selection sort algorithm works by repeatedly finding the minimum element from the unsorted part of the list and swapping it with the first unsorted element. The function ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_comparisons_selection_sort(input_list: List[int]) -> int: """ Counts the number of comparisons made during the execution of the selection sort algorithm on the input list. Args: in...
magic_instruct_75k
46,952
Write a Python function to retrieve all itineraries for a given destination from a travel agency's database. The database is represented as a dictionary where each key is a destination and the value is a list of itineraries for that destination. The function should return an empty list if the destination is not found i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def get_itineraries(destination: str, database: Dict[str, List[str]]) -> List[str]: """ Retrieves all itineraries for a given destination from the travel agency's database. Args: desti...
magic_instruct_75k
46,964
Write a Python function to find the longest common subsequence (LCS) between two given strings. The function should return the length of the LCS. The code should start with: ```python def longest_common_subsequence(str1: str, str2: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def longest_common_subsequence(str1: str, str2: str) -> int: """ Calculate the length of the longest common subsequence (LCS) between two strings. Args: str1 (str): The first string. str2 (str): The second s...
magic_instruct_75k
46,984
Write a Python function to filter out notes that contain a specific keyword from a list of notes. Each note is represented as a tuple where the first element is a timestamp (integer) and the second element is the note content (string). The function should return a new list of notes that do not contain the keyword. The ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def filter_notes(notes: List[Tuple[int, str]], keyword: str) -> List[Tuple[int, str]]: """ Filters out notes that contain a specific keyword from a list of notes. Args: notes (List[Tu...
magic_instruct_75k
46,992
Write a Python function to find the highest score from a given list of scores. If the list is empty, the function should return 0. The function should be efficient and handle edge cases appropriately. The code should start with: ```python from typing import List def highest_score(scores: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def highest_score(scores: List[int]) -> int: """ Find the highest score from a given list of scores. Args: scores (List[int]): A list of integers representing the scores. Returns: ...
magic_instruct_75k
47,008
Write a Python function to convert a binary number represented as a list of integers (each integer being either 0 or 1) to its decimal equivalent. The function should start with: ```python from typing import List def binary_to_decimal(binary_list: List[int]) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def binary_to_decimal(binary_list: List[int]) -> int: """ Converts a binary number represented as a list of integers to its decimal equivalent. Args: binary_list (List[int]): A list of integ...
magic_instruct_75k
47,016
Write a Python function to determine the request type based on the input JSON data. The request type can be one of the following: `NODES_POST`, `NODES_DELETE`, `NODES_GET`, `NODES_PUT_START`, or `NODES_PUT_END`. The input JSON data is represented as a dictionary, where each dictionary contains information about a speci...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def make_req_type(json_data: Dict) -> str: """ Determine the request type based on the input JSON data. Args: json_data (Dict): A dictionary representing the JSON data containing information...
magic_instruct_75k
47,019
Write a Python function to automate the build process for a software project. The function should perform the following actions: 1. Change the directory to a specified path. 2. Execute the `make` command with the `-f` option to specify the makefile path and the `all` target to build all components. The function should...
Here is the Python code to solve the given problem in the markdown block: ```python import os import subprocess def build_project(directory: str, makefile_path: str) -> None: """ Automates the build process for a software project by changing the directory to the specified path and executing the `make` comm...
magic_instruct_75k
47,021
Write a Python function to extract the `objectUri` from a dataset represented as a list of dictionaries, given a specific concept label. Each dictionary in the dataset contains keys such as 'label', 'definitie', and 'objectUri', among others. If the concept label is not found in the dataset, the function should return ...
Here is the Python code to solve the given problem in the markdown block: ```python def get_object_uri(dataset: list, concept_label: str) -> str: """ Extracts the 'objectUri' from a dataset based on a given concept label. Args: dataset (list): A list of dictionaries where each dictionary contains i...
magic_instruct_75k
47,027
Write a Python function to calculate the future date by adding a specified number of days to the current date. The function should use the `datetime` module to perform this calculation and return the future date as a string in the format 'YYYY-MM-DD'. The code should start with: ```python import datetime def calculat...
Here is the Python code to solve the given problem in the markdown block: ```python import datetime def calculate_future_date(day: int) -> str: """ Calculate the future date by adding a specified number of days to the current date. Args: day (int): The number of days to add to the current date. ...
magic_instruct_75k
47,029
Write a Python function to find the longest common subsequence (LCS) of two given strings. The function should return the length of the LCS. The code should start with: ```python from typing import List def longest_common_subsequence(str1: str, str2: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: : ```python from typing import List def longest_common_subsequence(str1: str, str2: str) -> int: """ Calculate the length of the longest common subsequence (LCS) of two strings. Args: str1 (str): The first string. st...
magic_instruct_75k
47,038
Write a Python function to format a given number of seconds into a human-readable time format. The function should take an integer representing the number of seconds and return a string in the format "HH:MM:SS". The function should handle cases where the input number of seconds exceeds 24 hours (86400 seconds). If the ...
Here is the Python code to solve the given problem in the markdown block: ```python def format_time(seconds: int) -> str: """ Formats a given number of seconds into a human-readable time format "HH:MM:SS". Args: seconds (int): The number of seconds to format. Returns: str: A string rep...
magic_instruct_75k
47,046
Write a Python function to analyze a list of PostgreSQL account data and return a summary of the accounts based on certain criteria. The function should take a list of dictionaries as input, where each dictionary represents an account with keys 'username', 'password', 'last_login', and 'is_admin'. The function should t...
Here is the Python code to solve the given problem in the markdown block: ```python def analyze_postgresql_accounts(accounts: list) -> dict: """ Analyzes a list of PostgreSQL account data and returns a summary of the accounts. Args: accounts (list): A list of dictionaries, where each dictionary rep...
magic_instruct_75k
47,068
Write a Python function to manipulate a set of words based on a given pattern. The pattern consists of integers and placeholders, where each placeholder represents the position of a word in the input set. The function should construct a string by replacing the placeholders with the corresponding words from the input se...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def manipulate_words(words: str, pattern: str) -> str: """ Manipulates a set of words based on a given pattern and appends "?!?" to the resulting string. Args: words (str): A space-separated...
magic_instruct_75k
47,115
Write a Python function to process a dictionary representing a database schema and return a list of tables along with their fields. The input dictionary follows a specific format where the keys represent table names and the values are dictionaries representing the fields of each table. Each field dictionary contains th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def extract_tables_and_fields(schema_dict: Dict[str, Dict[str, Tuple]]) -> List[Tuple[str, List[str]]]: """ Extracts tables and their fields from a given database schema dictionary. Arg...
magic_instruct_75k
47,151
Write a Python function `get_dynamodb_table_url` that takes a string `table_name` as input and returns the full URL for accessing the specified table on the DynamoDB server. The function should use the `DYNAMODB_HOST` variable to construct the URL. The `DYNAMODB_HOST` variable is predefined and holds the URL of the Dyn...
Here is the Python code to solve the given problem in the markdown block: ```python def get_dynamodb_table_url(table_name: str) -> str: """ Constructs and returns the full URL for accessing a specified table on the DynamoDB server. Args: table_name (str): The name of the table to access. It must be...
magic_instruct_75k
47,165
Write a Python function to categorize a list of integers representing population growth rates into three groups: positive growth rates, negative growth rates, and zero growth rates. The function should return a tuple containing three lists: one for positive growth rates, one for negative growth rates, and one for zero ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def categorize_growth_rates(population_growth: List[int]) -> Tuple[List[int], List[int], List[int]]: """ Categorizes a list of population growth rates into positive, negative, and zero growth rate...
magic_instruct_75k
47,167
Write a Python function `reverseFraction` that takes in two parameters: `x` (a floating-point number) and `n` (an integer). The function should reverse the fraction `x` and then multiply the result by `-n`. The function should return the result as a floating-point number. The code should start with: ```python def reve...
Here is the Python code to solve the given problem in the markdown block: ```python def reverseFraction(x: float, n: int) -> float: """ Reverses the fraction `x` and then multiplies the result by `-n`. Args: x (float): The floating-point number whose fraction is to be reversed. n (int): The...
magic_instruct_75k
47,186
Write a Python function to generate a series of commands for a simplified web testing framework. The function should take a list of page sizes and generate commands to visit different help pages and capture snapshots using Percy, a visual testing platform. The function should follow these rules: - For each page size i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generateTestCommands(page_sizes: List[int]) -> str: """ Generates a series of commands for a web testing framework to visit help pages and capture snapshots. Args: page_sizes (List[int])...
magic_instruct_75k
47,192
Write a Python function to normalize an array of numbers using the min-max normalization technique. The function should take an array of floating-point numbers as input and return a new array with the normalized values. The normalized values should be scaled to a range between 0 and 1, inclusive. The function should s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def min_max_normalize(arr: List[float]) -> List[float]: """ Normalizes the input array of floating-point numbers using the min-max normalization technique. The min-max normalization scales the value...
magic_instruct_75k
47,212
Write a Python function to process user input for a zoom feature in a graphics application. The function should take three parameters: `width`, `height`, and `zoom`. The `width` and `height` parameters represent the dimensions of the graphics, and the `zoom` parameter represents the level of zoom requested by the user....
Here is the Python code to solve the given problem in the markdown block: ```python def process_zoom(width: str, height: str, zoom: str) -> int: """ Processes user input for a zoom feature in a graphics application. Args: width (str): The width of the graphics as a string. height (str): The...
magic_instruct_75k
47,224
Write a Python function to update a QoS (Quality of Service) specification in a backend system. The function should take the existing QoS specifications, a key, and a new value, and update the specifications with the new key-value pair. If the key already exists in the specifications, its value should be updated with t...
Here is the Python code to solve the given problem in the markdown block: ```python def update_qos_spec(specs: dict, key: str, value: str) -> dict: """ Updates the QoS specifications with a new key-value pair. Args: specs (dict): The existing QoS specifications as a dictionary where keys and values...
magic_instruct_75k
47,237
Write a Python function to process genetic variant data and generate a summary report. The function should take a list of variant objects and produce a list of dictionaries containing information about each variant that meets certain criteria. Each variant object has attributes `CHROM` (chromosome), `POS` (position), a...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_variant_summary(variants: List[Dict[str, str]], sample_name: str, group: str) -> List[Dict[str, str]]: """ Generate a summary report of genetic variants that meet certain criteria. ...
magic_instruct_75k
47,255
Write a Python function to convert a custom location object to a Protocol Buffers Format (PBF) representation. The custom location object, `PathLocation`, contains information about a geographical point and its associated edges. The edges represent connections to other points in the geographical network. The function `...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple class PathLocation: def __init__(self, point: Tuple[float, float], edges: List[Tuple[int, float]], filtered_edges: List[Tuple[int, float]]): self.point = point self.edges = edges ...
magic_instruct_75k
47,256
Write a Python function to generate a secure random secret key of a specified length. The secret key should be a string consisting of random characters chosen from a set of allowed characters, which includes uppercase and lowercase letters, digits, and punctuation. The function should be able to handle different length...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random import string def generate_secret_key(length: int) -> str: """ Generates a secure random secret key of the specified length. The secret key is a string consisting of random characters ...
magic_instruct_75k
47,265
Implement a Python function that calculates the total number of unique paths from the top-left corner to the bottom-right corner of an m x n grid. The only moves allowed are moving right or down. The function should start with: ```python from typing import List def unique_paths(m: int, n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def unique_paths(m: int, n: int) -> int: """ Calculate the number of unique paths from the top-left corner to the bottom-right corner of an m x n grid. Args: m (int): The number of rows ...
magic_instruct_75k
47,266
Write a Python function to calculate the number of steps required to create a grid of zero point (ZP) offsets for astronomical images. The grid is determined by the maximum ZP offset (`maxoff`) and the increment size for ZP offsets (`stepSize`). The number of steps is calculated using the formula: ``` nsteps = round(((...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_nsteps(maxoff: float, stepSize: float) -> int: """ Calculate the number of steps required to create a grid of zero point (ZP) offsets for astronomical images. The number of steps is determined by the formula: ...
magic_instruct_75k
47,268
Write a Python function to filter a list of JSON Web Keys (JWKs) based on a specified key type. Each JWK is represented as a dictionary with a "kty" key indicating the key type. The function should return a new list containing only the JWKs that match the specified key type. The function signature is: ```python from t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Any def filter_jwks_by_key_type(jwks: List[Dict[str, Any]], key_type: str) -> List[Dict[str, Any]]: """ Filters a list of JSON Web Keys (JWKs) based on a specified key type. Args: jwk...
magic_instruct_75k
47,275
Create a Python class `Item` that represents an item in an inventory management system. The class should have the following methods: 1. `is_integer()`: This method should return `True` if the value of the item is an integer, and `False` otherwise. 2. `instantiate_from_something(source)`: This method should take a param...
Here is the Python code to solve the given problem in the markdown block: ```python class Item: def __init__(self): """ Initialize the Item with a value set to None. """ self.value = None def is_integer(self): """ Check if the value of the item is an integer. ...
magic_instruct_75k
47,317
Write a Python function that converts a list of tuples into a dictionary. Each tuple in the list contains two strings, where the first string is the key and the second string is the value. If there are duplicate keys in the list, the corresponding values should be concatenated into a single string, separated by a comma...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def tuple_list_to_dict(tuple_list: List[Tuple[str, str]]) -> Dict[str, str]: """ Converts a list of tuples into a dictionary where each tuple represents a key-value pair. If there are du...
magic_instruct_75k
47,332
Write a Python function to generate build instructions for a custom build system. The function should take three parameters: `inputs`, `tools`, and `outputs`, and return a string representing the build instructions in a specific format. The build instructions should be formatted as a call to the `dotnet.actions.run` fu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_build_instructions(inputs: List[str], tools: List[str], outputs: List[str]) -> str: """ Generates build instructions for a custom build system. Args: inputs (List[str]): A list ...
magic_instruct_75k
47,348
Write a Python function to process the results of a voting system and identify proposals that have received "0" votes, indicating they were closed too recently to gather any votes. The function should return a list of proposal IDs that should be discarded. The input is a list of tuples, where each tuple represents a p...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def discard_recently_closed_proposals(vote_results: List[Tuple[str, int]]) -> List[str]: """ Process the results of a voting system and identify proposals that have received "0" votes, indicat...
magic_instruct_75k
47,353
Create a Python class `DNSManager` that simulates a simplified DNS (Domain Name System) management system. The class should allow users to create a new domain, add records to the domain, edit existing records, and query the database to retrieve information about the records. The class should have the following methods:...
Here is the Python code to solve the given problem in the markdown block: ```python class DNSManager: def __init__(self): """ Initialize the DNSManager with an empty database. """ self.database = {} def create_domain(self, domain_name): """ Create a new domain wi...
magic_instruct_75k
47,356
Write a Python function to automate the deployment process for a web application. The deployment process involves running two commands: `yarn build` to build the application and `yarn start` to start the application. The function should execute these commands in sequence and handle any errors that may occur during the ...
Here is the Python code to solve the given problem in the markdown block: ```python import subprocess import logging def deploy_web_app() -> bool: """ Automates the deployment process for a web application by running the `yarn build` and `yarn start` commands. Returns: bool: True if both commands ...
magic_instruct_75k
47,371
Write a Python function to find the parent node of a given target node in a tree structure represented by a dictionary. The dictionary contains nodes as keys and their parent nodes as values. If the target node is not found in the tree or if it is the root node, the function should return `None`. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python def find_parent(tree: dict, target: str) -> str: """ Find the parent node of a given target node in a tree structure represented by a dictionary. Args: tree (dict): A dictionary representing the tree structure where...
magic_instruct_75k
47,375
Write a Python function to extract skip directives and their associated reason codes from a list of source code lines. The skip directives are denoted by specific patterns in comments and are followed by a reason code. The function should use a predefined regular expression pattern to identify these skip directives and...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List, Dict def extract_skip_directives(lines: List[str]) -> Dict[str, List[str]]: """ Extracts skip directives and their associated reason codes from a list of source code lines. Args: ...
magic_instruct_75k
47,377
Write a Python function to generate a corresponding SQL INSERT statement from a given SQL SELECT statement. The input SELECT statement will always be in the form of `SELECT column1, column2, ... FROM table_name WHERE condition;`. The generated INSERT statement should insert the selected columns' values into a specified...
Here is the Python code to solve the given problem in the markdown block: ```python def generateInsertQuery(select_query: str, target_table: str) -> str: """ Generates an SQL INSERT statement from a given SQL SELECT statement. Args: select_query (str): A well-formed SQL SELECT query in the format: ...
magic_instruct_75k
47,389
Write a Python function called `analyze_dependencies` that takes a list of dependencies and a dictionary of extras_require as input. The function should determine the total number of unique dependencies and the total number of unique extras_require across all the packages. The function should return a tuple containing ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Tuple def analyze_dependencies(dependencies: List[str], extras_require: Dict[str, List[str]]) -> Tuple[int, int]: """ Analyzes the given list of dependencies and dictionary of extras_require to de...
magic_instruct_75k
47,397
Write a Python function to convert and write landmark data from an ITK format to a Slicer3 format. The function should take two parameters: `output_landmark_file`, which is the file path where the landmark data will be written, and `lmks_map`, which is a dictionary containing the landmark data. The Slicer3 format for l...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def write_itk_to_slicer3_lmk(output_landmark_file: str, lmks_map: Dict[str, List[float]]) -> None: """ Converts and writes landmark data from an ITK format to a Slicer3 format. Args: o...
magic_instruct_75k
47,404
Write a Python function to process a list of dictionaries representing training arguments for a machine learning model. The function should perform the following tasks: 1. Add a key-value pair to each dictionary with the key "model_type" and the value "neural network". 2. Remove any dictionaries that do not contain the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def process_training_arguments(training_args_list: List[Dict[str, any]]) -> List[Dict[str, any]]: """ Processes a list of dictionaries representing training arguments for a machine learning model. ...
magic_instruct_75k
47,451
Write a Python function to count the occurrences of different types of chemical reactions from a list of reaction descriptions. Each reaction description follows the format "rxn__{type}__gt", where {type} is a placeholder for the specific type of reaction. The function should return a dictionary where the keys are the ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_reaction_types(reaction_descriptions: List[str]) -> Dict[str, int]: """ Counts the occurrences of different types of chemical reactions from a list of reaction descriptions. Args: ...
magic_instruct_75k
47,461
Write a Python function to manage dependencies in a software system using globally unique identifiers (GUIDs). The function should allow for the registration and retrieval of dependencies between different modules. The dependencies are represented as a dictionary where each key is a module name and each value is a list...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Optional def register_module(dependencies: Dict[str, List[str]], module_name: str, module_dependencies: List[str]) -> None: """ Register a new module with its dependencies. Args: depe...
magic_instruct_75k
47,464
Write a Python function to find the length of the longest common substring between two given strings `a` and `b`. A common substring is a sequence of characters that appears in both strings without changing the order of characters. The function should return the length of this longest common substring. The code should...
Here is the Python code to solve the given problem in the markdown block: ```python def longest_common_substring(a: str, b: str) -> int: """ Find the length of the longest common substring between two strings `a` and `b`. Args: a (str): The first string. b (str): The second string. Ret...
magic_instruct_75k
47,472
Write a Python function to sort a dictionary of log levels and their corresponding colors based on the RGB values of the colors. If two colors have the same RGB values, they should be sorted alphabetically by their log level names. The function should return a new dictionary with the sorted entries. The code should st...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Tuple def sort_colors(log_colors: Dict[str, Tuple[int, int, int]]) -> Dict[str, Tuple[int, int, int]]: """ Sorts a dictionary of log levels and their corresponding colors based on the RGB values of the ...
magic_instruct_75k
47,474
Write a Python function to count the number of elements in a given list that are greater than a specified threshold. The function should take two parameters: a list of integers and an integer threshold. The function should return an integer representing the count of elements in the list that are greater than the thresh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_elements_greater_than_threshold(arr: List[int], threshold: int) -> int: """ Counts the number of elements in the given list that are greater than the specified threshold. Args: arr...
magic_instruct_75k
47,491
Write a Python function to count the number of unique major versions from a list of strings representing programming language classifiers. Each string in the list follows the format "Programming Language :: Language Name :: Major Version", where the major version is an integer. The function should ignore any invalid or...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_unique_major_versions(classifiers: List[str]) -> int: """ Counts the number of unique major versions from a list of programming language classifiers. Args: classifiers (List[str]):...
magic_instruct_75k
47,510
Write a Python function to generate a random bunny name from a given list of names. The function should take the list of names as input and return a randomly selected name from the list. The function should ensure that it returns a valid bunny name each time it is called. The code should start with: ```python from typ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def random_bunny_name(names: List[str]) -> str: """ Generates a random bunny name from a given list of names. Args: names (List[str]): A list of bunny names from which to selec...
magic_instruct_75k
47,524
Write a Python function to find the median of a given list of integers and split the list into two sublists based on the median. The function should return a tuple containing the two sublists. If the length of the list is odd, the median should be the middle element; if the length is even, the median should be the aver...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def split_list_median(qs: List[int]) -> Tuple[List[int], List[int]]: """ Splits the given list into two sublists based on the median of the list. Args: qs (List[int]): The list of int...
magic_instruct_75k
47,527
Write a Python function to count the number of occurrences of the integer `1` in a given list of integers. The function should take a list of integers as input and return the count of elements equal to `1`. Additionally, provide a way to process a given list and print the count of occurrences of `1` in the list. The c...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_ones(input_list: List[int]) -> int: """ Counts the number of occurrences of the integer 1 in the given list. Args: input_list (List[int]): The list of integers in which to count th...