§
    öÛgl  ã                   ó¨   — d dl Z d dlmZmZmZ ddlmZ ddlmZ  G d„ de	¦  «        Z
 G d„ d	ee¬
¦  «        Z G d„ dee¦  «        Zd„ Zd„ Zdd„ZdS )é    N)ÚABCMetaÚabstractpropertyÚabstractmethodé   )Úindent)Úpropertydocc                   ó   — e Zd ZdZdS )ÚRecursiveFactorz5Raised when a factor is ultimately composed of itselfN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    úO/granary/edev/quantum/lib/python3.11/site-packages/postgresql/python/element.pyr
   r
   	   s   € € € € € Ø8Ð8Ø€r   r
   c                   óˆ   — e Zd ZdZeedefd„¦   «         ¦   «         Zeedd„¦   «         ¦   «         Ze	dee
fgfd„¦   «         ZdS )	ÚElementa#  
	The purpose of an element is to provide a general mechanism for specifying
	the factors that composed an object. Factors are designated using an
	ordered set of strings referencing those significant attributes on the object.

	Factors are important for PG-API as it provides the foundation for
	collecting the information about the state of the interface that ultimately
	led up to an error.

		Traceback:
		 ...
		postgresql.exceptions.*: <message>
		  CODE: XX000
		CURSOR: <cursor_id>
		  parameters: (p1, p2, ...)
		STATEMENT: <statement_id> <parameter info>
		  ...
		  string:
		    <query body>
		  SYMBOL: get_types
		  LIBRARY: catalog
		  ...
		CONNECTION:
		  <backend_id> <socket information>
		CONNECTOR: [Host]
		  IRI: pq://user@localhost:5432/database
		DRIVER: postgresql.driver.pq3
	Úreturnc                 ó   — dS )zå
		Single-word string describing the kind of element.

		For instance, `postgresql.api.Statement`'s _e_label is 'STATEMENT'.

		Usually, this is set directly on the class itself, and is a shorter
		version of the class's name.
		Nr   ©Úselfs    r   Ú_e_labelzElement._e_label+   ó   € € € r   r   c                 ó   — dS )z¡
		The attribute names of the objects that contributed to the creation of
		this object.

		The ordering is significant. The first factor is the prime factor.
		Nr   r   s    r   Ú
_e_factorszElement._e_factors7   r   r   c                 ó   — dS )a  
		Return an iterable to key-value pairs that provide useful descriptive
		information about an attribute.

		Factors on metas are not checked. They are expected to be primitives.

		If there are no metas, the str() of the object will be used to represent
		it.
		Nr   r   s    r   Ú_e_metaszElement._e_metasA   r   r   N)r   r   )r   r   r   r   r   r   Ústrr   r   r   Úobjectr   r   r   r   r   r      s¨   € € € € € ðð ð: Øð�sð ð ð ñ Ôñ „+ðð Øðð ð ñ Ôñ „+ðð ð	˜˜f˜�ð 	ð 	ð 	ñ „.ð	ð 	ð 	r   r   )Ú	metaclassc                   ó$   — e Zd ZdZdZdZdZd„ ZdS )Ú
ElementSetao  
	An ElementSet is a set of Elements that can be used as an individual factor.

	In situations where a single factor is composed of multiple elements where
	each has no significance over the other, this Element can be used represent
	that fact.

	Importantly, it provides the set metadata so that the appropriate information
	will be produced in element tracebacks.
	ÚSETr   c              #   óh   K  — d t          | ¦  «        fV — | D ]}dV — d t          |¦  «        fV — Œd S )N)Nz--)ÚlenÚformat_element)r   Úxs     r   r   zElementSet._e_metas\   s^   è è € Ø	�s�4‰yŒyÐÐÐÐØð #ð #€aØ	ÐÐÐØ
•˜qÑ!Ô!Ð	"Ð"Ð"Ð"Ð"ð#ð #r   N)r   r   r   r   r   r   Ú	__slots__r   r   r   r   r"   r"   M   s>   € € € € € ð	ð 	ð €Ø€Ø€ð#ð #ð #ð #ð #r   r"   c                 ój   — t          | dd¦  «        }|r|d         t          | |d         d¦  «        fS dS )z:get the primary factor on the `obj`, returns None if none.r   Nr   )Úgetattr)ÚobjÚfs     r   Úprime_factorr-   b   sD   € åˆS�, Ñ%Ô%€Øð (Ø	
ˆ1Œ�w�s˜A˜aœD $Ñ'Ô'Ð	'Ð'ð(ð (r   c              #   ó¢  K  — t          | f¦  «        }t          | dd¦  «        }|sdS |d         }t          | |d¦  «        }||v rt          | |¦  «        ‚|                     |¦  «         ||fV — |�]t          | dd¦  «        }|d         }t          ||d¦  «        }||v rt          | |¦  «        ‚|                     |¦  «         ||fV — |­[dS dS )zB
	Yield out the sequence of primary factors of the given object.
	r   Nr   )Úsetr*   r
   Úadd)r+   ÚvisitedÚefÚfnÚes        r   Úprime_factorsr5   h   sö   è è € õ �ˆv‰;Œ;€Ýˆc�< Ñ&Ô&€Ø
ð 	Ø€&Øˆ„e€ÝˆS�"�dÑÔ€Øˆ€L€LÝ˜˜QÑÔÐØ‡‚ˆQ�„€Ø	ˆ1€u€€€à€}Ýˆs�L $Ñ'Ô'€"Ø	ˆ!„u€"Ýˆa��TÑÔ€!Øˆ'€\€\Ý	˜˜aÑ	 Ô	 Ð Ø	‡+‚+ˆa�.„.€.Ø
ˆAˆ€+€+€+ð 	€}€}€}€}€}r   r   c                 ó°  — | |v rt          |¦  «        ‚|| fz   }t          | t          ¦  «        s| €dS t          | ¦  «        S d}g }|                      ¦   «         D ]—\  }}d}|€d}nt          |¦  «        }d}|�E||dz   z  }t          |¦  «        dk    st          j        |v rt          j        }t          |¦  «        }nd}d}||| 	                    ¦   «         z   z  }| 
                    |¦  «         Œ˜g }	| j        d	d…         D ]‹}
