o
    t#gy                     @   sz  d Z ddlmZ ddlmZmZmZmZmZm	Z	 ddl
mZ g dZG dd de	ejd	f Zeee ee gd
f Z	
		
	
ddedee dedeeegef  deeegeej f  dee fddZ	
		
	
ddedee dedeeegef  deeegeej f  dee fddZ	
ddedee dedeeegef  dedeeegeej f  dee fddZd
S )z>Methods for traversing trees of otData-driven OpenType tables.    )deque)CallableDequeIterableListOptionalTuple   )	BaseTable)bfs_base_tabledfs_base_tableSubTablePathc                   @   s   e Zd ZdefddZdS )r   returnc                 C   sD   g }| D ]}|j }|jd ur|d|j d7 }|| qd|S )N[].)nameindexappendjoin)self
path_partsentry	path_part r   /var/www/static.ux5.de/https/Moving-Object-Detection-with-OpenCV/env/lib/python3.10/site-packages/fontTools/ttLib/tables/otTraverse.py__str__   s   

zSubTablePath.__str__N)__name__
__module____qualname__strr   r   r   r   r   r      s    r   .NFrootroot_accessor	skip_root	predicateiter_subtables_fnr   c                 c   "    t | |||dd |E dH  dS )aK  Depth-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.
    c                 S   s   |  t|S N)
extendleftreversedfrontiernewr   r   r   <lambda>A   s    z dfs_base_table.<locals>.<lambda>N_traverse_ot_datar!   r"   r#   r$   r%   r   r   r   r         r   c                 c   r&   )a7  Breadth-first search tree of BaseTables.

    Args:
    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                 S   s
   |  |S r'   )extendr*   r   r   r   r-   i   s   
 z bfs_base_table.<locals>.<lambda>Nr.   r0   r   r   r   r   F   r1   r   add_to_frontier_fnc           	      #   s    |d u r
t | j}|d u rdd }|d u rdd }t }t|| |s,|f n||fdd|| D  |rc|   d j}| sJq:t V   fdd||D }||| |s<d S d S )	Nc                 S   s   dS )NTr   pathr   r   r   r$   ~   s   z$_traverse_ot_data.<locals>.predicatec                 S   s   |   S r'   )iterSubTables)tabler   r   r   r%      s   z,_traverse_ot_data.<locals>.iter_subtables_fnc                    s   g | ]} |fqS r   r   .0subtable_entry)
root_entryr   r   
<listcomp>   s    z%_traverse_ot_data.<locals>.<listcomp>c                    s   g | ]} |f qS r   r   r8   r4   r   r   r<      s    
)	typer   r   r
   SubTableEntryr   popleftvaluer   )	r!   r"   r#   r$   r3   r%   r+   currentnew_entriesr   )r5   r;   r   r/   n   s8   





r/   )NFNNr'   )__doc__collectionsr   typingr   r   r   r   r   r   otBaser
   __all__r?   r   AddToFrontierFnr    boolr   r   r/   r   r   r   r   <module>   s~     
*
0	