source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
magic_instruct_75k
42,413
Write a Python function to generate a command string for executing a training script with specified hyperparameters for a sequence-to-sequence model in natural language processing (NLP). The function should take in the hyperparameters and format them into a command string that can be executed in the terminal. The func...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_training_command(hidden_dim: int, num_heads: int, num_encoder_layers: int, num_decoder_layers: int, dropout_p: float, rnn_type: str) -> str: """ Generates a command string to execute a training script with the speci...
magic_instruct_75k
42,427
Implement a simplified version of a publisher-subscriber pattern in Python. The publisher, `LocationManager`, is responsible for sending location updates to its subscribers. Your goal is to create a `Subscriber` protocol (using a Python abstract base class) and a `LocationSubscriber` class that conforms to this protoco...
Here is the Python code to solve the given problem in the markdown block: ```python from abc import ABC, abstractmethod from typing import List class Subscriber(ABC): """ Abstract base class for subscribers that receive location updates. Methods: receive(location_update: str) -> None: Abstract met...
magic_instruct_75k
42,436
Write a Python function to extract and return all the comments from a given list of strings representing a source code file. Each comment starts with the characters `#` or `//` and may span multiple lines. The function should handle both single-line and multi-line comments. The code should start with: ```python from t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_comments(code: List[str]) -> List[str]: """ Extracts and returns all the comments from a given list of strings representing a source code file. Args: code (List[str]): A list of ...
magic_instruct_75k
42,455
Write a Python function to generate an import statement for an external library in a build configuration file using a custom DSL. The function should take the following parameters: - `name` (string): The name of the external library. - `artifact` (string): The artifact identifier of the library in the format `groupId:a...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_import_statement(name: str, artifact: str, artifact_sha256: str, srcjar_sha256: str, excludes: list) -> str: """ Generates an import statement for an external library in a build configuration file using a custom DSL...
magic_instruct_75k
42,459
Write a Python function to automate system configuration tasks by performing the following actions: 1. Disable SELinux by changing the configuration in `/etc/selinux/config` from `SELINUX=enforcing` to `SELINUX=permissive`. 2. Comment out any lines related to swap in the `/etc/fstab` file by prefixing them with a `#`. ...
Here is the Python code to solve the given problem in the markdown block: ```python import os import tempfile def configure_system(): """ Automates system configuration tasks by disabling SELinux and commenting out swap lines in /etc/fstab. This function performs the following actions: 1. Disables SEL...
magic_instruct_75k
42,461
Create a Python class `Character` that represents a character in a role-playing game. The character can consume different types of food to gain abilities. Each food item has a specific ability associated with it, and consuming the food grants the character certain attributes and effects. The `Character` class should ha...
Here is the Python code to solve the given problem in the markdown block: ```python class Character: def __init__(self): """ Initialize a Character with default attributes. """ self.attack = 0 self.health = 0 self.effect = "" def consume_food(self, name): ...
magic_instruct_75k
42,471
Write a Python function to validate a given duration string against a predefined list of allowed duration values. The duration string is represented in the format "PnYnMnDTnHnMnS", where: - `P` indicates the period. - `nY` represents the number of years. - `nM` represents the number of months. - `nD` represents the num...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def validate_duration(duration: str, allowed_durations: List[str]) -> bool: """ Validates a given duration string against a predefined list of allowed duration values. Args: durati...
magic_instruct_75k
42,473
Write a Python function to extract the top-level domain (TLD) from each domain name in a given list of domain names. The TLD is the last part of the domain, following the last dot (e.g., ".com", ".net", ".org"). The input list may contain duplicate domain names, and the order of the domain names should be preserved in ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def extract_tld(domains: List[str]) -> List[str]: """ Extracts the top-level domain (TLD) from each domain name in the given list. Args: domains (List[str]): A list of domain names. Ret...
magic_instruct_75k
42,474
Write a Python function to count the number of occurrences of the pattern '00' within a given string. The function should take a string `expression` as input and return the count of combinations of the pattern '00' within the string. The code should start with: ```python def count_pattern_combinations(expression: str)...
Here is the Python code to solve the given problem in the markdown block: ```python def count_pattern_combinations(expression: str) -> int: """ Counts the number of occurrences of the pattern '00' within the given string. Args: expression (str): The input string in which to search for the pattern '...
magic_instruct_75k
42,481
Write a Python function to perform a Caesar cipher encryption on a given message. The Caesar cipher is a simple encryption technique where each letter in the plaintext is shifted a certain number of places down or up the alphabet. For example, with a shift of 3, 'A' would be replaced by 'D', 'B' would become 'E', and s...
Here is the Python code to solve the given problem in the markdown block: ```python def caesar_cipher(message: str, shift: int) -> str: """ Encrypts a message using the Caesar cipher technique. Args: message (str): The plaintext message to be encrypted. shift (int): The number of positions ...
magic_instruct_75k
42,484
Write a Python function `create_raw_socket` that simulates the creation of a raw socket for either IPv4 or IPv6 based on the command-line arguments provided. The function should handle the following cases: - If no command-line argument is provided, the default socket family should be IPv4. - If the command-line argumen...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def create_raw_socket(args: List[str]) -> str: """ Simulates the creation of a raw socket for either IPv4 or IPv6 based on the command-line arguments provided. Args: args (List[str]): A list...
magic_instruct_75k
42,485
Write a Python function to aggregate and pool results across different categories from a list of dictionaries. Each dictionary represents the results from a single recording and contains keys for "cell_type", "condition", "seal_resistance", and "firing_rate". The function should calculate the average seal resistance an...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union, Tuple def pool_results(results: List[Dict[str, Union[str, float]]]) -> Dict[Tuple[str, str], Dict[str, float]]: """ Aggregates and pools results across different categories from a list of d...
magic_instruct_75k
42,488
Write a Python function to find the maximum difference between any two elements in a given stream of integers. If the stream contains less than two elements, the function should return 0. The function should be efficient and should handle large streams of data. The code should start with: ```python from typing import ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_difference_in_stream(stream: List[int]) -> int: """ Find the maximum difference between any two elements in a given stream of integers. Args: stream (List[int]): A list of integers r...
magic_instruct_75k
42,489
Write a Python function to filter and sort a list of strings, ensuring that only unique strings are included in the result. The function should ignore any leading colon (`:`) in the strings and consider case sensitivity when determining uniqueness. The final list should be sorted in ascending order. The function shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def get_unique_sorted_strings(input_list: List[str]) -> List[str]: """ Filters and sorts a list of strings, ensuring only unique strings are included. Leading colons (`:`) are ignored, and case sensi...
magic_instruct_75k
42,544
Write a Python function to perform various file and process-related operations. The function should include the following functionalities: 1. A function `find_files` that takes a search pattern as an argument and uses the `os` and `fnmatch` modules to locate files in the current directory (and its subdirectories) whos...
Here is the Python code to solve the given problem in the markdown block: ```python import os import fnmatch import re import socket def find_files(pattern: str): """ Locate files in the current directory (and its subdirectories) whose names match the search pattern in a case-insensitive manner. Args: ...
magic_instruct_75k
42,559
Write a Python function to generate an HTML table from a collection of "ahok" objects. Each "ahok" object contains information about a message, including the sender's name, message text, and a unique identifier. The function should take this collection of "ahok" objects and return a string containing the HTML code for ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_ahok_table(ahok_collection: List[Dict[str, str]]) -> str: """ Generates an HTML table from a collection of "ahok" objects. Args: ahok_collection (List[Dict[str, str]]): A ...
magic_instruct_75k
42,571
Write a Python function named `extract_metadata` that parses a dictionary containing metadata for a web API and extracts specific information from it. The metadata dictionary contains various key-value pairs, and your function needs to extract the values associated with the keys 'long_description_content_type' and 'url...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Union, Tuple def extract_metadata(metadata: dict) -> Union[str, Tuple[str, str]]: """ Extracts specific information from a metadata dictionary. This function parses a dictionary containing metadata for a...
magic_instruct_75k
42,577
Write a Python function to generate SQL index creation statements for a given table and a list of columns. The function should take the table name and a list of column names as input and return a list of SQL index creation statements for each column. Each SQL statement should follow the format: ``` CREATE INDEX IF NOT ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_index_creation_statements(table_name: str, columns: List[str]) -> List[str]: """ Generates SQL index creation statements for a given table and a list of columns. Args: table_nam...
magic_instruct_75k
42,589
Implement a URL shortening service that generates unique short URLs for given long URLs and stores the mappings in a database table. The service should also be able to retrieve the original long URL when given a short URL and its associated domain ID. The database table structure is as follows: - Table Name: `minify_u...
Here is the Python code to solve the given problem in the markdown block: ```python import random import string from typing import Dict, Optional # Simulated database table minify_urlminify: Dict[str, Dict[int, str]] = {} def generate_short_url(long_url: str, domain_id: int) -> str: """ Generates a unique sho...
magic_instruct_75k
42,602
Write a Python function to correct and complete the given code snippet. The snippet contains some variable assignments and comments that need to be analyzed and corrected. The corrected code should be syntactically correct, and the comments should accurately describe the variable assignments. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: ```python def correct_code_snippet(LR, CD_n): """ Corrects and completes the given code snippet. Args: LR: The value to be assigned to the variable LR. CD_n: The value to be assigned to the variable t.W.CD_n. Ret...
magic_instruct_75k
42,636
Write a Python function to count the occurrences of each place in a given list of places, considering both exact matches and partial matches. If `exact_match` is `True`, only exact matches should be counted. If `exact_match` is `False`, partial matches should also be counted. The function should return a dictionary whe...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_places(places: List[str], exact_match: bool) -> Dict[str, int]: """ Counts the occurrences of each place in the given list, considering both exact and partial matches. Args: ...
magic_instruct_75k
42,641
Write a Python function called `apply_operation` that takes two arguments: `data` and `operation`. The `data` argument can be of any type (integer, float, string, list, etc.), and the `operation` argument will be a function that defines the operation to be performed on the `data`. The `apply_operation` function should ...
Here is the Python code to solve the given problem in the markdown block: ```python def apply_operation(data, operation): """ Applies the given operation to the data and returns the result. Args: data: Any type of data (integer, float, string, list, etc.). operation: A function that defines...
magic_instruct_75k
42,648
Implement a Python class `RelationManager` that manages relations between different entities. The class should support adding new relation types and creating relations between entities of those types. Each relation type can have multiple relations between different entities. The class should have the following functio...
Here is the Python code to solve the given problem in the markdown block: ```python class RelationManager: def __init__(self): """ Initialize the RelationManager with empty relation_types and relations. """ self.relation_types = {} self.relations = [] def add_relation_ty...
magic_instruct_75k
42,654
Write a Python function called `find_first` that takes in three parameters: 1. `collection`: A list of elements. 2. `condition`: A lambda function that takes an element from the collection and returns a boolean value based on a specific condition. 3. `default`: A default value to return if no element in the collection ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Callable, Any def find_first(collection: List[Any], condition: Callable[[Any], bool], default: Any) -> Any: """ Finds the first element in the collection that satisfies the given condition. Args: ...
magic_instruct_75k
42,658
Write a Python function to extract the condition used in the `#ifndef` and `#define` directives from a given C++ header file snippet. The function should take a string representing the header file content as input and return the condition as a string. The code should start with: ```python def extract_ifndef_define_con...
Here is the Python code to solve the given problem in the markdown block: ```python import re def extract_ifndef_define_condition(header_content: str) -> str: """ Extracts the condition used in the `#ifndef` and `#define` directives from a given C++ header file snippet. Args: header_content (str):...
magic_instruct_75k
42,669
Write a Python function `dekode` that decodes a list of integers based on a specific pattern represented by a tuple `prot_pat`. The function should construct a dictionary from the input list according to the decoding algorithm described below. The decoding algorithm involves: 1. Initializing an empty dictionary `out`....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Tuple def dekode(li: List[int], prot_pat: Tuple[int, int, int, int]) -> Dict[int, int]: """ Decodes a list of integers into a dictionary based on a specific pattern. Args: li (List[in...
magic_instruct_75k
42,695
Write a Python function to determine if a player can win all the games given a list of integers representing the scores of a series of games. The player can win a game if their score is strictly greater than the opponent's score. If it is possible for the player to win all the games, return "YES"; otherwise, return "NO...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def can_win_all_games(scores: List[int]) -> str: """ Determine if a player can win all the games given a list of scores. Args: scores (List[int]): A list of integers representing the scores ...
magic_instruct_75k
42,704
Write a Python function to generate Azure CLI commands for managing locks on a keyspace and a table within an Azure Cosmos DB account. The function should take the lock type, keyspace name, table name, and account name as input and return the corresponding Azure CLI commands to create the locks. The lock types can be e...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_lock_commands(lock_type: str, keyspace_name: str, table_name: str, account_name: str) -> tuple: """ Generates Azure CLI commands to create locks on a keyspace and a table within an Azure Cosmos DB account. Args...
magic_instruct_75k
42,731
Write a Python function to filter device report entries based on a given partitioned table name. Each entry in the report is represented as a tuple containing a device ID, a table name, and some data. The function should return a new list containing only the entries that match the specified partitioned table name. The...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def filter_device_report_entries(entries: List[Tuple[str, str, str]], partitioned_table: str) -> List[Tuple[str, str, str]]: """ Filters the device report entries based on the specified partitione...
magic_instruct_75k
42,740
Write a Python function to determine the source label of a product based on a given product source label and predefined sets of analytical and production sources. The function should return the corresponding source label if the product source label is found in either the analytical or production sources. If the product...
Here is the Python code to solve the given problem in the markdown block: ```python def determine_source_label(prodsourcelabel: str, analy_sources: set, prod_sources: set, ANALY_PS: str, PROD_PS: str) -> str: """ Determine the source label of a product based on the given product source label and predefined sets...
magic_instruct_75k
42,748
Write a Python function to calculate the average of a list of floating-point numbers and round the result to a specified number of decimal places. The function should handle lists with at least one element and ensure that the number of decimal places is a non-negative integer. The code should start with: ```python fro...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_rounded_average(numbers: List[float], decimal_places: int) -> float: """ Calculate the average of a list of floating-point numbers and round the result to a specified number of decimal plac...
magic_instruct_75k
42,765
Write a Python function to determine if a given string contains at least one uppercase letter, one lowercase letter, and one digit. The function should return `True` if all three types of characters are present, and `False` otherwise. The code should start with: ```python def check_string_characters(s: str) -> bool: `...
Here is the Python code to solve the given problem in the markdown block: ```python def check_string_characters(s: str) -> bool: """ Determine if the given string contains at least one uppercase letter, one lowercase letter, and one digit. Args: s (str): The input string to be checked. Returns...
magic_instruct_75k
42,775
Write a Python function to calculate the total amount spent and earned from a list of transactions. Each transaction is represented as a dictionary with keys "type" (either "spend" or "earn") and "amount" (a positive integer). The function should return a dictionary with the total amount spent and earned. If there are ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def calculate_summary(transactions: List[Dict[str, int]]) -> Dict[str, int]: """ Calculate the total amount spent and earned from a list of transactions. Args: transactions (List[Dict[...
magic_instruct_75k
42,782
Write a Python function to reverse a singly-linked list. The function should take the head of the linked list as input and return the head of the reversed linked list. The function should run in O(n) time complexity and use O(1) additional space. The code should start with: ```python class ListNode: def __init__(s...
Here is the Python code to solve the given problem in the markdown block: ```python class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def reverse_linked_list(head: ListNode) -> ListNode: """ Reverses a singly-linked list and returns the head of the revers...
magic_instruct_75k
42,809
Write a Python function to retrieve the names of all zone end elements from a power distribution system simulation tool. The function should call a predefined function `Bridge.var_array_function` with specific parameters to retrieve the required information and return the names as a variant array. The code should star...
Here is the Python code to solve the given problem in the markdown block: ```python import ctypes def meters_all_end_elements(dss_obj): """ Retrieves the names of all zone end elements from the power distribution system simulation tool. Args: dss_obj: An object representing the power distribution ...
magic_instruct_75k
42,824
Write a Python function to clamp a given number within a specified range. The function should take three parameters: `min_val`, `number`, and `max_val`. It should return the value of `number` clamped within the range of `min_val` and `max_val`. Specifically, the function should return `min_val` if `number` is less than...
Here is the Python code to solve the given problem in the markdown block: ```python def math_clamp(min_val: int, number: int, max_val: int) -> int: """ Clamps the given number within the specified range [min_val, max_val]. Args: min_val (int): The minimum value of the range. number (int): T...
magic_instruct_75k
42,827
Write a Python function to extract a mapping of view names to their corresponding URL patterns from a list of URL patterns. Each URL pattern is represented as a string in the format `url(regex_pattern, view, name='view_name')`. The view name is enclosed in single quotes and follows the `name=` parameter. The function ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict import re def extract_view_mapping(url_patterns: List[str]) -> Dict[str, str]: """ Extracts a mapping of view names to their corresponding URL patterns from a list of URL patterns. Args: ...
magic_instruct_75k
42,850
Write a Python function to calculate the number of warm-up steps for training a machine learning model. The warm-up steps are determined by the total number of training steps and a specified proportion of these steps dedicated to the warm-up phase. The function should round up the number of warm-up steps to the nearest...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Any import math def calculate_warmup_steps(train_dataloader: Any, num_epochs: int, warmup_proportion: float) -> int: """ Calculate the number of warm-up steps for training a machine learning model. Args:...
magic_instruct_75k
42,888
Write a Python function to extract specific key-value pairs from a given dictionary based on a mapping dictionary. The function should return a new dictionary containing only the key-value pairs specified in the mapping dictionary. If a key specified in the mapping dictionary is not present in the source dictionary, th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def extract_dict_values(source_dict: Dict[str, any], to_extract: Dict[str, str]) -> Dict[str, any]: """ Extracts specific key-value pairs from a source dictionary based on a mapping dictionary. Args...
magic_instruct_75k
42,926
Create a Python class `Logger` that implements a logging decorator for its methods. The class should have three methods: `normal`, `good`, and `decorator`. The `normal` and `good` methods are responsible for logging messages, and the `decorator` method is used to create a decorator for other methods in the class. The ...
Here is the Python code to solve the given problem in the markdown block: ```python class Logger: def __init__(self, filename=None, formatter=str): """ Initialize the Logger class with an optional filename and formatter. Args: filename (str, optional): The filename to write logs...
magic_instruct_75k
42,982
Write a Python function to process a list of location dictionaries and populate a nested dictionary `result` with information about countries, their subdivisions, and cities. The function should return the populated `result` dictionary. The `result` dictionary should have the following structure: ```python result = { ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def process_locations(locations: List[Dict]) -> Dict: """ Processes a list of location dictionaries and populates a nested dictionary with information about countries, their subdivisions, and citie...
magic_instruct_75k
42,988
Write a Python function to automate the installation of dependencies and submodule dependencies for a local project repository on a Linux system. The function should handle the updating of external dependencies and the installation of a specific dependency (cimgui) for the local project repository. The function should...
Here is the Python code to solve the given problem in the markdown block: ```python import subprocess import os def install_dependencies(project_path: str) -> None: """ Automates the installation of dependencies and submodule dependencies for a local project repository. Args: project_path (str): T...
magic_instruct_75k
42,990
Write a Python function `generate_game_chart` that processes music timing data to generate a chart for a rhythm-based game. The function should take in a dictionary containing music timing information and return a chart based on the provided timings. The music timing information includes the BPM (beats per minute) for ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Tuple def generate_game_chart(music_timing_info: Dict) -> List[Tuple[str, int, int]]: """ Generates a game chart from the provided music timing information. Args: music_timing_info (d...
magic_instruct_75k
43,028
Write a Python function to calculate the factorial of a given non-negative integer. The factorial of a non-negative integer `n` is the product of all positive integers less than or equal to `n`. The function should handle edge cases such as `0` and `1` appropriately. The code should start with: ```python def calculate...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_factorial(n: int) -> int: """ Calculate the factorial of a given non-negative integer. The factorial of a non-negative integer n is the product of all positive integers less than or equal to n. For example...
magic_instruct_75k
43,036
Write a Python function to extract words from a given string based on a specific pattern defined by a regular expression. The function should return a list of words that match the pattern. The pattern is designed to match words containing uppercase, lowercase, and numeric characters. The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python import re from typing import List def extract_words(input_string: str) -> List[str]: """ Extracts words from the input string based on a specific pattern defined by a regular expression. The pattern matches words containin...
magic_instruct_75k
43,081
Write a Python function to extract a command packet from a given command stream based on the provided start index and length. The command stream is a string containing multiple command packets, and each packet is identified by its start index and length. The function should return the extracted command packet as a stri...
Here is the Python code to solve the given problem in the markdown block: ```python def extractCommandPacket(commandStream: str, packetStart: int, packetLng: int) -> str: """ Extracts a command packet from the given command stream based on the provided start index and length. Args: commandStream (s...
magic_instruct_75k
43,089
Write a Python function to calculate the average speed of a vehicle given the total distance traveled and the total time taken. The function should take two parameters: distance in kilometers and time in hours, and return the average speed in kilometers per hour (km/h). The average speed is calculated by dividing the t...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_average_speed(distance: float, time: float) -> float: """ Calculate the average speed of a vehicle given the total distance traveled and the total time taken. Args: distance (float): The total distance...
magic_instruct_75k
43,098
Write a Python function to replace placeholders in a given template string with corresponding values from a dictionary. The placeholders are enclosed in double curly braces, e.g., "{{placeholder}}". If a placeholder does not have a corresponding key in the dictionary, it should remain unchanged in the output. The func...
Here is the Python code to solve the given problem in the markdown block: ```python def replace_placeholders(template: str, values: dict) -> str: """ Replaces placeholders in a template string with corresponding values from a dictionary. Placeholders are enclosed in double curly braces, e.g., "{{placeholde...
magic_instruct_75k
43,125
Write a Python function to generate a centered tower of asterisks with a specified number of floors. Each floor should have an increasing number of asterisks, creating a pyramid-like shape. The tower should be centered within the output, with spaces padding the left and right sides of each floor. The function should s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_tower(n_floors: int) -> List[str]: """ Generates a centered tower of asterisks with the specified number of floors. Args: n_floors (int): The number of floors in the tower. ...
magic_instruct_75k
43,150
Write a Python function to simulate a simplified package manager that attempts to install a list of packages using the `cpanm` command. If an installation fails, the program should make a second attempt. If the second attempt also fails, the program should display an error message indicating the failure. The function s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def install_packages(packages: List[str]) -> None: """ Simulates the installation of a list of packages using the `cpanm` command. If an installation fails, the program attempts to inst...
magic_instruct_75k
43,164
Create a Python class `WebhookManager` to manage a collection of webhooks. Each webhook is represented by an instance of a `Webhook` class, which has properties `url` (a string representing the URL to which the webhook should send the payload) and `payload` (a string representing the payload data to be sent to the URL)...
Here is the Python code to solve the given problem in the markdown block: ```python class Webhook: def __init__(self, url: str, payload: str): self.url = url self.payload = payload class WebhookManager: def __init__(self): self.webhooks = [] def addWebhook(self, url: str, payload: ...
magic_instruct_75k
43,165
Write a Python function to compare two sets of search results and identify the common documents along with their scores. The function should take four parameters: - `ids1`: A list of integers representing the document IDs in the first set of search results. - `scores1`: A list of floats representing the scores correspo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def findCommonDocuments(ids1: List[int], scores1: List[float], ids2: List[int], scores2: List[float]) -> List[Tuple[int, float, float]]: """ Compare two sets of search results and identify the com...
magic_instruct_75k
43,170
Write a Python function to calculate the total count of spare parts in a warehouse given a dictionary containing a list of ranges. Each range represents a specific range of spare parts. The function should handle any edge cases, such as empty ranges or an empty list of ranges. The code should start with: ```python fro...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Union def count_spare_parts(warehouse: Dict[str, List[Union[range, List[int]]]]) -> int: """ Calculate the total count of spare parts in a warehouse given a dictionary containing a list of ranges....
magic_instruct_75k
43,176
Write a Python function that generates the corresponding Docker commands for building, tagging, and pushing a Docker image to a container registry for a given microservice name. The function should return a list of strings, where each string represents a Docker command. The function should handle the input validation t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import re def generate_docker_commands(microservice_name: str) -> List[str]: """ Generates Docker commands for building, tagging, and pushing a Docker image to a container registry. Args: mi...
magic_instruct_75k
43,177
Write a Python function to simulate the monitoring of a watchlist of actions. The function should categorize each action based on specific criteria and return a dictionary containing the counts of high-priority actions, error actions, and regular actions. The criteria for categorization are as follows: - If the action ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def simulate_watchlist_monitoring(actions: List[str]) -> Dict[str, int]: """ Simulate the monitoring of a watchlist of actions and categorize them based on specific criteria. Args: act...
magic_instruct_75k
43,195
Create a Python class `Transform` that represents a 2D transform in a game engine. The transform should include attributes for position, rotation, scale, and a reference to the game object it is attached to. The class should also provide methods to manage the transform's children. Specifically, the class should include...
Here is the Python code to solve the given problem in the markdown block: ```python class Transform: """ Represents a 2D transform in a game engine, including position, rotation, scale, and a reference to the game object. Provides functionality to manage the transform's children. Attributes: pa...
magic_instruct_75k
43,204
Write a Python function to retrieve the color associated with a given rank from a dictionary. If the rank is not found in the dictionary, the function should return "Unknown". The dictionary will contain rank-color mappings. The code should start with: ```python from typing import Dict def get_rank_color(rank_info: D...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def get_rank_color(rank_info: Dict[str, str], rank: str) -> str: """ Retrieves the color associated with a given rank from a dictionary. Args: rank_info (Dict[str, str]): A dictionary contai...
magic_instruct_75k
43,205
Write a Python function to find the maximum number of consecutive successful tests in a given list of test results. Each test result is represented by an integer, where `1` indicates a success and `0` indicates a failure. The function should return the length of the longest sequence of consecutive successful tests. Th...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_consecutive_successes(test_results: List[int]) -> int: """ Calculate the maximum number of consecutive successful tests in a given list of test results. Args: test_results (List[int]...
magic_instruct_75k
43,208
Write a Python function to extract the unique names of the view functions associated with each URL pattern from a given list of URL patterns. The URL patterns are represented as a list of tuples, where each tuple contains the URL pattern, the corresponding view function, and the name of the URL pattern. The function s...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Set def extract_view_names(url_patterns: List[Tuple[str, callable, str]]) -> Set[str]: """ Extracts the unique names of the view functions associated with each URL pattern. Args: url...
magic_instruct_75k
43,213
Write a Python function to generate the appropriate xctool command based on the given platform and build type. The function should handle the following platforms and build types: - **Platforms**: `iPhoneOS`, `iPhoneSimulator`, `Mac` - **Build Types**: `library`, `test`, `framework` (only for `Mac` platform) The functi...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_xctool_command(platform: str, build_type: str) -> str: """ Generates the appropriate xctool command based on the given platform and build type. Args: platform (str): The platform for which the build is ...
magic_instruct_75k
43,246
Write a Python function to calculate the CIGAR (Concise Idiosyncratic Gapped Alignment Report) operations for sequence alignment. The CIGAR string is a compact representation of sequence alignment, commonly used in bioinformatics. The CIGAR string consists of a series of operation-length pairs, where each operation rep...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def calculate_cigar_operations(length: int, query_sequence: List[int], reference_sequence: List[int], alignment: List[Tuple[str, int]]) -> List[Tuple[str, int]]: """ Calculate the CIGAR operations...
magic_instruct_75k
43,251
Write a Python function to represent paginated data from an API response. The function should include properties for the size of each page, the sorting criteria, the total number of elements, and the total number of pages. Additionally, it should handle conversions between different data types. The function should sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional, Union def create_paginated_data(size: Optional[int], sort: Optional[str], total_elements: Optional[int], total_pages: Optional[int]) -> dict: """ Represents paginated data from an API response. ...
magic_instruct_75k
43,254
Write a Python function to apply a specific image processing operation to a given input image. The function should take an image as input and return the modified image after applying the operation. The image is represented as a 2D array of integers, where each element represents the pixel intensity at that position. T...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def apply_image_processing(image: List[List[int]]) -> List[List[int]]: """ Applies an image processing operation to a given input image. The operation involves replacing each pixel i...
magic_instruct_75k
43,270
Write a Python function to calculate the total amount of water that can be trapped between walls represented by a list of integers. Each integer in the list represents the height of a wall, and the width of each wall is 1 unit. The water can only be trapped if there are at least two walls and the walls are surrounded b...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_trapped_water(wall_heights: List[int]) -> int: """ Calculate the total amount of water that can be trapped between the walls. Args: wall_heights (List[int]): A list of integers...
magic_instruct_75k
43,290
Write a Python function to process a set of image patches based on certain parameters, excluding certain offsets from processing. The function should take in a dictionary of pattern parameters, a list of offsets, and a list of indices to exclude. The processed patches should be returned as a dictionary. The code shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def process_patches(pattern_params: Dict[str, float], offsets: List[float], exclude: List[int]) -> Dict[int, str]: """ Process a set of image patches based on pattern parameters, excluding certain ...
magic_instruct_75k
43,303
Create a Python class `SetPeakMetadata` that manages peak metadata for a spectrum analysis application. The class should store information about the spectrum and provide methods to manipulate and retrieve peak metadata. The class should include the following: 1. A constructor that initializes the `spectrumInfo` referen...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Any class SetPeakMetadata: """ A class to manage peak metadata for a spectrum analysis application. Attributes: spectrumInfo (Dict[str, Any]): A dictionary containing spectrum information. ...
magic_instruct_75k
43,313
Write a Python function to parse a message string and extract resource names along with their corresponding types. The message string contains information about resources in a specific format, and your function should return a dictionary mapping resource names to their types. The message string follows the format: "Re...
Here is the Python code to solve the given problem in the markdown block: ```python import re def parse_resources(message: str) -> dict: """ Parses a message string to extract resource names and their corresponding types. The message string follows the format: "ResourceName (type: ResourceType)" ...
magic_instruct_75k
43,314
Write a Python function to check and fix a given directory path. The function should ensure that the directory path ends with a forward slash ("/"). If the given directory path does not end with a forward slash, the function should append it to the path and return the corrected directory path. The code should start wi...
Here is the Python code to solve the given problem in the markdown block: ```python def check_directory_path(dir: str) -> str: """ Ensures the given directory path ends with a forward slash ("/"). Args: dir (str): The input directory path that needs to be checked and fixed. Returns: st...
magic_instruct_75k
43,315
Write a Python function to simulate a task scheduling system that can handle concurrent execution of tasks. The system should be able to schedule and execute a specified number of tasks from multiple threads and ensure that the tasks are executed correctly. The function should start with: ```python from typing import ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Callable import threading def task_scheduler(tasks: List[Callable[[], None]], num_threads: int) -> None: """ Simulates a task scheduling system that can handle concurrent execution of tasks. Args: ...
magic_instruct_75k
43,335
Write a Python function to generate a command-line argument string for a machine learning training script. The function should take in various training parameters and construct a formatted argument string. The parameters include `BATCH_SIZE`, `VAL_BATCH_SIZE`, `OUTPUT_DIR`, `MODEL_CONFIG`, `LEARNING_RATE`, `LR_POLICY`,...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_training_args(BATCH_SIZE: int, VAL_BATCH_SIZE: int, OUTPUT_DIR: str, MODEL_CONFIG: str, LEARNING_RATE: float, LR_POLICY: str, EPOCHS: int) -> str: """ Generates a command-line argument string for a machine learning ...
magic_instruct_75k
43,337
Write a Python function to automate the deployment process for a Vue.js web application. The function should perform the following steps: 1. Build the Vue.js application using the `npm run build` command. 2. Navigate into the build output directory located at `docs/.vuepress/dist`. The function should handle the execu...
Here is the Python code to solve the given problem in the markdown block: ```python import subprocess import os def deploy_vue_app() -> None: """ Automates the deployment process for a Vue.js web application. This function performs the following steps: 1. Builds the Vue.js application using the `npm r...
magic_instruct_75k
43,341
Write a Python function to determine the current color of a traffic light based on the given `light` parameter. The function should return the color of the traffic light as a string, which can be one of "red", "yellow", or "green". If the traffic light is not recognized, the function should return "unknown". The code ...
Here is the Python code to solve the given problem in the markdown block: ```python def get_light_state(light: int) -> str: """ Determines the current color of the traffic light based on the given light ID. Args: light (int): The ID of the traffic light. Returns: str: The current color...
magic_instruct_75k
43,342
Write a Python function to count the number of HTML comments within a given HTML file content. An HTML comment is defined as any text enclosed within `<!--` and `-->`. The function should handle multiple HTML comments within the file and provide the total count of comments found. The code should start with: ```python ...
Here is the Python code to solve the given problem in the markdown block: ```python import re def count_html_comments(html_content: str) -> int: """ Counts the number of HTML comments within a given HTML file content. Args: html_content (str): The content of the HTML file as a string. Returns...
magic_instruct_75k
43,349
Write a Python function `process_labels` that takes in two lists, `labelpredict` and `labelreal`, and returns a dictionary containing the following keys and their corresponding values: - "predict_length": length of `labelpredict` - "real_length": length of `labelreal` - "all_predict_and_real_num": total quantity of lab...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def process_labels(labelpredict: List[str], labelreal: List[str]) -> Dict[str, int]: """ Processes the lengths of two lists, `labelpredict` and `labelreal`, and returns a dictionary containing ...
magic_instruct_75k
43,350
Write a Python function to determine the corresponding run range letter for a given run number based on predefined run ranges. The function should take an integer `run_number` as input and return the corresponding run range letter ("A", "B", "C", or "D") based on the following run ranges: - "A": (315252, 316995) - "B":...
Here is the Python code to solve the given problem in the markdown block: ```python def get_run_range(run_number: int) -> str: """ Determine the corresponding run range letter for a given run number. Args: run_number (int): The run number to check. Returns: str: The corresponding run r...
magic_instruct_75k
43,366
Write a Python function to determine whether a given set of geographical coordinates forms a valid polygon. A valid polygon must satisfy the following conditions: 1. The polygon must have at least three vertices. 2. The first and last vertex must be the same, forming a closed loop. 3. No two consecutive vertices should...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def is_valid_polygon(coordinates: List[Tuple[int, int]]) -> bool: """ Determines whether the given set of coordinates forms a valid polygon. Args: coordinates (List[Tuple[int, int]]):...
magic_instruct_75k
43,376
Create a Python function to manage a graphical user interface (GUI) for a productivity application. The function should handle the setup of the menu, toolbar, dock widgets, and connections between various UI elements. The function should be named `setup_gui` and should take a list of actions as input. The function shou...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Any def setup_gui(actions: List[Any]) -> Dict[str, Any]: """ Sets up the GUI for a productivity application by creating and configuring the menu, toolbar, dock widgets, and connections. Args:...
magic_instruct_75k
43,387
Write a Python function to perform a deep copy of a linked list with an additional "sibling" pointer. The linked list is represented using the following `Node` class: ```python class Node: def __init__(self, value): self.value = value self.next = None self.sibling = None ``` The `next` poi...
Here is the Python code to solve the given problem in the markdown block: ```python class Node: def __init__(self, value): self.value = value self.next = None self.sibling = None def clone_linked_list_with_sibling(head: Node) -> Node: """ Perform a deep copy of a linked list with si...
magic_instruct_75k
43,388
Write a Python function to split a given string into individual tokens based on a specified delimiter. The function should take a string `s` and a character `delim` as input and return a list of strings containing the tokens obtained after splitting the input string. The code should start with: ```python from typing i...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def split_string(s: str, delim: str) -> List[str]: """ Splits a given string into individual tokens based on a specified delimiter. Args: s (str): The input string to be split. delim...
magic_instruct_75k
43,403
Write a Python function to categorize a tweet based on the user's location proximity to known shelters. The function should take a tweet and the user's location as input and return a boolean value indicating whether the user is near a known shelter. The user's location is provided in the format "latitude,longitude", an...
Here is the Python code to solve the given problem in the markdown block: ```python import math def haversine_distance(lat1: float, lon1: float, lat2: float, lon2: float) -> float: """ Calculate the distance between two points on the Earth's surface using the Haversine formula. Args: lat1 (float):...
magic_instruct_75k
43,407
Write a Python function to create an embed object for a messaging application. The embed object should have the following properties: - **Title**: "New Message" - **Description**: The input text message - **Color**: Blue (hex code: `#0000FF`) The function should take a single string argument representing the text mess...
Here is the Python code to solve the given problem in the markdown block: ```python def create_embed(text: str) -> dict: """ Creates an embed object for a messaging application. The embed object has the following properties: - Title: "New Message" - Description: The input text message - Color: ...
magic_instruct_75k
43,417
Write a Python function to determine whether a given string `s3` can be formed by interleaving the characters of two other strings `s1` and `s2` while maintaining the left-to-right order of characters from each string. The function should return `True` if `s3` can be formed by interleaving `s1` and `s2`, and `False` ot...
Here is the Python code to solve the given problem in the markdown block: ```python def isInterleave(s1: str, s2: str, s3: str) -> bool: """ Determine if s3 can be formed by interleaving the characters of s1 and s2. Args: s1 (str): The first string. s2 (str): The second string. s3 (...
magic_instruct_75k
43,432
Write a Python function to compare two version numbers represented as strings and determine which version is greater. The version numbers are in the format "x.y.z", where x, y, and z are non-negative integers. The function should return 1 if the first version is greater, -1 if the second version is greater, and 0 if th...
Here is the Python code to solve the given problem in the markdown block: ```python def compare_versions(version1: str, version2: str) -> int: """ Compares two version numbers represented as strings and determines which version is greater. Args: version1 (str): The first version number in the forma...
magic_instruct_75k
43,448
Write a Python function to determine the correct configuration file path from a list of command-line arguments. The function should prioritize absolute paths over relative paths and return a default path if no valid configuration file path is found. The function signature should be: ```python from typing import List ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def get_config_file_path(args: List[str]) -> str: """ Determine the correct configuration file path from a list of command-line arguments. Args: args (List[str]): A list of command-line argu...
magic_instruct_75k
43,450
Write a Python function to copy the elements of a given list `I` into a new list `V` and then print the new list `V`. Ensure that the function handles the copying process correctly and efficiently. The function should start with: ```python from typing import List def copy_list_and_print(I: List[int]) -> None: ```
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def copy_list_and_print(I: List[int]) -> None: """ Copies the elements of the input list `I` into a new list `V` and prints the new list `V`. Args: I (List[int]): The input list to be copied...
magic_instruct_75k
43,456
Write a Python function `format_package_info(metadata)` that takes in a dictionary representing package metadata and returns a formatted string containing the package information. The formatted string should include the package URL, author information, license, packages, and install requirements. The function should ha...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Any def format_package_info(metadata: Dict[str, Any]) -> str: """ Formats the package metadata into a readable string. Args: metadata (Dict[str, Any]): A dictionary containing package metad...
magic_instruct_75k
43,485
Write a Python function to filter a list of dictionaries representing hardware components and return a new list containing only the components of type "CHASSIS" with a specific vendor and platform. Each dictionary in the input list has the following keys: "type", "vendor", "platform", and "serial". The "type" key indic...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def filter_chassis(components: List[Dict[str, str]], target_vendor: str, target_platform: str) -> List[Dict[str, str]]: """ Filters a list of hardware components and returns a new list containing o...
magic_instruct_75k
43,493
Write a Python function to simulate the behavior of the given Bash script. The function should take three parameters: the VCS type (`vcs_type`), a list of repository names (`repo_names`), and the path to a netrc file (`netrc_path`). The function should perform the following actions: 1. If the VCS type is "git", the fun...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def simulate_vcs_operations(vcs_type: str, repo_names: List[str], netrc_path: str) -> None: """ Simulate the behavior of a Bash script that interacts with a version control system (VCS) repository. ...
magic_instruct_75k
43,496
Write a Python function to calculate the environmental impact based on a given array of integers. The environmental impact is defined as the product of the total amount of oxygen and the total amount of carbon dioxide produced by the elements in the array. The amount of oxygen produced by an element is equal to the ele...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculateEnvironmentalImpact(arr: List[int]) -> int: """ Calculate the environmental impact based on the given array of integers. The environmental impact is calculated as the product of the tot...
magic_instruct_75k
43,514
Write a Python function `simulate_pytest_exit_code(pytest_args, cov_flag)` that simulates the behavior of the `pytest.main()` function. The function should take in two parameters: - `pytest_args` (list): A list of strings representing the command-line arguments to be passed to `pytest.main()`. - `cov_flag` (bool): A bo...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def simulate_pytest_exit_code(pytest_args: List[str], cov_flag: bool) -> int: """ Simulate the behavior of the `pytest.main()` function and return the exit code. Args: pytest_args (List[str]...
magic_instruct_75k
43,524
Write a Python function to calculate the average score of a game, excluding the highest and lowest scores from a given list of integers. The function should return the average score rounded to the nearest whole number. The input list will always contain at least 3 unique scores. The code should start with: ```python f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_average_score(scores: List[int]) -> int: """ Calculate the average score of a game, excluding the highest and lowest scores. Args: scores (List[int]): A list of integers repres...
magic_instruct_75k
43,554
Write a Python function to process a list of command-line options and maintain a running total based on the operations specified by the options. The function should support the following options: - `-a <value>`: Add the provided value to the running total. - `-s <value>`: Subtract the provided value from the running to...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Union def process_options(options: List[str]) -> Union[int, str]: """ Process a list of command-line options and maintain a running total based on the operations specified by the options. Args: ...
magic_instruct_75k
43,557
Write a Python function to determine whether each set of three numbers from a given list can form a valid triangle. A valid triangle is formed if the sum of the lengths of any two sides is greater than the length of the third side for all combinations of sides. The function should return a list of boolean values indica...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def validate_triangles(sides: List[List[float]]) -> List[bool]: """ Determines whether each set of three numbers from a given list can form a valid triangle. Args: sides (List[Li...
magic_instruct_75k
43,576
Write a Python function to implement a simple recurrent neural network (RNN) cell using NumPy. The RNN cell should process a sequence of inputs and maintain a hidden state that captures information about the sequence seen so far. The function should initialize the weights and bias for the RNN cell, process the input se...
Here is the Python code to solve the given problem in the markdown block: ```python import numpy as np from typing import List def rnn_cell(input_size: int, hidden_size: int, sequence_length: int) -> List[List[float]]: """ Implements a simple recurrent neural network (RNN) cell using NumPy. Args: ...
magic_instruct_75k
43,577
Write a Python function to count the number of files in a given list that match a specific naming pattern. The naming pattern consists of a numeric identifier followed by an underscore and a series of alphanumeric characters. The function should ignore case sensitivity when matching the naming pattern. The function sh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_files_with_pattern(file_names: List[str], pattern: str) -> int: """ Counts the number of files in the given list that match the specified naming pattern. The naming pattern consists of a n...
magic_instruct_75k
43,579
Write a Python function to calculate the bandwidth utilization based on the given parameters: `run_time` (in seconds), `size` (in bytes), and `bandwidth` (in bits per second). The function should return the bandwidth utilization as a percentage. Additionally, if the `run_time` is less than 1.0 second, the function shou...
Here is the Python code to solve the given problem in the markdown block: ```python def calculate_bandwidth_utilization(run_time: float, size: int, bandwidth: int) -> int: """ Calculate the bandwidth utilization based on the given parameters. Args: run_time (float): The duration of the data transfe...
magic_instruct_75k
43,597
Write a Python function to modify a given string by replacing placeholders in the form of `%d` with corresponding integers from a list. The function should handle the replacement efficiently and return the modified string. The code should start with: ```python from typing import List def modify_string(retstr: str, re...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def modify_string(retstr: str, retlst: List[int]) -> str: """ Modifies the given string by replacing placeholders in the form of `%d` with corresponding integers from the list. Args: retstr ...
magic_instruct_75k
43,598
Create a Python function to determine the type of a group based on a given string input. The function should map the input string to one of three predefined group types: `Public`, `Private`, or `Secret`. If the input string does not match any of the predefined types, the function should return `None`. The code should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Optional def get_group_type(group_type_str: str) -> Optional[str]: """ Determine the type of a group based on a given string input. Args: group_type_str (str): The string input representing the t...
magic_instruct_75k
43,604
Write a Python function to verify the validity of email addresses and bad pairs in a given input. The function `verify_input` takes two parameters: `emails`, a list of email addresses, and `bad_pairs`, a list of pairs of email addresses that should not appear together. The function should return `True` if the input is ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple import re def verify_input(emails: List[str], bad_pairs: List[Tuple[str, str]]) -> bool: """ Verify the validity of email addresses and bad pairs in a given input. Args: emails (List[...
magic_instruct_75k
43,618
Create a Python function to implement a logging system that supports different log levels, including "CRITICAL", "ERROR", "WARNING", "INFO", and "DEBUG". The system should allow for variable arguments to be logged along with the log message. The function should handle logging at the "CRITICAL" level and format the log ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Any, List def log_critical(message: str, *args: Any) -> None: """ Logs a critical message with variable arguments to the standard output. Args: message (str): The log message template. *a...