stenotype.backend package¶
Submodules¶
stenotype.backend.elements module¶
Steno Type Elements
Representations of the fundamental stenotype
building blocks.
Each element holds the relevant information for both a stenotype
and
typing
conversion.
Note that all elements are represented as values, not types:
A Steno
encodes stenotype
syntax/code,
not any concrete types.
For example, Identifier('typing', 'List')
is not the type typing.List
but represents the name typing.List
.
-
class
stenotype.backend.elements.
Identifier
[source]¶ Bases:
typing.Tuple
A qualified name, such as
typing.Tuple
-
class
stenotype.backend.elements.
Generic
[source]¶ Bases:
tuple
A generic type, such as
typing.List[int]
-
property
base
¶ Alias for field number 0
-
property
parameters
¶ Alias for field number 1
-
property
-
class
stenotype.backend.elements.
Optional
[source]¶ Bases:
tuple
Optional type as
?base
, equivalent totyping.Optional[base]
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Union
[source]¶ Bases:
typing.Tuple
Union of types as
A or B
, equivalent totyping.Union[A, B]
-
class
stenotype.backend.elements.
Tuple
[source]¶ Bases:
tuple
Typed tuple as
(A, B, ...)
, equivalent totyping.Tuple[A, B, ...]
-
property
elements
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
List
[source]¶ Bases:
tuple
Typed list as
[values]
, equivalent totyping.List[values]
-
property
values
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Dict
[source]¶ Bases:
tuple
Typed dict as
{keys: values}
, equivalent totyping.Dict[keys, values]
-
property
keys
¶ Alias for field number 0
-
property
values
¶ Alias for field number 1
-
property
-
class
stenotype.backend.elements.
Set
[source]¶ Bases:
tuple
Typed dict as
{values}
, equivalent totyping.Set[values]
-
property
values
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Literal
[source]¶ Bases:
tuple
Literal value, not a type
-
property
value
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Iterable
[source]¶ Bases:
tuple
Typed iterable as
iter base
, equivalent totyping.Iterable[base]
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Context
[source]¶ Bases:
tuple
Typed context manager as
with base
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Awaitable
[source]¶ Bases:
tuple
Typed awaitable as
await base
, equivalent totyping.Awaitable[base]
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
AsyncIterable
[source]¶ Bases:
tuple
Typed async iterable as
async iter base
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
AsyncContext
[source]¶ Bases:
tuple
Typed async context manager as
async with base
-
property
base
¶ Alias for field number 0
-
property
-
class
stenotype.backend.elements.
Parameter
[source]¶ Bases:
tuple
Typed parameter of a call signature as
name: base
-
property
name
¶ Alias for field number 0
-
property
base
¶ Alias for field number 1
-
property
-
class
stenotype.backend.elements.
Signature
[source]¶ Bases:
tuple
Typed signature as
(p: P, /, m: M, *a: A, k: K, **kw: KW) -> R
-
property
returns
¶ return type, e.g.
() -> R
-
property
-
class
stenotype.backend.elements.
Callable
[source]¶ Bases:
tuple
Typed positional signature as
(A, B, /, C, D) -> R
-
property
positional
¶ Alias for field number 0
-
property
returns
¶ Alias for field number 1
-
property
-
stenotype.backend.elements.
Steno
= typing.Union[stenotype.backend.elements.Dots, stenotype.backend.elements.Identifier, stenotype.backend.elements.Any]¶ Any steno element
stenotype.backend.grammar module¶
stenotype.backend.steno module¶
-
stenotype.backend.steno.
unparse
(element: Union[stenotype.backend.elements.Dots, stenotype.backend.elements.Identifier, stenotype.backend.elements.Any]) → str[source]¶ Unparse element representation to a stenotype string
-
stenotype.backend.steno.
unparse_identifier
(element: stenotype.backend.elements.Identifier) → str[source]¶
-
stenotype.backend.steno.
unparse_callable
(element: stenotype.backend.elements.Callable) → str[source]¶
stenotype.backend.typing module¶
-
stenotype.backend.typing.
normalize
(element: Union[stenotype.backend.elements.Dots, stenotype.backend.elements.Identifier, stenotype.backend.elements.Any]) → Union[stenotype.backend.elements.Dots, stenotype.backend.elements.Identifier][source]¶ Normalize any element representation to the subset supported by typing
-
stenotype.backend.typing.
normalize_generic
(element: stenotype.backend.elements.Generic) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_callable
(element: stenotype.backend.elements.Callable) → stenotype.backend.elements.Callable[source]¶
-
stenotype.backend.typing.
normalize_any
(element: stenotype.backend.elements.Any) → stenotype.backend.elements.Identifier[source]¶
-
stenotype.backend.typing.
normalize_optional
(element: stenotype.backend.elements.Optional) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_union
(element: stenotype.backend.elements.Union) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_tuple
(element: stenotype.backend.elements.Tuple) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_list
(element: stenotype.backend.elements.List) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_dict
(element: stenotype.backend.elements.Dict) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_set
(element: stenotype.backend.elements.Set) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_literal
(element: stenotype.backend.elements.Literal) → stenotype.backend.elements.Generic[source]¶
-
stenotype.backend.typing.
normalize_shorthand
(element: Union[stenotype.backend.elements.Iterable, stenotype.backend.elements.Context, stenotype.backend.elements.Awaitable, stenotype.backend.elements.AsyncIterable, stenotype.backend.elements.AsyncContext]) → stenotype.backend.elements.Generic[source]¶