Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 2øªjLã@sPdZGdd„deƒZd dd„ZedkrLddlZddlZejejej d �j ƒdS) zB fontTools.misc.classifyTools.py -- tools for classifying things. c@sJeZdZdZddd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dd„Z dS)Ú ClassifierzF Main Classifier object, used to classify things into similar sets. TcCs$tƒ|_g|_i|_d|_||_dS)NF)ÚsetÚ_thingsÚ_setsÚ_mappingÚ_dirtyÚ_sort)ÚselfÚsort©r úA/tmp/pip-build-_d5lkt3n/fonttools/fontTools/misc/classifyTools.pyÚ__init__ s zClassifier.__init__c CsÔ|sdSd|_|j|j|j}}}t|ƒ}|j|ƒ}|j|ƒ|}~|rt|j|ƒ|j|ƒx|D] }|||<qdW~xX|rÎ|t t |ƒƒ} | j|ƒ} | j| ƒ|j| ƒ|j| ƒx| D] }| ||<qºW~ qxWdS)z= Add a set to the classifier. Any iterable is accepted. NT) rrrrrÚ intersectionÚdifference_updateÚupdateÚappendÚnextÚiter) rZ set_of_thingsZthingsÚsetsÚmappingÚsr Ú differenceÚthingZ old_classZold_class_intersectionr r r Úadds0            zClassifier.addcCsx|D]}|j|ƒqWdS)zU Add a a list of sets to the classifier. Any iterable of iterables is accepted. N)r)rÚ list_of_setsrr r r r=s zClassifier.updatecCsD|js dS|j}dd„|Dƒ|_|jr:t|jdd„d�|_d|_dS)NcSsg|] }|r|‘qSr r )Ú.0rr r r ú Jsz'Classifier._process..cSst|ƒ t|ƒfS)N)ÚlenÚsorted)rr r r ÚMsz%Classifier._process..)ÚkeyF)rrrr)rrr r r Ú_processDszClassifier._processcCs|jƒ|jS)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)rr r r Ú getThingsSszClassifier.getThingscCs|jƒ|jS)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)rr r r Ú getMapping\szClassifier.getMappingcCs|jƒ|jS)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)rr r r Ú getClasseseszClassifier.getClassesN)T) Ú__name__Ú __module__Ú __qualname__Ú__doc__r rrr r!r"r#r r r r rs *  rTcCs$t|d�}|j|ƒ|jƒ|jƒfS)ac 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 )rrr#r")rr Ú classifierr r r Úclassifyos5  r)Ú__main__éN)Z optionflags)T) r'Úobjectrr)r$ÚsysÚdoctestÚexitÚtestmodÚELLIPSISÚfailedr r r r Ús j :