English
Utility functions for constructing English sentences that talk about Python objects in a user-friendly manner.
a_noun
a_noun(noun: str) -> str
Return 'noun' with the correct English indefinite article prepended (e.g. 'a string', 'an integer').
Implements only the basic a/an rule, not any of the subtleties (vocalic Y, "S" pronounced "ess", etc).
a_type
a_type(thing: Any) -> str
Return a less cryptic, YAML-flavored version of the name of the type of 'thing' (e.g. 'str' becomes 'string' and 'list' becomes 'sequence') with the correct English indefinite article prepended ('a string', 'an integer').
If 'thing' is already a type object, uses the name of 'thing' itself, not the name of type(thing) (which would always be "type").
repr_rx
repr_rx(rx: Pattern[Any]) -> str
Produce a human-readable, unambiguous serialization of regex RX, in the usual /pattern/ notation.
type_s
type_s(thing: Any) -> str
Return a less cryptic, YAML-flavored version of the name of the type of 'thing' (e.g. 'str' becomes 'string' and 'list' becomes 'sequence'), pluralized.
If 'thing' is already a type object, uses the name of 'thing' itself, not the name of type(thing) (which would always be "type").