Ë
    f^(hG)  ã                   óÂ   — d dl Z d dlZd dlmZ d dlmZ g d¢Zd„ Zd„ Zd„ Z	e
fd„Ze
fd	„Ze
fd
„Ze
fd„Ze
fd„Ze
fd„Ze
fd„Zd„ Ze
fd„Zde
fd„Zdd„Zd„ Zd„ Zd„ Zy)é    N)ÚMapping)Úreduce)ÚmergeÚ
merge_withÚvalmapÚkeymapÚitemmapÚ	valfilterÚ	keyfilterÚ
itemfilterÚassocÚdissocÚassoc_inÚ	update_inÚget_inc                 óŽ   — |j                  dt        «      }|r,t        | j                  › d|j	                  «       d   › d�«      ‚|S )NÚfactoryz'() got an unexpected keyword argument 'r   ú')ÚpopÚdictÚ	TypeErrorÚ__name__Úpopitem)ÚfÚkwargsr   s      úq/var/www/skyplay_api_hub/venv/lib/python3.12/site-packages/torch/fx/experimental/unification/unification_tools.pyÚ_get_factoryr      sM   € Ø�j‰j˜¤DÓ)€GÙÜØ�z‰zˆlÐAÀ&Ç.Á.ÓBRÐSTÑBUÐAVÐVWÐXó
ð 	
ð €Nó    c                  ó°   — t        | «      dk(  rt        | d   t        «      s| d   } t        t        |«      } |«       }| D ]  }|j                  |«       Œ |S )zóMerge a collection of dictionaries

    >>> merge({1: "one"}, {2: "two"})
    {1: 'one', 2: 'two'}

    Later dictionaries have precedence

    >>> merge({1: 2, 3: 4}, {3: 3, 4: 4})
    {1: 2, 3: 3, 4: 4}

    See Also:
        merge_with
    é   r   )ÚlenÚ
isinstancer   r   r   Úupdate)Údictsr   r   ÚrvÚds        r   r   r   "   sW   € ô ˆ5ƒz�Q‚œz¨%°©(´GÔ<Ø�a‘ˆÜœ5 &Ó)€Gá	‹€BØò ˆØ
�	‰	�!�ðà€Ir   c                 ó  — t        |«      dk(  rt        |d   t        «      s|d   }t        t        |«      } |«       }|D ]9  }|j                  «       D ]$  \  }}||vr|g||<   Œ||   j                  |«       Œ& Œ; t        | ||«      S )a¥  Merge dictionaries and apply function to combined values

    A key may occur in more than one dict, and all values mapped from the key
    will be passed to the function as a list, such as func([val1, val2, ...]).

    >>> merge_with(sum, {1: 1, 2: 2}, {1: 10, 2: 20})
    {1: 11, 2: 22}

    >>> merge_with(first, {1: 1, 2: 2}, {2: 20, 3: 30})  # doctest: +SKIP
    {1: 1, 2: 2, 3: 30}

    See Also:
        merge
    r    r   )r!   r"   r   r   r   ÚitemsÚappendr   )Úfuncr$   r   r   Úresultr&   ÚkÚvs           r   r   r   :   s•   € ô ˆ5ƒz�Q‚œz¨%°©(´GÔ<Ø�a‘ˆÜœ: vÓ.€Gá‹Y€FØò $ˆØ—G‘G“Iò 	$‰DˆAˆqØ˜‰Ø˜C��q’	à�q‘	× Ñ  Õ#ñ		$ð$ô �$˜ Ó(Ð(r   c           
      ó–   —  |«       }|j                  t        |j                  «       t        | |j	                  «       «      «      «       |S )zÝApply function to values of dictionary

    >>> bills = {"Alice": [20, 15, 30], "Bob": [10, 35]}
    >>> valmap(sum, bills)  # doctest: +SKIP
    {'Alice': 65, 'Bob': 45}

    See Also:
        keymap
        itemmap
    )r#   ÚzipÚkeysÚmapÚvalues©r*   r&   r   r%   s       r   r   r   W   s6   € ñ 
‹€BØ‡I�IŒc�!—&‘&“(œC  a§h¡h£jÓ1Ó2Ô3Ø€Ir   c           	      ó–   —  |«       }|j                  t        t        | |j                  «       «      |j	                  «       «      «       |S )zñApply function to keys of dictionary

    >>> bills = {"Alice": [20, 15, 30], "Bob": [10, 35]}
    >>> keymap(str.lower, bills)  # doctest: +SKIP
    {'alice': [20, 15, 30], 'bob': [10, 35]}

    See Also:
        valmap
        itemmap
    )r#   r/   r1   r0   r2   r3   s       r   r   r   g   s6   € ñ 
