
    $g8                        d dl mZ d dlmZ d dlmZ d dlmZmZ d dl	m
Z
 ddlmZ erd dlmZ dd	lmZ  G d
 de          ZdS )    )annotations)cached_property)Path)TYPE_CHECKINGOptional)SourceFinder   )StrawberryException)ScalarDefinition)ExceptionSourcec                  8     e Zd Zd	 fdZed
d            Z xZS )ScalarAlreadyRegisteredErrorscalar_definitionr   other_scalar_definitionreturnNonec           	     x   || _         |j        }d| d| _        d| d| _        d| _        d| _        |j        rYt          |j                  }|j        }| xj        d| d|	                    t          j
                               d	| d
z  c_        t                                          | j                   d S )NzScalar `z` has already been registeredzScalar `[underline]z [/]` has already been registeredzscalar defined herezPTo fix this error you should either rename the scalar, or reuse the existing onez&, defined in [bold white][link=file://]:z[/])r   namemessagerich_messageannotation_message
suggestion_source_filer   _source_linerelative_tocwdsuper__init__)selfr   r   scalar_name
other_path
other_line	__class__s         o/var/www/html/netbox-4.1.3/venv/lib/python3.11/site-packages/strawberry/exceptions/scalar_already_registered.pyr    z%ScalarAlreadyRegisteredError.__init__   s    
 "3',L+LLLO+OOO 	 #8( 	 #/ 	5BCCJ0=JOOH H H))$(**55H H8BH H HOO
 	&&&&&    Optional[ExceptionSource]c                    t          | j        j        | j        j        f          sd S t	                      }|                    | j                  S )N)allr   r   r   r   find_scalar_call)r!   source_finders     r&   exception_sourcez-ScalarAlreadyRegisteredError.exception_source/   sO    #0$2H2UV
 
 	 4$--d.DEEEr'   )r   r   r   r   r   r   )r   r(   )__name__
__module____qualname__r    r   r-   __classcell__)r%   s   @r&   r   r      se        ' ' ' ' ' ': F F F _F F F F Fr'   r   N)
__future__r   	functoolsr   pathlibr   typingr   r   )strawberry.exceptions.utils.source_finderr   	exceptionr
   strawberry.types.scalarr   r-   r   r    r'   r&   <module>r:      s    " " " " " " % % % % % %       * * * * * * * * B B B B B B * * * * * * 2888888111111'F 'F 'F 'F 'F#6 'F 'F 'F 'F 'Fr'   