or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/dnspython@1.16.x
tile.json

tessl/pypi-dnspython

tessl install tessl/pypi-dnspython@1.16.0

DNS toolkit for Python supporting almost all record types with high-level and low-level DNS operations

Agent Success

Agent success rate when using this tile

85%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.37x

Baseline

Agent success rate without this tile

62%

task.mdevals/scenario-2/

Domain Normalizer

Build a small library that normalizes and inspects domain names with full IDNA handling.

Capabilities

Normalize inputs to canonical ASCII

  • Converts a mix of Unicode and ASCII domain strings to lowercase absolute ASCII with trailing dot, applying IDNA so ["Example.com", "bücher.example", "Example.com."] becomes ["example.com.", "xn--bcher-kva.example."] (duplicate removed). @test
  • Rejects names with empty labels or illegal characters by raising ValueError. @test

Unicode rendering

  • Produces Unicode representation (with trailing dot) when given a canonical ASCII domain such as xn--bcher-kva.example. returning bücher.example. @test

Hierarchy awareness

  • Determines whether api.eu.Example.com is inside example.com. after normalization (True) and example.net is not. @test
  • Returns the longest shared suffix between mail.bücher.example and bücher.example as xn--bcher-kva.example. (root represented as "." when no shared labels). @test

Implementation

@generates

API

from collections.abc import Iterable
from typing import List

def normalize_ascii(names: Iterable[str]) -> List[str]:
    """Normalize iterable of domain strings to canonical ASCII with trailing dots, removing duplicates in first-seen order and raising ValueError on invalid input."""

def to_unicode(name: str) -> str:
    """Render a canonical ASCII domain to Unicode with trailing dot preserved."""

def is_subdomain(candidate: str, parent: str) -> bool:
    """Return True if candidate is within parent after normalization, otherwise False."""

def common_suffix(name1: str, name2: str) -> str:
    """Return longest shared suffix of two domains as canonical ASCII with trailing dot (or '.' for the root)."""

Dependencies { .dependencies }

dnspython { .dependency }

Provides domain modeling and IDNA conversion utilities.