‹€BØ‡I�IŒc”#�d˜AŸF™F›HÓ% q§x¡x£zÓ2Ô3Ø€Ir   c                 óf   —  |«       }|j                  t        | |j                  «       «      «       |S )zÛApply function to items of dictionary

    >>> accountids = {"Alice": 10, "Bob": 20}
    >>> itemmap(reversed, accountids)  # doctest: +SKIP
    {10: "Alice", 20: "Bob"}

    See Also:
        keymap
        valmap
    )r#   r1   r(   r3   s       r   r	   r	   w   s)   € ñ 
‹€BØ‡I�IŒc�$˜Ÿ™›	Ó"Ô#Ø€Ir   c                 ó`   —  |«       }|j                  «       D ]  \  }} | |«      sŒ|||<   Œ |S )zåFilter items in dictionary by value

    >>> iseven = lambda x: x % 2 == 0
    >>> d = {1: 2, 2: 3, 3: 4, 4: 5}
    >>> valfilter(iseven, d)
    {1: 2, 3: 4}

    See Also:
        keyfilter
        itemfilter
        valmap
    ©r(   ©Ú	predicater&   r   r%   r,   r-   s         r   r
   r
   ‡   ó;   € ñ 
‹€BØ—‘“	ò ‰ˆˆ1Ù�Q�<ØˆBˆqŠEðð €Ir   c                 ó`   —  |«       }|j                  «       D ]  \  }} | |«      sŒ|||<   Œ |S )zãFilter items in dictionary by key

    >>> iseven = lambda x: x % 2 == 0
    >>> d = {1: 2, 2: 3, 3: 4, 4: 5}
    >>> keyfilter(iseven, d)
    {2: 3, 4: 5}

    See Also:
        valfilter
        itemfilter
        keymap
    r7   r8   s         r   r   r   ›   r:   r   c                 ód   —  |«       }|j                  «       D ]  } | |«      sŒ|\  }}|||<   Œ |S )a  Filter items in dictionary by item

    >>> def isvalid(item):
    ...     k, v = item
    ...     return k % 2 == 0 and v < 4

    >>> d = {1: 2, 2: 3, 3: 4, 4: 5}
    >>> itemfilter(isvalid, d)
    {2: 3}

    See Also:
        keyfilter
        valfilter
        itemmap
    r7   )r9   r&   r   r%   Úitemr,   r-   s          r   r   r   ¯   s@   € ñ  
‹€BØ—‘“	ò ˆÙ�T�?Ø‰DˆAˆqØˆBˆqŠEðð €Ir   c                 ó@   —  |«       }|j                  | «       |||<   |S )zòReturn a new dict with new key value pair

    New dict has d[key] set to value. Does not modify the initial dictionary.

    >>> assoc({"x": 1}, "x", 2)
    {'x': 2}
    >>> assoc({"x": 1}, "y", 3)  # doctest: +SKIP
    {'x': 1, 'y': 3}
    )r#   )r&   ÚkeyÚvaluer   Úd2s        r   r   r   Ç   s$   € ñ 
‹€BØ‡I�Iˆa„LØ€B€s�GØ€Ir   c                 ó  — t        t        |«      } |«       }t        |«      t        | «      dz  k  r"|j                  | «       |D ]
  }||v sŒ||= Œ |S t	        | «      }|j                  |«       |D ]
  }| |   ||<   Œ |S )aB  Return a new dict with the given key(s) removed.

    New dict has d[key] deleted for each supplied key.
    Does not modify the initial dictionary.

    >>> dissoc({"x": 1, "y": 2}, "y")
    {'x': 1}
    >>> dissoc({"x": 1, "y": 2}, "y", "x")
    {}
    >>> dissoc({"x": 1}, "y")  # Ignores missing keys
    {'x': 1}
    g333333ã?)r   r   r!   r#   ÚsetÚdifference_update)r&   r0   r   r   rA   r?   Ú	remainingr,   s           r   r   r   ×   s”   € ô œ6 6Ó*€GÙ	‹€Bä
ˆ4ƒy”3�q“6˜C‘<ÒØ
�	‰	�!ŒØò 	ˆCØ�bŠyØ�s‘Gð	ð €Iô	 ˜“Fˆ	Ø×#Ñ# DÔ)Øò 	ˆAØ�a‘DˆBˆqŠEð	à€Ir   c                 ó(   ‡— t        | |ˆfd„‰|«      S )aÓ  Return a new dict with new, potentially nested, key value pair

    >>> purchase = {
    ...     "name": "Alice",
    ...     "order": {"items": ["Apple", "Orange"], "costs": [0.50, 1.25]},
    ...     "credit card": "5555-1234-1234-1234",
    ... }
    >>> assoc_in(purchase, ["order", "costs"], [0.25, 1.00])  # doctest: +SKIP
    {'credit card': '5555-1234-1234-1234',
     'name': 'Alice',
     'order': {'costs': [0.25, 1.00], 'items': ['Apple', 'Orange']}}
    c                 ó   •— ‰S ©N© )Úxr@   s    €r   ú<lambda>zassoc_in.<locals>.<lambda>  s   ø€ ¨€ r   )r   )r&   r0   r@   r   s     ` r   r   r   ô   s   ø€ ô �Q˜›o¨u°gÓ>Ð>r   c                 ó  — t        |«      }t        |«      } |«       x}}|j                  | «       |D ]6  }	|| v r| |   }  |«       }
