L idZddlmZddlmZmZmZmZmZm Z ddl m Z gdZ Gdde e jd fZeeeeegd fZ dd e d eed edeeegefdeee gee jfdeef dZ dd e d eed edeeegefdeee gee jfdeef dZ dd e d eed edeeegefdedeee gee jfdeefdZy )z>Methods for traversing trees of otData-driven OpenType tables.)deque)CallableDequeIterableListOptionalTuple) BaseTable)bfs_base_tabledfs_base_table SubTablePathceZdZdefdZy)rreturncg}|D]>}|j}|j|d|jdz }|j|@dj|S)N[].)nameindexappendjoin)self path_partsentry path_parts g/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/fontTools/ttLib/tables/otTraverse.py__str__zSubTablePath.__str__s_  )E I{{&q Q//   i (  ) xx ##N)__name__ __module__ __qualname__strrrrrrs$$rr.Nroot root_accessor skip_root predicateiter_subtables_fnrc#BKt||||d|Ed{y7w)aKDepth-first search tree of BaseTables. Args: root (BaseTable): the root of the tree. root_accessor (Optional[str]): attribute name for the root table, if any (mostly useful for debugging). skip_root (Optional[bool]): if True, the root itself is not visited, only its children. predicate (Optional[Callable[[SubTablePath], bool]]): function to filter out paths. If True, the path is yielded and its subtables are added to the queue. If False, the path is skipped and its subtables are not traversed. iter_subtables_fn (Optional[Callable[[BaseTable], Iterable[BaseTable.SubTableEntry]]]): function to iterate over subtables of a table. If None, the default BaseTable.iterSubTables() is used. Yields: SubTablePath: tuples of BaseTable.SubTableEntry(name, table, index) namedtuples for each of the nodes in the tree. The last entry in a path is the current subtable, whereas preceding ones refer to its parent tables all the way up to the root. c6|jt|SN) extendleftreversedfrontiernews rz dfs_base_table..Ash11(3-@rN_traverse_ot_datar%r&r'r(r)s rr r s,<! @  c#BKt||||d|Ed{y7w)aLBreadth-first search tree of BaseTables. Args: root the root of the tree. root_accessor (Optional[str]): attribute name for the root table, if any (mostly useful for debugging). skip_root (Optional[bool]): if True, the root itself is not visited, only its children. predicate (Optional[Callable[[SubTablePath], bool]]): function to filter out paths. If True, the path is yielded and its subtables are added to the queue. If False, the path is skipped and its subtables are not traversed. iter_subtables_fn (Optional[Callable[[BaseTable], Iterable[BaseTable.SubTableEntry]]]): function to iterate over subtables of a table. If None, the default BaseTable.iterSubTables() is used. Yields: SubTablePath: tuples of BaseTable.SubTableEntry(name, table, index) namedtuples for each of the nodes in the tree. The last entry in a path is the current subtable, whereas preceding ones refer to its parent tables all the way up to the root. c$|j|Sr,)extendr/s rr2z bfs_base_table..jshooc2rNr3r5s rr r Fs,>! 2 r6add_to_frontier_fnc#K|t|j}|d}|d}t}tj||}|s|j |fn||||Dcgc]}||fc}|r[|j } | dj} || s*t| || Dcgc]}| |fz } }||| |rZyycc}wcc}ww)Ncy)NTr$)paths rr(z$_traverse_ot_data..predicatesrc"|jSr,) iterSubTables)tables rr)z,_traverse_ot_data..iter_subtables_fns&&( (r) typer rr SubTableEntryrpopleftvaluer) r%r&r'r(r:r)r0 root_entrysubtable_entryr=current new_entriess rr4r4osT ++    )%*GH((=J  & '8&= "^,   !r(.. 4  rQsDCC $500#56$E,/l1CDdJK $(:> % %C=%%,!567 %  )hy'>'>??@ %l%T$(:> & &C=&&,!567 &  )hy'>'>??@ &l&b 42 42C=4242,!567 42 ( 42  )hy'>'>??@ 42l42r