File: typing.py

package info (click to toggle)
python-sybil 9.2.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,148 kB
  • sloc: python: 4,510; makefile: 90
file content (21 lines) | stat: -rw-r--r-- 718 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from collections.abc import Callable, Iterable
from typing import TYPE_CHECKING, Optional, Any, Dict

if TYPE_CHECKING:
    import sybil


#: The signature for an :term:`evaluator`.
Evaluator = Callable[['sybil.Example'], Optional[str]]

#: The signature for a :term:`lexer`.
#: Lexers must not set :attr:`~sybil.Region.parsed` or :attr:`~sybil.Region.evaluator`
#: on the :class:`~sybil.Region` instances they return.
Lexer = Callable[['sybil.Document'], Iterable['sybil.Region']]

#: The signature for a :term:`parser`.
Parser = Callable[['sybil.Document'], Iterable['sybil.Region']]

# This could likely be a TypedDict.
#: Mappings used to store lexemes for a :class:`~sybil.Region`.
LexemeMapping = Dict[str, Any]