text stringlengths 1.7k 17.6k | category stringclasses 1
value | source stringclasses 1
value | n_tokens int64 497 3.65k | hash stringlengths 32 32 |
|---|---|---|---|---|
user: Count leaf values reachable via a dot-notation path in a nested dict/list structure.
def count_path_elements(data: dict | list, path: str) -> int:
"""Count leaf values reachable via a dot-notation path in a nested structure.
Lists in the structure are transparent (items are traversed).
If a fina... | Chat | GPT-5.6-luna-reasoning-102881x | 3,235 | b718f75febde1f6da50ce49f1c12ec20 |
user: Merges configuration dictionaries with locking, filtering, and sanitization rules without mutating inputs.
def secure_config_overlay(defaults: dict, overrides: dict, locked: set) -> dict:
"""Merges overrides into defaults with specific security and sanitization rules.
Rules:
1. Return a new dictiona... | Chat | GPT-5.6-luna-reasoning-102881x | 3,632 | 49c00a9996f0479c8080261847c97878 |
user: Validates and normalizes a dot-separated resource path based on access tier constraints and formatting rules.
def normalize_resource_path(path: str, tier: str) -> str:
"""Validates and normalizes a dot-separated resource path based on access tier constraints.
Rules:
1. Access tiers limit dot depth: ... | Chat | GPT-5.6-luna-reasoning-102881x | 3,648 | b7d34b136749f4a3d37985d52f1efea7 |
user: Replace defined tokens in a string with their values, ensuring longer tokens take precedence and supporting backslash escapes.
def resolve_tokens(text: str, tokens: dict[str, str]) -> str:
"""Replace tokens in text with mapped values, prioritizing longer tokens
to prevent partial matches. Supports '\\' e... | Chat | GPT-5.6-luna-reasoning-102881x | 3,135 | e05f8616357411aac0d4f36d88f49527 |
user: Simulate a command execution with retries and exponential backoff calculation.
def retry_with_backoff(max_retries: int, failure_sequence: list[bool]) -> tuple[int, int] | None:
"""Simulate a command execution with retries and exponential backoff.
Attempts an operation up to max_retries + 1 times. If an ... | Chat | GPT-5.6-luna-reasoning-102881x | 2,729 | e90661eb63b6f59400b1b533d636170e |
user: Sort task IDs by custom priority level and due date.
def prioritize_tasks(tasks: list[dict]) -> list[str]:
"""Sort tasks by priority (High > Medium > Low) and due date (newest first).
Tasks with missing due dates are treated as oldest. Returns a list of task IDs.
Examples:
>>> prioritize_ta... | Chat | GPT-5.6-luna-reasoning-102881x | 3,148 | ed4f26ee6d478d4359c4dc288be14c51 |
user: Recursively resolve nested macro placeholders in a help template string with cycle detection.
def expand_help_macros(template: str, macros: dict[str, str]) -> str:
"""Recursively expand `{key}` placeholders in template using macros.
Perform up to 10 passes. If a cycle is detected (same string repeats),
... | Chat | GPT-5.6-luna-reasoning-102881x | 3,227 | 55b875fd1c7272aa363e1f378e8a6057 |
user: Resolve an architecture string through a chain of aliases with cycle detection and normalization.
def resolve_canonical_arch(arch: str, aliases: dict[str, str]) -> str | None:
"""Resolve an architecture string through a chain of aliases.
Normalizes input (lowercase, strip) and follows the alias chai... | Chat | GPT-5.6-luna-reasoning-102881x | 2,880 | 8fdd69dd80d03f344be8f825705d2250 |
user: Validate and sanitize text for XML safety by detecting encoding issues and non-printable characters
def validate_xml_safe_text(text: str, encoding: str = 'latin-1') -> dict:
"""Validate text for XML safety and return sanitization report.
Checks if text contains non-printable characters that would br... | Chat | GPT-5.6-luna-reasoning-102881x | 3,374 | a794eca8fabb593b03bb453165ee4130 |
user: Generates a secure asset URL with an optional base64-encoded metadata fragment.
import base64
import json
from typing import Optional, Dict, Any
def generate_asset_link(domain: str, asset_id: str, meta: Optional[Dict[str, Any]]) -> str:
"""Constructs a URL with an optional base64-encoded metadata fragment.
... | Chat | GPT-5.6-luna-reasoning-102881x | 2,975 | e4ad555d7993338e9b8f6a18da094a26 |
user: Merge configuration dictionaries enforcing type safety via a schema.
from typing import Any, Dict, Type
def merge_validated_config(base: Dict[str, Any], overrides: Dict[str, Any], schema: Dict[str, Type]) -> Dict[str, Any]:
"""Merge base and override configs, applying overrides only if they match the expect... | Chat | GPT-5.6-luna-reasoning-102881x | 2,302 | 1bb1fb50019990fc6abdbfe9aaecc95b |
user: Parses a JSON string, flattens nested structures, masks sensitive keys, and normalizes types.
import json
from typing import Any, Dict
def sanitize_config_string(config_str: str) -> Dict[str, Any]:
"""Parses a JSON configuration string, flattens nested structures into dot-notation keys,
masks sensitive ... | Chat | GPT-5.6-luna-reasoning-102881x | 2,963 | 2db39f5b76e7ad4a6cc7e27d24ecc357 |
user: Normalizes SQL column type definitions to enforce specific nullability constraints while handling existing constraints and whitespace.
def refine_sql_type(type_definition: str, nullable: bool) -> str:
"""Enforces a specific nullability constraint on a SQL type definition string.
Removes any existing... | Chat | GPT-5.6-luna-reasoning-102881x | 2,898 | b92d709404406feabfd395f55b020822 |
End of preview. Expand in Data Studio
README.md exists but content is empty.
- Downloads last month
- 5