source
stringclasses
6 values
id
int64
0
111k
instruction
stringlengths
167
4.39k
response
stringlengths
244
6.1k
magic_instruct_75k
7,441
Write a Python function to count the number of users for each unique username from a list of user objects. Each user object is represented as a tuple containing the username and password. The function should return a dictionary where the keys are unique usernames and the values are the count of users with that username...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def count_users(user_list: List[Tuple[str, str]]) -> Dict[str, int]: """ Counts the number of users for each unique username from a list of user objects. Args: user_list (List[T...
magic_instruct_75k
7,475
Write a Python function `generate_tuples(n)` that takes an integer `n` as input and returns a list of tuples. Each tuple in the list should contain two elements: the first element being the index of the tuple in the list (starting from 0), and the second element being the square of the index. The code should start wit...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def generate_tuples(n: int) -> List[Tuple[int, int]]: """ Generates a list of tuples where each tuple contains an index and its square. Args: n (int): The number of tuples to generate...
magic_instruct_75k
7,479
Write a Python function to construct a URL for a specific type of financial curve and add parameters to it based on the given inputs. The function should follow the rules outlined in the code snippet. The function should start with: ```python def construct_curve_url(curve: str, safe_curve: str, begin: str, end: str, p...
Here is the Python code to solve the given problem in the markdown block: ```python def construct_curve_url(curve: str, safe_curve: str, begin: str, end: str, period: str, delivery: str) -> str: """ Constructs a URL for a specific type of financial curve and adds parameters to it. Args: curve (str)...
magic_instruct_75k
7,483
Write a Python function to determine whether a given number is prime or not. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself. The function should return `True` if the number is prime, and `False` otherwise. The code should start with: ```python def is_prime(n: in...
Here is the Python code to solve the given problem in the markdown block: ```python def is_prime(n: int) -> bool: """ Determine whether a given number is prime. Args: n (int): The number to check for primality. Returns: bool: True if the number is prime, False otherwise. """ # ...
magic_instruct_75k
7,488
Create a Python class `Channel` that implements a simple messaging system. The class should allow users to send and retrieve messages. The class should have the following functionalities: 1. A constructor that initializes the channel with a name and an empty list of messages. 2. A method to send a message to the channe...
Here is the Python code to solve the given problem in the markdown block: ```python from dataclasses import dataclass from typing import List @dataclass class Channel: """ A class to represent a messaging channel. Attributes: name (str): The name of the channel. messages (List[str]): A lis...
magic_instruct_75k
7,492
Write a Python function to compute the sum of all natural numbers that are multiples of 3 or 5 and are less than a given input number `num`. The function should be named `compute_sum_of_multiples` and should take an integer `num` as input. The function should return the sum of all such natural numbers. The code should...
Here is the Python code to solve the given problem in the markdown block: ```python def compute_sum_of_multiples(num: int) -> int: """ Compute the sum of all natural numbers that are multiples of 3 or 5 and are less than the given input number `num`. Args: num (int): The upper limit (exclusive) for...
magic_instruct_75k
7,501
Write a Python function to calculate the product of pairs of integers from a given list of pairs. The function should take a list of tuples, where each tuple contains two integers, and return a list of integers representing the products of each pair. The code should start with: ```python from typing import List, Tuple...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def calculate_products(pairs: List[Tuple[int, int]]) -> List[int]: """ Calculate the product of pairs of integers from a given list of pairs. Args: pairs (List[Tuple[int, int]]): A li...
magic_instruct_75k
7,511
Create a Python function to manage the state transitions of instances in a distributed system. The function should include an enumeration to represent the possible states of the instances and a method to transition the state of an instance based on predefined rules. The code should start with: ```python from enum impo...
Here is the Python code to solve the given problem in the markdown block: ```python from enum import Enum class DDM_INSTANCE_STATE(Enum): UNKNOWN = 1 PRIMARY = 2 SECONDARY = 3 STANDBY = 4 def transition_state(current_state: DDM_INSTANCE_STATE, target_state: DDM_INSTANCE_STATE) -> DDM_INSTANCE_STATE: ...
magic_instruct_75k
7,557
Write a Python function to process a series of operations on a 3x3 grid initially filled with letters 'A', 'B', and 'C'. Each operation involves either removing a letter at a specific position or adding a new letter at a specific position. The operations are represented as strings in the following format: - "X removed ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def processOperations(initialGrid: List[List[str]], operations: List[str]) -> List[List[str]]: """ Process a series of operations on a 3x3 grid and return the final state of the grid. Args: ...
magic_instruct_75k
7,565
Write a Python function to generate a Domain-Specific Language (DSL) command for a `for` loop in a shell script. The function should take a list of strings as input and return a string representing the DSL command for the `for` loop. The DSL command should follow the format demonstrated in the given code snippet. The ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_for_loop_command(items: List[str]) -> str: """ Generates a DSL command for a `for` loop in a shell script. Args: items (List[str]): A list of strings representing the items to b...
magic_instruct_75k
7,573
Write a Python function to count the occurrences of each category in a given list of strings. Each string in the input list represents a category, and the output should be a dictionary where the keys are the unique categories and the values are the counts of each category in the input list. The code should start with:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_categories(category_list: List[str]) -> Dict[str, int]: """ Counts the occurrences of each category in a given list of strings. Args: category_list (List[str]): A list of str...
magic_instruct_75k
7,577
Write a Python function to process a list of chunks and group them based on a specific key. Each chunk is represented as a tuple containing data and a key. The function should then concatenate the data of the chunks within each group and return a dictionary where the keys are the unique keys from the chunks and the val...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict from itertools import groupby, chain def process_chunks(chunks: List[Tuple[List[str], int]]) -> Dict[int, List[str]]: """ Processes a list of chunks and groups them based on a specific key. ...
magic_instruct_75k
7,608
Write a Python function to find the maximum number that can be formed by rearranging the digits of a given positive integer. The function should take a positive integer as input and return the maximum number that can be formed by rearranging its digits. The code should start with: ```python def find_max_number(number:...
Here is the Python code to solve the given problem in the markdown block: ```python def find_max_number(number: int) -> int: """ Finds the maximum number that can be formed by rearranging the digits of a given positive integer. Args: number (int): The positive integer whose digits are to be rearran...
magic_instruct_75k
7,622
Write a Python function to determine if a given directed graph contains a cycle. The graph is represented as an adjacency list where each key is a vertex and the corresponding value is a list of vertices that the key vertex points to. The function should return `True` if the graph contains a cycle, and `False` otherwis...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def has_cycle(graph: Dict[int, List[int]]) -> bool: """ Determines if a given directed graph contains a cycle. Args: graph (Dict[int, List[int]]): The graph represented as an adjacency...
magic_instruct_75k
7,625
Write a Python function to find and return a list of unique elements from a given list of integers while maintaining the order of their first appearance. The function should not use any built-in functions or libraries that directly solve this problem. The code should start with: ```python from typing import List def ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_unique_elements(arr: List[int]) -> List[int]: """ Returns a list of unique elements from the input list while maintaining the order of their first appearance. Args: arr (List[int]):...
magic_instruct_75k
7,627
Write a Python function to count the number of occurrences of a given word in a large text document efficiently. The function should handle case-insensitive matching and return the count of occurrences of the word in the text. The function should be efficient in terms of both time and space complexity. The code should...
Here is the Python code to solve the given problem in the markdown block: ```python def count_word_occurrences(text: str, word: str) -> int: """ Counts the number of occurrences of a given word in a text document. The function is case-insensitive and efficiently counts non-overlapping occurrences of th...
magic_instruct_75k
7,647
Write a Python function to simulate a simple stack data structure. The stack should support the following operations: push, pop, top, and is_empty. Additionally, the stack should have a constructor to initialize the stack and a destructor to clean up any resources. The stack should be implemented using a linked list to...
Here is the Python code to solve the given problem in the markdown block: ```python class Node: def __init__(self, data): self.data = data self.next = None class Stack: def __init__(self): """ Initialize the stack with top_node set to None. """ self.top_node = No...
magic_instruct_75k
7,650
Write a Python function to process page specifications for a web application. The function should take a list of page specifications and a page factory function, and return a dictionary containing the processed page specifications. Each page specification is a dictionary with keys such as 'name', 'url', and 'elements'....
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Any def get_pages_specs(page_specs: List[Dict[str, Any]], page_factory: callable) -> Dict[str, Any]: """ Processes page specifications for a web application and returns a dictionary of page object...
magic_instruct_75k
7,659
Write a Python function to find the highest score from a given list of integers representing the scores of a game. The function should handle edge cases such as empty input lists. 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 list of integers representing game scores. Args: scores (List[int]): A list of integers representing the scores...
magic_instruct_75k
7,691
Write a Python function to process a list of tuples containing file names and version numbers. Each tuple represents a file name and a version number. The function should return a dictionary where the keys are the file names and the values are lists of version numbers, sorted in descending order. The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def process_files(file_versions: List[Tuple[str, int]]) -> Dict[str, List[int]]: """ Processes a list of tuples containing file names and version numbers. Returns a dictionary where the ...
magic_instruct_75k
7,696
Write a Python function to calculate the average intensity of pixels in a specified plane of an OME-TIFF image using the MISAXX library. The function should retrieve the planes location from a given OME-TIFF cache and then compute the average intensity of the pixels in the specified plane. 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 calculate_average_intensity(cache: List[List[List[int]]], plane_index: int) -> float: """ Calculate the average intensity of pixels in a specified plane of an OME-TIFF image. Args: cache...
magic_instruct_75k
7,733
Write a Python function to traverse a file system represented by a composite structure consisting of directories and files using the Visitor design pattern. The file system structure is provided, and you are required to define the visitor interface and concrete visitor classes to perform operations on directories and f...
Here is the Python code to solve the given problem in the markdown block: ```python from abc import ABC, abstractmethod class File: def __init__(self, name): self.name = name def accept(self, visitor): visitor.visit_file(self) class Directory: def __init__(self, name): self.name =...
magic_instruct_75k
7,742
Write a Python function to evaluate a logical expression involving two boolean variables `a` and `b`. The function should use the custom functions `truth(a)`, `is_(a, b)`, and `is_not(a, b)` to determine the truth value of the expression. The logical expression to be evaluated is given as a string in the format `"is_(a...
Here is the Python code to solve the given problem in the markdown block: ```python def truth(a): """ Returns the truth value of the boolean variable a. Args: a: A boolean variable Returns: bool: The truth value of a """ return a def is_(a, b): """ Returns True if both...
magic_instruct_75k
7,749
Write a Python function to filter a list of file paths based on a given keyword. The function should return a new list containing only the file paths that include the specified keyword. The function should handle cases where no file paths match the keyword by returning an empty list. The code should start with: ```pyt...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def filter_file_paths(file_paths: List[str], keyword: str) -> List[str]: """ Filters a list of file paths based on a given keyword. Args: file_paths (List[str]): A list of strings representi...
magic_instruct_75k
7,783
Write a Python function to manage the allocation and deallocation of resources in a software application. The function should ensure that all allocated resources are properly released to prevent resource leaks. The function should include the following functionalities: 1. Maintain a count of the currently allocated res...
Here is the Python code to solve the given problem in the markdown block: ```python def resource_manager(max_resources: int): """ Manages the allocation and deallocation of resources. Args: max_resources (int): The maximum number of resources that can be allocated. Returns: dict: A dic...
magic_instruct_75k
7,802
Write a Python function to process a series of instructions and create a unique glue object based on the provided commands and parameters. The function should take a list of instructions as input and return the unique glue object as a string in the format "uniq::make_free_glue". Each instruction is represented as a str...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def create_unique_glue(instructions: List[str]) -> str: """ Processes a series of instructions to create a unique glue object. Args: instructions (List[str]): A list of instructions where ea...
magic_instruct_75k
7,823
Write a Python function to calculate the maximum profit that can be obtained by buying and selling a stock at most once, given a list of integers representing the daily stock prices. If it is not possible to make any profit, the function should return 0. The code should start with: ```python from typing import List d...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def max_profit(prices: List[int]) -> int: """ Calculate the maximum profit that can be obtained by buying and selling a stock at most once. Args: prices (List[int]): A list of integers where...
magic_instruct_75k
7,835
Write a Python function to calculate and return the average score, highest score, and the number of scores above a given threshold from a list of game scores. The function should handle an empty list by returning default values. The code should start with: ```python from typing import List, Tuple def game_score_stats...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def game_score_stats(scores: List[int], threshold: int) -> Tuple[float, int, int]: """ Calculate and return the average score, highest score, and the number of scores above a given threshold. ...
magic_instruct_75k
7,844
Write a Python function to extract unique elements from a given list of integers while preserving their original order. The function should take a list of integers as input and return a new list containing only the unique elements from the original list, maintaining the order in which they first appear. The code shoul...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def get_unique_elements(lista: List[int]) -> List[int]: """ Extracts unique elements from a given list of integers while preserving their original order. Args: lista (List[int]): The input l...
magic_instruct_75k
7,866
Write a Python function to simulate the TikTokController functionality using a simple in-memory storage system. The function should handle the following operations: 1. **Fetch all TikTok videos**: Return a list of all TikTok videos stored in memory. 2. **Create a new TikTok video**: Add a new TikTok video to the in-mem...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Optional class TikTokController: def __init__(self): """ Initialize the TikTokController with an empty list of videos and a starting ID. """ self.videos = [] se...
magic_instruct_75k
7,872
Write a Python function to merge capacity commitments in a cloud infrastructure management system. The function should take two parameters: `parent`, a string representing the parent resource identifying the admin project and location, and `capacity_commitment_ids`, a list of strings representing the IDs of capacity co...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def merge_capacity_commitments(parent: str, capacity_commitment_ids: List[str]) -> str: """ Merges the specified capacity commitments under the given parent resource. Args: parent (str): A s...
magic_instruct_75k
7,886
Write a Python function to parse a JSON object representing a company's organizational structure and return a dictionary where the keys are the names of the managers, and the values are lists of the names of their direct reports. The JSON object is a nested structure where each employee has an `id`, `name`, `managerId`...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List, Optional, Union def get_manager_direct_reports(org_structure: Dict) -> Dict[str, List[str]]: """ Parses a JSON object representing a company's organizational structure and returns a dictionary ...
magic_instruct_75k
7,888
Write a Python function to process HTTP headers and parameters for a web request. The function should extract specific information from the provided headers and parameters and return them in a structured format. The function should handle cases where the required headers or parameters may be missing. The function shou...
Here is the Python code to solve the given problem in the markdown block: ```python def process_request(headers: dict, params: dict) -> dict: """ Processes HTTP headers and parameters to extract specific information and return it in a structured format. Args: headers (dict): A dictionary containing...
magic_instruct_75k
7,891
Write a Python function to parse a command-line instruction string and extract the program name, options, and arguments. The function should return a dictionary with the keys "program", "options", and "arguments". The "program" key should contain the program name, the "options" key should contain a list of options (str...
Here is the Python code to solve the given problem in the markdown block: ```python def parse_command(command: str) -> dict: """ Parses a command-line instruction string and extracts the program name, options, and arguments. Args: command (str): The command-line instruction string to parse. Re...
magic_instruct_75k
7,894
Write a Python function to automate the conversion of an SVG icon to various sizes of PNG images using ImageMagick. The function should take an input SVG file named `icon.svg` and generate PNG images of different sizes: 512x512, 192x192, 180x180, 144x144, 96x96, 48x48, 32x32, and 16x16 pixels. The function should use t...
Here is the Python code to solve the given problem in the markdown block: ```python import subprocess from typing import List import os def convert_svg_to_png(input_file: str, output_dir: str, sizes: List[int]) -> None: """ Converts an SVG icon to various sizes of PNG images using ImageMagick. Args: ...
magic_instruct_75k
7,898
Write a Python function to generate a random password of a specified length using the `secrets` library. The password should consist of alphanumeric characters (both uppercase and lowercase) and special characters. The function should take an integer `length` as input and return a random password of the specified lengt...
Here is the Python code to solve the given problem in the markdown block: ```python import secrets import string def generate_random_password(length: int) -> str: """ Generate a random password of the specified length. The password consists of alphanumeric characters (both uppercase and lowercase) and...
magic_instruct_75k
7,920
Write a Python function to connect keys from a given dictionary to their appropriate tally based on a predefined mapping. The function should take in a dictionary and a mapping dictionary as input and return a new dictionary with the keys connected to their respective tallies. If a key in the input dictionary is not fo...
Here is the Python code to solve the given problem in the markdown block: ```python def connect_tallies(input_dict: dict, mapping_dict: dict) -> dict: """ Connects keys from the input dictionary to their appropriate tallies based on the mapping dictionary. Args: input_dict (dict): A dictionary wher...
magic_instruct_75k
7,927
Write a Python function to filter out coordinates that lie in the first quadrant of the Cartesian plane from a given list of coordinates. Each coordinate is represented as a tuple of two integers (x, y). The function should return a new list containing only the coordinates where both x and y are positive. The code sho...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def first_quadrant_coordinates(coordinates: List[Tuple[int, int]]) -> List[Tuple[int, int]]: """ Filters out coordinates that lie in the first quadrant of the Cartesian plane. Args: c...
magic_instruct_75k
7,929
Write a Python function to count the occurrences of each unique URL pattern in a given list of URL patterns. The function should return a dictionary where the keys are unique URL patterns and the values are the counts of occurrences of each unique pattern in the input list. 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, Dict def count_url_patterns(urlpatterns: List[str]) -> Dict[str, int]: """ Counts the occurrences of each unique URL pattern in the given list. Args: urlpatterns (List[str]): A list of stri...
magic_instruct_75k
7,939
Write a Python function to count the total number of stars for GitHub repositories that contain a specific keyword in their file contents. The function should take a list of tuples, where each tuple contains the repository name and the file contents, and a keyword to search for. The function should return the total num...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def count_stars_with_keyword(repos: List[Tuple[str, str]], keyword: str) -> int: """ Counts the total number of stars for GitHub repositories that contain a specific keyword in their file contents...
magic_instruct_75k
7,948
Write a Python function to determine if a given string containing only the characters '(', ')', '{', '}', '[' and ']' is valid. The string is valid if: 1. Open brackets must be closed by the same type of brackets. 2. Open brackets must be closed in the correct order. The function should return `True` if the string is ...
Here is the Python code to solve the given problem in the markdown block: ```python def isValid(s: str) -> bool: """ Determine if the input string containing only the characters '(', ')', '{', '}', '[' and ']' is valid. Args: s (str): The input string containing only the characters '(', ')', '{', '...
magic_instruct_75k
7,973
Write a Python function to parse a list of URL patterns and extract the view names associated with each URL. The URL patterns are represented as a list of strings, where each string contains the path and view name separated by a comma. The view name is enclosed within the 'name=' attribute. Your function should return ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def extract_view_names(url_patterns: List[str]) -> Dict[str, str]: """ Extracts view names from a list of URL patterns and returns a dictionary of path-view name pairs. Args: url_patte...
magic_instruct_75k
7,979
Write a Python script to parallelize the execution of multiple jobs using the `parallel` command in a Linux environment. The script should read a list of job files from a specified directory and execute them in parallel, with a configurable number of jobs running concurrently. The script should accept the following inp...
Here is the Python code to solve the given problem in the markdown block: ```python import os import subprocess from typing import List def parallelize_jobs(job_directory: str, num_parallel_jobs: int) -> None: """ Parallelize the execution of multiple job files using the `parallel` command. Args: ...
magic_instruct_75k
7,994
Write a Python function to calculate the average of a list of numbers. If the input list is empty, the function should return `None`. The function should handle the case where the input list is empty to avoid division by zero errors. The code should start with: ```python from typing import List, Optional def calculat...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional def calculate_average(numbers: List[float]) -> Optional[float]: """ Calculate the average of a list of numbers. Args: numbers (List[float]): A list of numbers for which to calculat...
magic_instruct_75k
7,995
Write a Python function to simulate a simplified version of a web server's CORS (Cross-Origin Resource Sharing) handling. The function should determine the appropriate CORS headers to include in the server's response based on the incoming request's method, headers, and a list of allowed origins. The function should adh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def handleCORSRequest(requestMethod: str, requestHeaders: Dict[str, str], allowedOrigins: List[str]) -> Dict[str, str]: """ Simulates a simplified version of a web server's CORS handling. Args...
magic_instruct_75k
7,999
Write a Python function to calculate the maximum profit that can be obtained by buying and selling a stock at most once, given a list of integers representing the daily stock prices. If it is not possible to make any profit, the function should return 0. The function should start with: ```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 maxProfit(prices: List[int]) -> int: """ Calculate the maximum profit that can be obtained by buying and selling a stock at most once. Args: prices (List[int]): A list of integers repres...
magic_instruct_75k
8,005
Write a Python function to translate bit-vector operations from one representation to another based on a provided mapping dictionary. The function should take a bit-vector operation as input and return its corresponding translation in the new format. If the operation is not found in the mapping dictionary, the function...
Here is the Python code to solve the given problem in the markdown block: ```python def translate_bitvector_operation(operation: str) -> str: """ Translates a bit-vector operation from one representation to another based on a provided mapping dictionary. Args: operation (str): The bit-vector operat...
magic_instruct_75k
8,008
Write a Python function to manage a collection of integers and provide various operations for manipulating and querying the collection. The function should support operations such as adding elements, removing elements, finding the minimum and maximum values, and calculating the sum of all elements. The function should ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Optional class IntegerCollection: def __init__(self): self.elements: List[int] = [] def add_element(self, value: int) -> None: """ Adds a new integer to the collection. ...
magic_instruct_75k
8,022
Write a Python function to generate a formatted dependency report for a software project. The function should process a list of dictionaries, where each dictionary represents an imported external dependency. Each dictionary contains the following keys: - "name": the name of the dependency - "artifact": the artifact ide...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def generate_dependency_report(dependencies: List[Dict[str, any]]) -> str: """ Generates a formatted dependency report for a software project. Args: dependencies (List[Dict[str, any]])...
magic_instruct_75k
8,028
Write a Python function to determine the type of land access based on a given integer code. The function should handle various categories of land access, each represented by a unique code. If the input code does not match any of the defined land access types, the function should return "UNKNOWN". The code should start...
Here is the Python code to solve the given problem in the markdown block: ```python def landAccessType(code: int) -> str: """ Determine the type of land access based on the given integer code. Args: code (int): The integer code representing the type of land access. Returns: str: The co...
magic_instruct_75k
8,059
Write a Python function to find the top `n` events based on their occurrence count from a given dictionary. The dictionary contains keys representing events in the format "top_events_<event_name>" and their corresponding occurrence count as values. The function should return a list of the top `n` events based on their ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def find_top_events(match: dict, n: int) -> List[str]: """ Find the top `n` events based on their occurrence count from a given dictionary. Args: match (dict): A dictionary where keys are in...
magic_instruct_75k
8,072
Write a Python function `buildAutomation(commands: List[str]) -> List[str]` that simulates a build automation tool. The function should take a list of commands as input and return a list of strings representing the tasks performed by the build automation tool based on the executed commands. The function should handle t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def buildAutomation(commands: List[str]) -> List[str]: """ Simulates a build automation tool that performs specific tasks based on the commands provided. Args: commands (List[str]): A list o...
magic_instruct_75k
8,124
Write a Python function to extract a random patch of a specified size from a given 2D image array. The image is represented as a list of lists, and the patch size is an integer representing the side length of a square patch. If the image is smaller than the patch size in either dimension, the entire image should be con...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import random def extract_random_patch(image: List[List[int]], patch_size: int) -> List[List[int]]: """ Extracts a random patch of the specified size from the given 2D image array. Args: ima...
magic_instruct_75k
8,177
Write a Python function `project_to_lon_lat` that takes a `projector` function and a list of geographical coordinates in a specific projection and returns a list of tuples representing the projected coordinates in longitude and latitude. The `projector` function takes x and y coordinates and returns the projected coord...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Callable def project_to_lon_lat(projector: Callable[[float, float], Tuple[float, float]], geo_coordinates: List[Tuple[float, float]]) -> List[Tuple[float, float]]: """ Projects a list of geograph...
magic_instruct_75k
8,184
Write a Python function called `remove_duplicate_imports` that takes a list of strings `imports` as input and returns a new list with duplicate imports removed. The function should ignore case sensitivity when comparing imports. The function should maintain the order of the first occurrence of each import. The code sh...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_duplicate_imports(imports: List[str]) -> List[str]: """ Removes duplicate imports from a list of import statements, ignoring case sensitivity. Args: imports (List[str]): A list of...
magic_instruct_75k
8,187
Write a Python function to calculate the average test score from a given dataset. The dataset is represented as a 2D array where each row corresponds to a student and each column represents a different attribute. The first column contains the students' test scores. The function should extract the test scores from the f...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def calculate_average_score(data: List[List[float]]) -> float: """ Calculate the average test score from a given dataset. Args: data (List[List[float]]): A 2D array where each row correspond...
magic_instruct_75k
8,206
Write a Python function to update a list of dictionaries representing database column mappings. Each dictionary in the list contains two key-value pairs: 'old_name' and 'new_name', representing the old and new column names, respectively. The function should replace the old column name with the new column name in each d...
Here is the Python code to solve the given problem in the markdown block: ```python def update_column_mappings(column_mappings: list, old_name: str, new_name: str) -> list: """ Updates the 'old_name' key in each dictionary of the provided list to 'new_name' if 'old_name' matches the provided 'old_name'. Ar...
magic_instruct_75k
8,208
Write a Python function to remove a specific package from a list of packages. The function should take in the list of packages and the name of the package to be removed as input and return the updated list of packages. If the specified package is not present in the list, the function should return the original list wit...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def remove_package(packages: List[str], package_name: str) -> List[str]: """ Removes a specific package from a list of packages. Args: packages (List[str]): The list of package names. ...
magic_instruct_75k
8,214
Create a Python class named `Keyboard` that represents a musical keyboard. The class should have methods to set the sound, sound volume, and color of the keyboard. Additionally, implement a method `playMusic()` that returns a string representing the music played by the keyboard. The `playMusic` method should return the...
Here is the Python code to solve the given problem in the markdown block: ```python class Keyboard: def __init__(self): """ Initialize the Keyboard class with default values for sound, sound volume, and color. """ self.sound = "default_sound" self.sound_volume = 0 sel...
magic_instruct_75k
8,225
Write a Python function to parse a comma-separated line of text and extract an integer `hostid` from it. The function should take a string `line` containing comma-separated values and store these values in a list of tokens. The first token in the list represents the `hostid`, and the function should convert it to an in...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def parse_line(line: str) -> int: """ Parses a comma-separated line of text and extracts the integer `hostid` from it. Args: line (str): A string containing comma-separated values. Retu...
magic_instruct_75k
8,228
Write a Python function to convert a given integer to a byte array using a specified byte order and then convert the byte array back to the original integer. The function should handle both 'big' and 'little' endian byte orders. The code should start with: ```python def int_to_byte(num: int, num_bytes: int, byte_order...
Here is the Python code to solve the given problem in the markdown block: ```python def int_to_byte(num: int, num_bytes: int, byte_order: str) -> bytes: """ Convert an integer to a byte array using the specified byte order. Args: num (int): The integer to be converted. num_bytes (int): The ...
magic_instruct_75k
8,272
Write a Python program that implements a simple calculator with functions for addition, subtraction, multiplication, and division. Each function should take two parameters and return the result of the corresponding arithmetic operation. Additionally, the division function should handle the case where division by zero o...
Here is the Python code to solve the given problem in the markdown block: ```python def add(a: float, b: float) -> float: """ Adds two numbers and returns the result. Args: a (float): The first number. b (float): The second number. Returns: float: The sum of the two numbers. ...
magic_instruct_75k
8,292
Write a Python function to determine if a given string containing parentheses, brackets, and curly braces is valid. The string is considered valid if all the parentheses, brackets, and curly braces are properly nested and closed. The function should return `True` if the string is valid, and `False` otherwise. The code...
Here is the Python code to solve the given problem in the markdown block: ```python def isValidParentheses(s: str) -> bool: """ Determines if the given string containing parentheses, brackets, and curly braces is valid. A string is considered valid if all the parentheses, brackets, and curly braces are pro...
magic_instruct_75k
8,313
Write a Python function to filter a list of patients based on specific criteria. The function should take a list of dictionaries, where each dictionary represents a patient and contains their information. The keys in the dictionary are 'name' (string), 'age' (integer), and 'gender' (string). The function should also ta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict, Union def filter_patients(patients: List[Dict[str, Union[str, int]]], criteria: str, value: Union[str, int]) -> List[Dict[str, Union[str, int]]]: """ Filters a list of patients based on the specif...
magic_instruct_75k
8,332
Write a Python function to analyze a given HTML/CSS code snippet and count the unique font families used within the style definitions. The function should handle both inline and external CSS styles. The input is a string representing the CSS code snippet. The font families will be listed within the `font-family` proper...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict import re def count_font_families(css_code: str) -> Dict[str, int]: """ Analyzes a given HTML/CSS code snippet to identify and count the unique font families used within the style definitions. Args:...
magic_instruct_75k
8,378
Write a Python function to calculate the minimum bounding rectangle (MBR) that encloses a given set of 2D points and return the y-coordinate of the upmost vertex of this MBR. The MBR is the smallest rectangle aligned with the coordinate axes that completely encloses all the points. The upmost vertex refers to the verte...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def upmost_vertex(points: List[Tuple[int, int]]) -> int: """ Calculate the y-coordinate of the upmost vertex of the minimum bounding rectangle (MBR) that encloses a given set of 2D points. Ar...
magic_instruct_75k
8,381
Write a Python function to construct a valid `find` command for the Unix-like operating systems based on the given parameters. The function should take in three parameters: `path` (a string representing the starting directory for the search), `match_type` (a string representing the type of match to be performed, e.g., ...
Here is the Python code to solve the given problem in the markdown block: ```python def construct_find_command(path: str, match_type: str, aprune: str) -> str: """ Constructs a valid `find` command for Unix-like operating systems based on the given parameters. Args: path (str): The starting directo...
magic_instruct_75k
8,385
Write a Python function to analyze the external vertices of a graph based on the weights of the edges they are connected to. The function should return four sets of vertices: 1. `extern_in_fermion_vtcs`: Vertices connected to edges of weight 1 and are also external vertices. 2. `extern_out_fermion_vtcs`: Vertices conne...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Set, Tuple def analyze_external_vertices(graph: Dict[str, Dict[str, int]], external_vtcs_set: Set[str]) -> Tuple[Set[str], Set[str], Set[str], Set[str]]: """ Analyze the external vertices of a graph bas...
magic_instruct_75k
8,404
Write a Python function to process command-line arguments to set the version of a software package. The function should default to using the "devel" version if no argument is provided. The function should then return the version. The code should start with: ```python import sys def get_software_version() -> str: ```
Here is the Python code to solve the given problem in the markdown block: ```python import sys def get_software_version() -> str: """ Process command-line arguments to set the version of a software package. Defaults to using the "devel" version if no argument is provided. Returns: str: The ver...
magic_instruct_75k
8,424
Write a Python function to validate the metadata of a Python package. The function should check if the metadata dictionary meets the following criteria: 1. The 'packages' key should exist and its value should be a list of package names. 2. The 'license' key should exist and its value should be a string representing the...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict def validate_package_metadata(metadata: Dict[str, any]) -> bool: """ Validates the metadata of a Python package to ensure it meets the specified criteria. Args: metadata (Dict[str, any]): A ...
magic_instruct_75k
8,436
Write a Python function to find the shortest path from a start vertex to an end vertex in a directed graph using breadth-first search (BFS). The graph is represented as an adjacency list, where each key is a vertex and the value is a list of its neighboring vertices. The vertices are represented as integers. The start ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List from collections import deque def shortest_path(graph: Dict[int, List[int]], start: int, end: int) -> List[int]: """ Find the shortest path from the start vertex to the end vertex in a directed gra...
magic_instruct_75k
8,437
Write a Python function to calculate the sum of all even numbers in a given list of integers. The function should take a list of integers as input and return the sum of all the even numbers in the list. The code should start with: ```python from typing import List def sum_of_even_numbers(numbers: List[int]) -> int: ``...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def sum_of_even_numbers(numbers: List[int]) -> int: """ Calculate the sum of all even numbers in a given list of integers. Args: numbers (List[int]): A list of integers. Returns: ...
magic_instruct_75k
8,444
Write a Python function to calculate the total number of occurrences of a given word in a list of strings, ignoring case differences. The function should take two parameters: a list of strings and a target word. The function should return the total number of occurrences of the target word in the list of strings, consid...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_word_occurrences(strings: List[str], target_word: str) -> int: """ Calculate the total number of occurrences of a given word in a list of strings, ignoring case differences. Args: ...
magic_instruct_75k
8,449
Write a Python function to calculate the maximum possible total score that can be achieved by any player in a game, given a list of integers representing the scores. The score of each player is the sum of their best two scores. The function should take a list of scores as input and return the maximum total score. The ...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def maxTotalScore(scores: List[int]) -> int: """ Calculate the maximum possible total score that can be achieved by any player in a game. The score of each player is the sum of their best two scores....
magic_instruct_75k
8,454
Write a Python function to process a list of strings representing various operations on a backup system. The function should perform the specified operations and return the final state of the backup system. The operations that can appear in the input list are: - `'BackupList'`: This operation indicates that a new backu...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def process_backup_operations(operations: List[str]) -> List[str]: """ Processes a list of operations on a backup system and returns the final state of the backup system. Args: operations (L...
magic_instruct_75k
8,470
Write a Python function to filter out commented file paths from a list of file paths. Each file path in the list may be active (non-commented) or commented out using the '#' symbol at the beginning of the string. The function should return a new list containing only the active file paths. 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 extract_active_file_paths(file_paths: List[str]) -> List[str]: """ Extracts and returns a list of active (non-commented) file paths from a given list of file paths. Args: file_paths (Lis...
magic_instruct_75k
8,491
Write a Python function to perform string substitution based on a given dictionary of key-value pairs. The function should replace any occurrences of the keys in the input string with their corresponding values from the dictionary. If a key is not found in the dictionary, it should remain unchanged in the output string...
Here is the Python code to solve the given problem in the markdown block: ```python def perform_substitution(input_string: str, substitution_dict: dict) -> str: """ Perform string substitution based on a given dictionary of key-value pairs. Args: input_string (str): The input string in which substi...
magic_instruct_75k
8,515
Write a Python function `create_new` that takes a list of integers as input and returns a new list where each element in the original list is appended with an additional value calculated using the `run_op` function. The `run_op` function performs a specific operation on the input numbers, and the result of this operati...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def create_new(numbers: List[int]) -> List[int]: """ Creates a new list where each element in the original list is appended with an additional value calculated using the `run_op` function. Args:...
magic_instruct_75k
8,567
Write a Python function to count the occurrences of each unique file extension in a given list of file names. The function should handle cases where file names may not have an extension or have multiple extensions. The code should start with: ```python from typing import List, Dict def count_file_extensions(file_list:...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Dict def count_file_extensions(file_list: List[str]) -> Dict[str, int]: """ Count the occurrences of each unique file extension in the given list of file names. Args: file_list (List[str]):...
magic_instruct_75k
8,587
Write a Python function to automate the population of data to a citizen provider using the information from a `version.json` file. The `version.json` file contains the `namespace` and `provider` information required for the population process. The function should: 1. Read the `namespace` and `provider` information from...
Here is the Python code to solve the given problem in the markdown block: ```python import json from typing import Dict def simulate_citizen_provider_command(namespace: str, provider: str) -> None: """ Simulates the execution of the citizen provider command using the provided namespace and provider. Args:...
magic_instruct_75k
8,590
Write a Python function to generate a command string that simulates sending a variable to a Spark cluster using a simplified version of the `%%send_to_spark` magic command in Jupyter notebooks. The function should take a variable and its name as inputs and return a string representing the command. The command should in...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_send_to_spark_command(variable, var_name: str) -> str: """ Generates a command string to simulate sending a variable to a Spark cluster using a simplified version of the `%%send_to_spark` magic command. Args: ...
magic_instruct_75k
8,594
Write a Python function to modify the settings of a plotly graph dictionary. The input dictionary contains settings for a plotly graph, including a date range slider. The function should modify the thickness of the date range slider and set its visibility to False. The function should handle the input dictionary struct...
Here is the Python code to solve the given problem in the markdown block: ```python def modify_plot_settings(input_dict: dict) -> dict: """ Modifies the settings of a plotly graph dictionary by adjusting the visibility and thickness of the date range slider. Args: input_dict (dict): The input dicti...
magic_instruct_75k
8,600
Write a Python function to calculate the total number of distinct ways to reach the top of a staircase where you can climb either 1 or 2 steps at a time. The function should take the number of steps in the staircase as input and return the total number of ways to reach the top. The function should be named `count_ways_...
Here is the Python code to solve the given problem in the markdown block: ```python def count_ways_to_top(n: int) -> int: """ Calculate the total number of distinct ways to reach the top of a staircase with `n` steps, where you can climb either 1 or 2 steps at a time. Args: n (int): The number ...
magic_instruct_75k
8,622
Write a Python function to calculate the Jaccard similarity coefficient between two sets. The Jaccard similarity coefficient is defined as the size of the intersection of the two sets divided by the size of the union of the two sets. The function should take two parameters, `A` and `B`, representing the two sets, and r...
Here is the Python code to solve the given problem in the markdown block: ```python def jaccard_similarity_coefficient(A: set, B: set) -> float: """ Calculate the Jaccard similarity coefficient between two sets. The Jaccard similarity coefficient is defined as the size of the intersection of the two se...
magic_instruct_75k
8,627
Write a Python function to determine the latest migration version for a given app label from a list of database migration operations. Each migration operation is represented as a tuple containing the app label and the migration version. The migration versions follow a naming convention where the first four characters r...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple def get_latest_migration_version(operations: List[Tuple[str, str]], app_label: str) -> str: """ Determine the latest migration version for a given app label from a list of database migration opera...
magic_instruct_75k
8,639
Write a Python function to count the number of button presses in a game where the button state is represented by a list of boolean values. Each `True` value in the list indicates a button press, and each `False` value indicates no press. The function should return the total count of button presses. The code should sta...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def count_button_presses(button_states: List[bool]) -> int: """ Counts the number of button presses in a game based on a list of boolean values. Args: button_states (List[bool]): A list of b...
magic_instruct_75k
8,665
Write a Python function named `format_location_details` that processes location data and returns a formatted string representing the details of the location. The function should handle cases where certain details are missing and provide default values for them. The function should take a dictionary `data` as input, whi...
Here is the Python code to solve the given problem in the markdown block: ```python def format_location_details(data: dict) -> str: """ Formats the location details from a dictionary and returns a formatted string. Args: data (dict): A dictionary containing the keys 'name', 'type', and 'dimension'....
magic_instruct_75k
8,666
Write a Python function to parse a model architecture string and return a dictionary containing the parsed information. The model architecture string is specified in a custom format that includes the type of model, the number of layers, and the number of hidden units. The format is as follows: ``` --model-arch <model_t...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, Union def parse_model_architecture(model_architecture: str) -> Union[Dict[str, Union[str, int]], None]: """ Parses a model architecture string and returns a dictionary containing the parsed information....
magic_instruct_75k
8,674
Write a Python function to automate the process of running Symfony console commands within a Docker container using `docker-compose exec`. The function should take the following inputs: - `service_name`: The name of the Docker service where the Symfony application is running. - `user`: The user to be used within the co...
Here is the Python code to solve the given problem in the markdown block: ```python def run_symfony_command(service_name: str, user: str, command: str) -> str: """ Constructs and returns a `docker-compose exec` command to run a Symfony console command within a Docker container. Args: service_name (...
magic_instruct_75k
8,676
Write a Python function `process_plugins` that processes a dictionary of plugin information and returns a modified version of the dictionary. The input dictionary `params` contains a key `'plugin_info'` which is a list of dictionaries, each representing a plugin. Each plugin dictionary contains the keys `'name'`, `'ver...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import Dict, List def process_plugins(params: Dict[str, List[Dict[str, str]]]) -> Dict[str, List[Dict[str, str]]]: """ Processes a dictionary of plugin information and returns a modified version of the dictionary. ...
magic_instruct_75k
8,716
Write a Python function to extract the label text associated with form groups in an HTML file. Each form group is defined by a `<div>` element with the class "form-group", and the label text is enclosed within a `<label>` tag immediately following the opening `<div>` tag. The function should take a string `html` repres...
Here is the Python code to solve the given problem in the markdown block: ```python import re def extract_form_labels(html: str) -> list: """ Extracts the label text associated with form groups in an HTML file. Args: html (str): A string representing the HTML code. Returns: list: A li...
magic_instruct_75k
8,738
Implement a custom dictionary class in Python that supports sorting its attributes based on the keys. The class should have the following functionalities: - Initialize the dictionary with optional keyword arguments and a flag to indicate whether the attributes should be sorted. - Allow getting, setting, and deleting it...
Here is the Python code to solve the given problem in the markdown block: ```python class CustomDict: """ A custom dictionary class that supports sorting its attributes based on the keys. Attributes: sort_attrs (bool): A flag indicating whether the dictionary keys should be sorted. _dict (d...
magic_instruct_75k
8,785
Write a Python function to count the number of prime numbers less than a given integer `n` using the Sieve of Eratosthenes algorithm. The function should efficiently mark non-prime numbers and count the remaining prime numbers. The code should start with: ```python def count_primes(n: int) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_primes(n: int) -> int: """ Count the number of prime numbers less than a given integer `n` using the Sieve of Eratosthenes algorithm. Args: n (int): The upper limit to count prime numbers less than this va...
magic_instruct_75k
8,790
Write a Python function to calculate the sum of all even numbers in a given list. The function should take a list of integers as input and return the sum of all the even numbers in the list. If the list is empty or does not contain any even numbers, the function should return 0. 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 sum_of_even_numbers(numbers: List[int]) -> int: """ Calculate the sum of all even numbers in a given list of integers. Args: numbers (List[int]): A list of integers. Returns: ...
magic_instruct_75k
8,793
Write a Python function `process_attribute(attribute)` that takes a dictionary `attribute` as input and returns a modified dictionary with the data type and data processed according to the following rules: - If the data type is "string", the data should be converted to uppercase. - If the data type is "integer", the da...
Here is the Python code to solve the given problem in the markdown block: ```python def _get_data_and_type(attribute): return attribute['data'], attribute['type'] def return_data(data_type, data): return {'type': data_type, 'data': data} def process_attribute(attribute): """ Processes the data in the ...
magic_instruct_75k
8,796
Write a Python function to generate a Slurm script based on the input parameters provided. The function should take the following input parameters: - `job_name` (string): The name of the job. - `output_file` (string): The name of the output file for the job. - `email` (string): The email address to which notifications ...
Here is the Python code to solve the given problem in the markdown block: ```python def generate_slurm_script(job_name: str, output_file: str, email: str, email_type: str, gpu_count: int) -> str: """ Generates a Slurm script based on the provided input parameters. Args: job_name (str): The name of ...
magic_instruct_75k
8,844
Write a Python function to paginate a list of items. Given a list of items, the number of items per page, and the page number, the function should return the items on the specified page. If the page number is invalid (i.e., it exceeds the number of pages), the function should return an empty list. The code should star...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List import math def paginate_items(items: List[str], items_per_page: int, page_number: int) -> List[str]: """ Paginate a list of items and return the items on the specified page. Args: items (Li...
magic_instruct_75k
8,847
Write a Python function `generate_fizz_buzz_list(start: int, end: int) -> List[str]` that generates a list of strings based on a given range of numbers. Each string in the list should represent a number from the range, but with specific conditions applied: - For multiples of 3, the string should contain "Fizz". - For m...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List def generate_fizz_buzz_list(start: int, end: int) -> List[str]: """ Generates a list of strings based on the given range of numbers, applying the FizzBuzz rules. Args: start (int): The start...
magic_instruct_75k
8,863
Write a Python function to count the number of vowels in a given string. The function should be case-insensitive, meaning both uppercase and lowercase vowels should be counted. The function should start with: ```python def count_vowels(alert: str) -> int: ```
Here is the Python code to solve the given problem in the markdown block: ```python def count_vowels(alert: str) -> int: """ Counts the number of vowels (a, e, i, o, u) in a given string. Args: alert (str): The input string in which to count the vowels. Returns: int: The number of vowe...
magic_instruct_75k
8,869
Write a Python function `create_url_mapping` that takes a list of tuples as input, where each tuple contains a URL pattern and a view function name. The function should return a dictionary where the keys are the view function names and the values are lists of corresponding URL patterns. The code should start with: ```...
Here is the Python code to solve the given problem in the markdown block: ```python from typing import List, Tuple, Dict def create_url_mapping(url_patterns: List[Tuple[str, str]]) -> Dict[str, List[str]]: """ Creates a dictionary mapping view function names to their corresponding URL patterns. Args: ...