|
j                  | «       n	 |«       x} }
|
x||<   }|	}Œ8 || v r || |   «      ||<   |S  ||«      ||<   |S )aæ  Update value in a (potentially) nested dictionary

    inputs:
    d - dictionary on which to operate
    keys - list or tuple giving the location of the value to be changed in d
    func - function to operate on that value

    If keys == [k0,..,kX] and d[k0]..[kX] == v, update_in returns a copy of the
    original dictionary with v replaced by func(v), but does not mutate the
    original dictionary.

    If k0 is not a key in d, update_in creates nested dictionaries to the depth
    specified by the keys, with the innermost value set to func(default).

    >>> inc = lambda x: x + 1
    >>> update_in({"a": 0}, ["a"], inc)
    {'a': 1}

    >>> transaction = {
    ...     "name": "Alice",
    ...     "purchase": {"items": ["Apple", "Orange"], "costs": [0.50, 1.25]},
    ...     "credit card": "5555-1234-1234-1234",
    ... }
    >>> update_in(transaction, ["purchase", "costs"], sum)  # doctest: +SKIP
    {'credit card': '5555-1234-1234-1234',
     'name': 'Alice',
     'purchase': {'costs': 1.75, 'items': ['Apple', 'Orange']}}

    >>> # updating a value when k0 is not in d
    >>> update_in({}, [1, 2, 3], str, default="bar")
    {1: {2: {3: 'bar'}}}
    >>> update_in({1: "foo"}, [2, 3, 4], inc, 0)
    {1: 'foo', 2: {3: {4: 1}}}
    )ÚiterÚnextr#   )r&   r0   r*   Údefaultr   Úksr,   r%   Úinnerr?   Údtemps              r   r   r     s³   € ôF 
ˆd‹€BÜˆR‹€Aá“Ð€BˆØ‡I�Iˆa„Làò 	ˆØ�‰6Ø�!‘ˆAÙ“IˆEØ�L‰L˜�Oá›	Ð!ˆA�à Ð ˆˆa‰�5Ø‰ð	ð 	ˆA�vÙ˜˜!™“:ˆˆa‰ð €Iñ ˜“=ˆˆa‰Ø€Ir   c                 óx   — 	 t        t        j                  | |«      S # t        t        t
        f$ r |r‚ |cY S w xY w)a  Returns coll[i0][i1]...[iX] where [i0, i1, ..., iX]==keys.

    If coll[i0][i1]...[iX] cannot be found, returns ``default``, unless
    ``no_default`` is specified, then it raises KeyError or IndexError.

    ``get_in`` is a generalization of ``operator.getitem`` for nested data
    structures such as dictionaries and lists.

    >>> transaction = {
    ...     "name": "Alice",
    ...     "purchase": {"items": ["Apple", "Orange"], "costs": [0.50, 1.25]},
    ...     "credit card": "5555-1234-1234-1234",
    ... }
    >>> get_in(["purchase", "items", 0], transaction)
    'Apple'
    >>> get_in(["name"], transaction)
    'Alice'
    >>> get_in(["purchase", "total"], transaction)
    >>> get_in(["purchase", "items", "apple"], transaction)
    >>> get_in(["purchase", "items", 10], transaction)
    >>> get_in(["purchase", "total"], transaction, 0)
    0
    >>> get_in(["y"], {}, no_default=True)
    Traceback (most recent call last):
        ...
    KeyError: 'y'

    See Also:
        itertoolz.get
        operator.getitem
    )r   ÚoperatorÚgetitemÚKeyErrorÚ
