
    h                     <    S SK Jr   " S S\5      r " S S\5      rg)   )Errorsc                   j   ^  \ rS rSrSr\R                  S.S\SS4U 4S jjjrS r	SS	 jr
S
 rSrU =r$ )SimpleFrozenDict   zSimplified implementation of a frozen dict, mainly used as default
function or method argument (for arguments that should default to empty
dictionary). Will raise an error if user or Weasel attempts to add to dict.
errorr   returnNc                2   > [         TU ]  " U0 UD6  Xl        g)zInitialize the frozen dict. Can be initialized with pre-defined
values.

error (str): The error message when user tries to assign to dict.
N)super__init__r   )selfr   argskwargs	__class__s       L/home/james-whalen/.local/lib/python3.13/site-packages/weasel/util/frozen.pyr   SimpleFrozenDict.__init__
   s     	$)&)
    c                 ,    [        U R                  5      eNNotImplementedErrorr   )r   keyvalues      r   __setitem__SimpleFrozenDict.__setitem__       !$**--r   c                 ,    [        U R                  5      er   r   )r   r   defaults      r   popSimpleFrozenDict.pop   r   r   c                 ,    [        U R                  5      er   r   )r   others     r   updateSimpleFrozenDict.update   r   r   r   )__name__
__module____qualname____firstlineno____doc__r   E001strr   r   r   r#   __static_attributes____classcell__r   s   @r   r   r      s=    
 ,2;; S T  ... .r   r   c                      ^  \ rS rSrSr\R                  S.S\SS4U 4S jjjrS r	S	 r
S
 rS rS rS rS rS rSrU =r$ )SimpleFrozenList   an  Wrapper class around a list that lets us raise custom errors if certain
attributes/methods are accessed. Mostly used for properties like
Language.pipeline that return an immutable list (and that we don't want to
convert to a tuple to not break too much backwards compatibility). If a user
accidentally calls nlp.pipeline.append(), we can raise a more helpful error.
r   r   r	   Nc                ,   > Xl         [        TU ]  " U6   g)z`Initialize the frozen list.

error (str): The error message when user tries to mutate the list.
N)r   r   r   )r   r   r   r   s      r   r   SimpleFrozenList.__init__%   s    
 
$r   c                 ,    [        U R                  5      er   r   r   r   r   s      r   appendSimpleFrozenList.append-   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   clearSimpleFrozenList.clear0   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   extendSimpleFrozenList.extend3   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   insertSimpleFrozenList.insert6   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   r   SimpleFrozenList.pop9   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   removeSimpleFrozenList.remove<   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   reverseSimpleFrozenList.reverse?   r   r   c                 ,    [        U R                  5      er   r   r5   s      r   sortSimpleFrozenList.sortB   r   r   )r%   r&   r'   r(   r)   r   E002r+   r   r6   r9   r<   r?   r   rD   rG   rJ   r,   r-   r.   s   @r   r0   r0      sV     ,2;;  S  4    ........ .r   r0   N)errorsr   dictr   listr0    r   r   <module>rQ      s     .t .2&.t &.r   