d}t          | |
¦  «        }||
dz   z  }t          ||¬
¦  «        }t          |¦  «        dk    st          j        |v r |t          j        t          |¦  «        z   z  }n|d|z   z  }|	 
                    |¦  «         ŒŒt          j                             |¦  «        }t          j                             |	¦  «        }|rt          |¦  «        }|rt          |¦  «        }||z   }|du rd|                     ¦   «         z   }nt          j        |z   }| j        dz   | 	                    ¦   «         z   }t#          | ¦  «        }|�‡|\  }}t          ||¬
¦  «        }t          |dd¦  «        �d}nH|dz  }t          |¦  «        dk    st          j        |v rt          j        t          |¦  «        z   }n|dz  }|t          j        |z   |z   z  }|S )zMformat the given element with its factors and metadata into a readable stringNÚNoneFÚ ú ú:éF   Tr   )Úcoverager   )r
   Ú
isinstancer   r   r   r%   ÚosÚlinesepr   ÚrstripÚappendr   r*   r&   ÚjoinÚlstripr   r-   )r+   r<   ÚnoleadÚmetasÚkeyÚvalÚmÚsvalÚpreÚfactorsÚattr,   ÚmtxtÚftxtÚsÚpfÚfactor_nameÚprimeÚfactors                      r   r&   r&   €   só  € ð ˆ8€O€OÝ˜Ñ!Ô!Ð!Ø˜�vÑ€å�3�Ñ Ô ð Ø€[Ø
ˆ&Ý	ˆS‰Œ€/ð
 €Ø	€Ø—’‘”ð ð �X€Sˆ#Ø€!Ø€[Ø
€4€4å
ˆc‰(Œ(€4à€#Ø€_Øˆˆc‰	�>€1Ý
ˆ4�y„y�2‚~€~�œ tÐ+Ð+Ý
Œ*€CÝ�$‰<Œ<€Døð €6Ø	€3Ø€sˆT�[Š[‰]Œ]ÑÑ€!Ø‡,‚,ˆq�/„/€/€/à€ØŒN˜1˜2˜2Ôð 
ð 
€SØ€!Ýˆc�3ÑÔ€!à€sˆS�y�.€!Ý	˜ hÐ	/Ñ	/Ô	/€$Ýˆ�Y„Y�‚^€^•r”z TÐ)Ð)Ø�Œ
•V˜D‘\”\Ñ!Ñ!€1€1àˆˆd‰
�?€1Ø	‡.‚.�ÑÔÐÐå
Œ
�Š˜ÑÔ€Ý
Œ
�Š˜Ñ Ô €Øð Ý	�‰Œ€$Øð Ý	�‰Œ€$Ø	ˆD�[€Ø
ˆd€N€Nà	ˆA�HŠH‰JŒJÑ€!€!å„j�1�n€!Ø„\�CÑ˜!Ÿ(š(™*œ*Ñ$€õ �3ÑÔ€Ø€NØÑ€+ˆuÝ˜%¨HÐ5Ñ5Ô5€&ÝˆU�J Ñ%Ô%Ð1ð €;€;à�#Ñ€;Ý	ˆ&�k„k�BÒÐ�"œ*¨Ð.Ð.ÝŒZ�& ™.œ.Ñ(€F€Fà�3Ñ€KØ…r„z�KÑ &Ñ(Ñ(€!Ø	€r   )r   )r>   Úabcr   r   r   Ústringr   Údecorlibr   Ú	Exceptionr
   r   r   r/   r"   r-   r5   r&   r   r   r   ú<module>rX      s  ðð 
€	€	€	Ø 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ð 9Ø Ð Ð Ð Ð Ð Ø !Ð !Ð !Ð !Ð !Ð !ðð ð ð ð �iñ ô ð ð>ð >ð >ð >ð >ˆf 'ð >ñ >ô >ð >ð@#ð #ð #ð #ð #�˜#ñ #ô #ð #ð*(ð (ð (ðð ð ð0Q
ð Q
ð Q
ð Q
ð Q
ð Q
r   