IndexErrorr   )r0   ÚcollrO   Ú
no_defaults       r   r   r   ?  s>   € ð@Ü”h×&Ñ&¨¨dÓ3Ð3øÜ”j¤)Ð,ò ÙØØŠðús   ‚ �9¸9c                 ó¬   ‡ — t        ‰ t        «      r/t        ‰ «      dk(  r
‰ d   Š ˆ fd„S ‰ rt        j                  ‰ Ž S d„ S t        j                  ‰ «      S )Nr    r   c                 ó   •— | ‰   fS rH   rI   )rJ   Úindexs    €r   rK   zgetter.<locals>.<lambda>k  s   ø€ ˜a ™h˜[€ r   c                  ó   — y)NrI   rI   )rJ   s    r   rK   zgetter.<locals>.<lambda>o  s   � r   )r"   Úlistr!   rT   Ú
itemgetter)r\   s   `r   Úgetterr`   g  sR   ø€ Ü�%œÔÜˆu‹:˜Š?Ø˜!‘HˆEÛ(Ð(ÙÜ×&Ñ&¨Ð.Ð.áÐä×"Ñ" 5Ó)Ð)r   c                 óà   — t        | «      st        | «      } t        j                  d„ «      }|D ]  } | | |«         |«       Œ i }|j	                  «       D ]  \  }}|j
                  ||<   Œ |S )a‚  Group a collection by a key function

    >>> names = ["Alice", "Bob", "Charlie", "Dan", "Edith", "Frank"]
    >>> groupby(len, names)  # doctest: +SKIP
    {3: ['Bob', 'Dan'], 5: ['Alice', 'Edith', 'Frank'], 7: ['Charlie']}

    >>> iseven = lambda x: x % 2 == 0
    >>> groupby(iseven, [1, 2, 3, 4, 5, 6, 7, 8])  # doctest: +SKIP
    {False: [1, 3, 5, 7], True: [2, 4, 6, 8]}

    Non-callable keys imply grouping on a member.

    >>> groupby(
    ...     "gender",
    ...     [
    ...         {"name": "Alice", "gender": "F"},
    ...         {"name": "Bob", "gender": "M"},
    ...         {"name": "Charlie", "gender": "M"},
    ...     ],
    ... )  # doctest:+SKIP
    {'F': [{'gender': 'F', 'name': 'Alice'}],
     'M': [{'gender': 'M', 'name': 'Bob'},
           {'gender': 'M', 'name': 'Charlie'}]}

    Not to be confused with ``itertools.groupby``

    See Also:
        countby
    c                  ó   — g j                   S rH   )r)   rI   r   r   rK   zgroupby.<locals>.<lambda>”  s
   € ¨¯	©	€ r   )Úcallabler`   ÚcollectionsÚdefaultdictr(   Ú__self__)r?   Úseqr&   r=   r%   r,   r-   s          r   Úgroupbyrh   t  sv   € ô< �CŒ=Ü�S‹kˆÜ×ÑÑ 1Ó2€AØò ˆØˆ‰#ˆd‹)‰�TÕðà	€BØ—‘“	ò ‰ˆˆ1Ø—
‘
ˆˆ1Šðà€Ir   c                 ó*   — t        t        | «      «      S )zBThe first element in a sequence

    >>> first("ABC")
    'A'
    )rN   rM   )rg   s    r   Úfirstrj   �  s   € ô ”�S“	‹?Ðr   )NF)rd   rT   Úcollections.abcr   Ú	functoolsr   Ú__all__r   r   r   r   r   r   r	   r
   r   r   r   r   r   r   r   r`   rh   rj   rI   r   r   ú<module>rn      sŸ   ðã Û Ý #Ý ò€ò"òò0)ð: !ó ð  !ó ð  "ó ð  %)ó ð( %)ó ð( &*ó ð0 "&ó ò ð: &*ó ?ð  &*°4ó 8óv%òP
*ò&óRr   