Ë
    £ehí  ã                   ó°   — d Z  G d„ de«      Zdd„Zedk(  r@ddlZddlZ ej                   ej                  ej                  ¬«      j                  «       yy)	zB fontTools.misc.classifyTools.py -- tools for classifying things.
c                   ó<   — e Zd ZdZd
d„Zd„ Zd„ Zd„ Zd„ Zd„ Z	d„ Z
y	)Ú
ClassifierzL
    Main Classifier object, used to classify things into similar sets.
    c                 óZ   — t        «       | _        g | _        i | _        d| _        || _        y )NF)ÚsetÚ_thingsÚ_setsÚ_mappingÚ_dirtyÚ_sort)ÚselfÚsorts     úZ/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/fontTools/misc/classifyTools.pyÚ__init__zClassifier.__init__
   s'   € Ü“uˆŒØˆŒ
ØˆŒØˆŒØˆ�
ó    c                 óþ  — |syd| _         | j                  | j                  | j                  }}}t	        |«      }|j                  |«      }|j                  |«       |}~|r.|j                  |«       |j                  |«       |D ]  }|||<   Œ	 ~|rl|t        t        |«      «         }	|	j                  |«      }
|	j                  |
«       |j                  |
«       |j                  |
«       |
D ]  }|
||<   Œ	 ~
|rŒkyy)zI
        Add a set to the classifier.  Any iterable is accepted.
        NT)r	   r   r   r   r   ÚintersectionÚdifference_updateÚupdateÚappendÚnextÚiter)r   Úset_of_thingsÚthingsÚsetsÚmappingÚsr   Ú
differenceÚthingÚ	old_classÚold_class_intersections              r   ÚaddzClassifier.add   s	  € ñ ØàˆŒà $§¡¨d¯j©j¸$¿-¹-�g�ˆä�ÓˆØ—~‘~ fÓ-ˆØ	×Ñ˜LÔ)Øˆ
Øñ Ø�M‰M˜*Ô%Ø�K‰K˜
Ô#Ø#ò ,�Ø!+�˜’ð,àáà¤¤T¨,Ó%7Ó 8Ñ9ˆIØ%.×%;Ñ%;¸LÓ%IÐ"ð ×'Ñ'Ð(>Ô?ð ×*Ñ*Ð+AÔBð �K‰KÐ.Ô/Ø/ò 8�Ø!7�˜’ð8à&ô r   c                 ó4   — |D ]  }| j                  |«       Œ y)za
        Add a a list of sets to the classifier.  Any iterable of iterables is accepted.
        N)r    )r   Úlist_of_setsr   s      r   r   zClassifier.update;   s   € ð ò 	ˆAØ�H‰H�Q�Kñ	r   c                 óÐ   — | j                   sy | j                  }|D �cg c]  }|sŒ|‘Œ	 c}| _        | j                  rt        | j                  d„ ¬«      | _        d| _         y c c}w )Nc                 ó0   — t        | «       t        | «      fS )N)ÚlenÚsorted)r   s    r   ú<lambda>z%Classifier._process.<locals>.<lambda>K   s   € ¼CÀ»F¸7ÄFÈ1ÃIÐ:N€ r   )ÚkeyF)r	   r   r
   r&   )r   r   r   s      r   Ú_processzClassifier._processB   sQ   € Ø�{Š{Øð �z‰zˆØ!%Ö+˜Aª’aÒ+ˆŒ
à�:Š:Ü §
¡
Ñ0NÔOˆDŒJàˆ�ùò ,s
   žA#¦A#c                 ó:   — | j                  «        | j                  S )z¸Returns the set of all things known so far.

        The return value belongs to the Classifier object and should NOT
        be modified while the classifier is still in use.
        )r)   r   ©r   s    r   Ú	getThingszClassifier.getThingsQ   s   € ð 	�‰ŒØ�|‰|Ðr   c                 ó:   — | j                  «        | j                  S )zÀReturns the mapping from things to their class set.

        The return value belongs to the Classifier object and should NOT
        be modified while the classifier is still in use.
        )r)   r   r+   s    r   Ú
getMappingzClassifier.getMappingZ   s   € ð 	�‰ŒØ�}‰}Ðr   c                 ó:   — | j                  «        | j                  S )z¬Returns the list of class sets.

        The return value belongs to the Classifier object and should NOT
        be modified while the classifier is still in use.
        )r)   r   r+   s    r   Ú
getClasseszClassifier.getClassesc   s   € ð 	�‰ŒØ�z‰zÐr   N©T)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r    r   r)   r,   r.   r0   © r   r   r   r      s+   „ ñóò('òTòòòór   r   c                 ó|   — t        |¬«      }|j                  | «       |j                  «       |j                  «       fS )aó  
    Takes a iterable of iterables (list of sets from here on; but any
    iterable works.), and returns the smallest list of sets such that
    each set, is either a subset, or is disjoint from, each of the input
    sets.

    In other words, this function classifies all the things present in
    any of the input sets, into similar classes, based on which sets
    things are a member of.

    If sort=True, return class sets are sorted by decreasing size and
    their natural sort order within each class size.  Otherwise, class
    sets are returned in the order that they were identified, which is
    generally not significant.

    >>> classify([]) == ([], {})
    True
    >>> classify([[]]) == ([], {})
    True
    >>> classify([[], []]) == ([], {})
    True
    >>> classify([[1]]) == ([{1}], {1: {1}})
    True
    >>> classify([[1,2]]) == ([{1, 2}], {1: {1, 2}, 2: {1, 2}})
    True
    >>> classify([[1],[2]]) == ([{1}, {2}], {1: {1}, 2: {2}})
    True
    >>> classify([[1,2],[2]]) == ([{1}, {2}], {1: {1}, 2: {2}})
    True
    >>> classify([[1,2],[2,4]]) == ([{1}, {2}, {4}], {1: {1}, 2: {2}, 4: {4}})
    True
    >>> classify([[1,2],[2,4,5]]) == (
    ...     [{4, 5}, {1}, {2}], {1: {1}, 2: {2}, 4: {4, 5}, 5: {4, 5}})
    True
    >>> classify([[1,2],[2,4,5]], sort=False) == (
    ...     [{1}, {4, 5}, {2}], {1: {1}, 2: {2}, 4: {4, 5}, 5: {4, 5}})
    True
    >>> classify([[1,2,9],[2,4,5]], sort=False) == (
    ...     [{1, 9}, {4, 5}, {2}], {1: {1, 9}, 2: {2}, 4: {4, 5}, 5: {4, 5},
    ...     9: {1, 9}})
    True
    >>> classify([[1,2,9,15],[2,4,5]], sort=False) == (
    ...     [{1, 9, 15}, {4, 5}, {2}], {1: {1, 9, 15}, 2: {2}, 4: {4, 5},
    ...     5: {4, 5}, 9: {1, 9, 15}, 15: {1, 9, 15}})
    True
    >>> classes, mapping = classify([[1,2,9,15],[2,4,5],[15,5]], sort=False)
    >>> set([frozenset(c) for c in classes]) == set(
    ...     [frozenset(s) for s in ({1, 9}, {4}, {2}, {5}, {15})])
    True
    >>> mapping == {1: {1, 9}, 2: {2}, 4: {4}, 5: {5}, 9: {1, 9}, 15: {15}}
    True
    )r   )r   r   r0   r.   )r"   r   Ú
classifiers      r   Úclassifyr9   m   s:   € ôj  Ô&€JØ×Ñ�lÔ#Ø× Ñ Ó" J×$9Ñ$9Ó$;Ð;Ð;r   Ú__main__é    N)Úoptionflagsr1   )r5   Úobjectr   r9   r2   ÚsysÚdoctestÚexitÚtestmodÚELLIPSISÚfailedr6   r   r   ú<module>rD      sV   ðñôe�ô eóP7<ðt ˆzÒßà€C‡H�Hˆ_ˆW�_‰_¨×)9Ñ)9Ô:×AÑAÕBð r   