ó
    Ð]j¥J  ã                  ór  • S r SSKJr  SSKrSSKrSSKJrJr  SSKJ	r	J
r
  SSKJrJrJr  SSKJr  SS	KJr  SS
KJr  SSKJrJr  SSKJr  SSKJr  SS S jjr " S S\5      r " S S\5      r " S S\5      r " S S\5      r " S S\5      r  " S S\5      r!\" S5      r"\" S5      r#SS S jjr$SS!S jjr%g)"z 
SQL composition utility module
é    )ÚannotationsN)ÚABCÚabstractmethod)ÚAnyÚoverload)ÚIterableÚIteratorÚSequenceé   )ÚEscaping)ÚAdaptContext)ÚPyFormat)ÚLiteralStringÚTemplate)Úconn_encoding)ÚTransformerc                ó6   • [        U 5      R                  U5      $ )a¾  
Adapt a Python object to a quoted SQL string.

Use this function only if you absolutely want to convert a Python string to
an SQL quoted literal to use e.g. to generate batch SQL and you won't have
a connection available when you will need to use it.

This function is relatively inefficient, because it doesn't cache the
adaptation rules. If you pass a `!context` you can adapt the adaptation
rules used, otherwise only global rules are used.

)ÚLiteralÚ	as_string)ÚobjÚcontexts     ÚH/home/mande/repo/quber/.venv/lib/python3.13/site-packages/psycopg/sql.pyÚquoter      s   € ô �3‹<×!Ñ! 'Ó*Ð*ó    c                  óz   • \ rS rSrSrSS jrSS jr\SSS jj5       rSSS jjr	SS jr
SS	 jrSS
 jrSS jrSrg)Ú
Composableé'   a(  
Abstract base class for objects that can be used to compose an SQL string.

`!Composable` objects can be joined using the ``+`` operator: the result
will be a `Composed` instance containing the objects joined. The operator
``*`` is also supported with an integer argument: the result is a
`!Composed` instance containing the left argument repeated as many times as
requested.

`!SQL` and `!Composed` objects can be passed directly to
`~psycopg.Cursor.execute()`, `~psycopg.Cursor.executemany()`,
`~psycopg.Cursor.copy()` in place of the query string.
c                ó   • Xl         g ©N©Ú_obj)Úselfr   s     r   Ú__init__ÚComposable.__init__6   s   € Ø�	r   c                óP   • U R                   R                   SU R                  < S3$ )NÚ(Ú))Ú	__class__Ú__name__r!   ©r"   s    r   Ú__repr__ÚComposable.__repr__9   s$   € Ø—.‘.×)Ñ)Ð*¨!¨D¯I©I©=¸Ð:Ð:r   Nc                ó   • [         e)aF  
Return the value of the object as bytes.

:param context: the context to evaluate the object into.
:type context: `connection` or `cursor`

The method is automatically invoked by `~psycopg.Cursor.execute()`,
`~psycopg.Cursor.executemany()`, `~psycopg.Cursor.copy()` if a
`!Composable` is passed instead of the query string.

)ÚNotImplementedError©r"   r   s     r   Úas_bytesÚComposable.as_bytes<   s
   € ô "Ð!r   c                óü   • [        U(       a  UR                  OS5      n[        U R                  U5      =n[        5      (       a  UR                  U5      $ [        R                  " U5      R                  U5      S   $ )zŽ
Return the value of the object as string.

:param context: the context to evaluate the string into.
:type context: `connection` or `cursor`

Nr   )r   Ú
connectionÚ
isinstancer0   ÚbytesÚdecodeÚcodecsÚlookup)r"   r   ÚencÚbs       r   r   ÚComposable.as_stringK   sb   € ô ¶'˜G×.Ò.¸tÓDˆÜ˜DŸM™M¨'Ó2Ð2�q´U×;Ñ;Ø—8‘8˜C“=Ð ô —=’= Ó%×,Ñ,¨QÓ/°Ñ2Ð2r   c                ó²   • [        U[        5      (       a  [        U /5      U-   $ [        U[        5      (       a  [        U /5      [        U/5      -   $ [        $ r   )r4   ÚComposedr   ÚNotImplemented©r"   Úothers     r   Ú__add__ÚComposable.__add__Z   sM   € Ü�eœX×&Ñ&Ü˜T˜FÓ# eÑ+Ð+Ü�eœZ×(Ñ(Ü˜T˜FÓ#¤h°¨wÓ&7Ñ7Ð7ä!Ð!r   c                ó    • [        U /U-  5      $ r   )r=   )r"   Úns     r   Ú__mul__ÚComposable.__mul__b   s   € Ü˜˜ ™
Ó#Ð#r   c                ón   • [        U 5      [        U5      L =(       a    U R                  UR                  :H  $ r   )Útyper!   r?   s     r   Ú__eq__ÚComposable.__eq__e   s'   € Ü�D‹zœT %›[Ð(×D¨T¯Y©Y¸%¿*¹*Ñ-DÐDr   c                ó.   • U R                  U5      (       + $ r   )rI   r?   s     r   Ú__ne__ÚComposable.__ne__h   s   € Ø—;‘;˜uÓ%Ô%Ð%r   r    )r   r   ©ÚreturnÚstrr   ©r   úAdaptContext | NonerO   r5   ©r   rR   rO   rP   ©r@   r   rO   r=   )rD   ÚintrO   r=   )r@   r   rO   Úbool)r)   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r#   r+   r   r0   r   rA   rE   rI   rL   Ú__static_attributes__© r   r   r   r   '   s?   † ñôô;ð õ"ó ð"ö3ô"ô$ôE÷&r   r   c                  óh   ^ • \ rS rSr% SrS\S'   SU 4S jjrSSS jjrSS jrSS jr	SS	 jr
S
rU =r$ )r=   él   aî  
A `Composable` object made of a sequence of `!Composable`.

The object is usually created using `!Composable` operators and methods
(such as the `SQL.format()` method). `!Composed` objects can be passed
directly to `~psycopg.Cursor.execute()`, `~psycopg.Cursor.executemany()`,
`~psycopg.Cursor.copy()` in place of the query string.

It is also possible to create a `!Composed` directly specifying a sequence
of objects as arguments: if they are not `!Composable` they will be wrapped
in a `Literal`.

Example::

    >>> comp = sql.Composed(
    ...     [sql.SQL("INSERT INTO "), sql.Identifier("table")])
    >>> print(comp.as_string(conn))
    INSERT INTO "table"

`!Composed` objects are iterable (so they can be used in `SQL.join` for
instance).
zlist[Composable]r!   c                ó’   >• U Vs/ s H%  n[        U[        5      (       a  UO
[        U5      PM'     nn[        TU ]  U5        g s  snf r   )r4   r   r   Úsuperr#   )r"   Úseqr   r(   s      €r   r#   ÚComposed.__init__†   s?   ø€ ÙORÓSÊsÈ”j ¤j×1Ñ1‰s´w¸s³|ÒCÉsˆÐSÜ‰Ñ˜Õùò Ts   †,Ac                óN   ^• SR                  U4S jU R                   5       5      $ )Nr   c              3  óD   >#   • U  H  oR                  T5      v •  M     g 7fr   ©r0   )Ú.0r   r   s     €r   Ú	<genexpr>Ú$Composed.as_bytes.<locals>.<genexpr>‹   s   øé € ÐCº°#Ÿ™ W×-Ð-ºùs   ƒ )Újoinr!   r/   s    `r   r0   ÚComposed.as_bytesŠ   s   ø€ Ø�x‰xÔC¸¿ºÓCÓCÐCr   c                ó,   • [        U R                  5      $ r   )Úiterr!   r*   s    r   Ú__iter__ÚComposed.__iter__�   s   € Ü�D—I‘I‹Ðr   c                óØ   • [        U[        5      (       a"  [        U R                  UR                  -   5      $ [        U[        5      (       a  [        U R                  U/-   5      $ [        $ r   )r4   r=   r!   r   r>   r?   s     r   rA   ÚComposed.__add__�   sP   € Ü�eœX×&Ñ&Ü˜DŸI™I¨¯
©
Ñ2Ó3Ð3Ü�eœZ×(Ñ(Ü˜DŸI™I¨¨Ñ/Ó0Ð0ä!Ð!r   c                óÄ   • [        U[        5      (       a  [        U5      nO%[        U[        5      (       d  [        SU< S35      eUR	                  U R
                  5      $ )a>  
Return a new `!Composed` interposing the `!joiner` with the `!Composed` items.

The `!joiner` must be a `SQL` or a string which will be interpreted as
an `SQL`.

Example::

    >>> fields = sql.Identifier('foo') + sql.Identifier('bar')  # a Composed
    >>> print(fields.join(', ').as_string(conn))
    "foo", "bar"

z5Composed.join() argument must be strings or SQL, got ú instead)r4   rP   ÚSQLÚ	TypeErrorri   r!   )r"   Újoiners     r   ri   ÚComposed.join˜   sZ   € ô �fœc×"Ñ"Ü˜“[‰FÜ˜F¤C×(Ñ(ÜðØ‘z ð+óð ð
 �{‰{˜4Ÿ9™9Ó%Ð%r   r\   )ra   zSequence[Any]r   rQ   )rO   zIterator[Composable]rT   )ru   zSQL | LiteralStringrO   r=   )r)   rW   rX   rY   rZ   Ú__annotations__r#   r0   rm   rA   ri   r[   Ú__classcell__©r(   s   @r   r=   r=   l   s/   ø‡ ñð. Ó÷öDôô"÷&ò &r   r=   c                  ó¶   ^ • \ rS rSr% SrS\S'   \R                  " 5       rSU 4S jjr	SSS jjr
SSS jjrSS jr\SS	 j5       r\SS
 j5       rSS jrSrU =r$ )rs   é±   a¥  
A `Composable` representing a snippet of SQL statement.

`!SQL` exposes `join()` and `format()` methods useful to create a template
where to merge variable parts of a query (for instance field or table
names).

The `!obj` string doesn't undergo any form of escaping, so it is not
suitable to represent variable identifiers or values: you should only use
it to pass constant strings representing templates or snippets of SQL
statements; use other objects such as `Identifier` or `Literal` to
represent variable parts.

`!SQL` objects can be passed directly to `~psycopg.Cursor.execute()`,
`~psycopg.Cursor.executemany()`, `~psycopg.Cursor.copy()` in place of the
query string.

Example::

    >>> query = sql.SQL("SELECT {0} FROM {1}").format(
    ...    sql.SQL(', ').join([sql.Identifier('foo'), sql.Identifier('bar')]),
    ...    sql.Identifier('table'))
    >>> print(query.as_string(conn))
    SELECT "foo", "bar" FROM "table"
r   r!   c                ón   >• [         TU ]  U5        [        U[        5      (       d  [	        SU< S35      eg )Nz SQL values must be strings, got rr   )r`   r#   r4   rP   rt   )r"   r   r(   s     €r   r#   ÚSQL.__init__Ï   s7   ø€ Ü‰Ñ˜ÔÜ˜#œs×#Ñ#ÜÐ>¸s¹gÀXÐNÓOÐOð $r   c                ó   • U R                   $ r   r    r/   s     r   r   ÚSQL.as_stringÔ   s   € Ø�y‰yÐr   c                óx   • U(       a  UR                   OS n[        U5      nU R                  R                  U5      $ r   )r3   r   r!   Úencode©r"   r   Úconnr9   s       r   r0   ÚSQL.as_bytes×   s0   € Þ%,ˆw×!Ò!°$ˆÜ˜DÓ!ˆØ�y‰y×Ñ Ó$Ð$r   c                ó&  • / nSnU R                   R                  U R                  5       HÚ  u  pVpxU(       a  [        S5      eU(       a  [        S5      eU(       a  UR	                  [        U5      5        Uc  MP  UR                  5       (       a3  U(       a  [        S5      eUR	                  U[        U5         5        SnM˜  U(       d(  Uc  [        S5      eUR	                  X   5        US-  nMÇ  UR	                  X&   5        MÜ     [        U5      $ )a-  
Merge `Composable` objects into a template.

:param args: parameters to replace to numbered (``{0}``, ``{1}``) or
    auto-numbered (``{}``) placeholders
:param kwargs: parameters to replace to named (``{name}``) placeholders
:return: the union of the `!SQL` string with placeholders replaced
:rtype: `Composed`

The method is similar to the Python `str.format()` method: the string
template supports auto-numbered (``{}``), numbered (``{0}``,
``{1}``...), and named placeholders (``{name}``), with positional
arguments replacing the numbered placeholders and keywords replacing
the named ones. However placeholder modifiers (``{0!r}``, ``{0:<10}``)
are not supported.

If a `!Composable` objects is passed to the template it will be merged
according to its `as_string()` method. If any other Python object is
passed, it will be wrapped in a `Literal` object and so escaped
according to SQL rules.

Example::

    >>> print(sql.SQL("SELECT * FROM {} WHERE {} = %s")
    ...     .format(sql.Identifier('people'), sql.Identifier('id'))
    ...     .as_string(conn))
    SELECT * FROM "people" WHERE "id" = %s

    >>> print(sql.SQL("SELECT * FROM {tbl} WHERE name = {name}")
    ...     .format(tbl=sql.Identifier('people'), name="O'Rourke"))
    ...     .as_string(conn))
    SELECT * FROM "people" WHERE name = 'O''Rourke'

r   z(no format specification supported by SQLz%no format conversion supported by SQLNz6cannot switch from automatic field numbering to manualz6cannot switch from manual field numbering to automaticr   )	Ú
_formatterÚparser!   Ú
ValueErrorÚappendrs   ÚisdigitrU   r=   )	r"   ÚargsÚkwargsÚrvÚautonumÚpreÚnameÚspecÚconvs	            r   ÚformatÚ
SQL.formatÜ   só   € ðF  "ˆØˆð &*§_¡_×%:Ñ%:¸4¿9¹9Ö%EÑ!ˆC�tÞÜ Ð!KÓLÐLÞÜ Ð!HÓIÐIÞØ—	‘	œ#˜c›(Ô#à‰|Ùà�|‰|�~‰~ÞÜ$ØPóð ð —	‘	˜$œs 4›y™/Ô*Ø’æØ‘?Ü$ØPóð ð —	‘	˜$™-Ô(Ø˜1‘’ð —	‘	˜&™,Ö'ñ9 &Fô< ˜‹|Ðr   c                ó   • g r   r\   ©r"   ra   s     r   ri   ÚSQL.join$  s   € Ø9<r   c                ó   • g r   r\   r–   s     r   ri   r—   '  s   € Ø47r   c                ój  • [        U5      n [        U5      n[	        U[
        5      (       a~  [        U5      nU He  n[	        U[
        5      (       d!  [        S[        U5      R                   35      eUR                  U R                  5        UR                  U5        Mg     [        U6 $ U/nU H[  n[	        U[
        5      (       a!  [        S[        U5      R                   35      eUR                  U 5        UR                  U5        M]     [        U5      $ ! [         a    [        / 5      s $ f = f)an  
Join a sequence of `Composable`.

:param seq: the elements to join.

Use the `!SQL` object's string to separate the elements in `!seq`.
Elements that are not `Composable` will be considered `Literal`.

If the arguments are `Template` instance, return a `Template` joining
all the items. Note that arguments must either be all templates or
none should be.

Note that `Composed` objects are iterable too, so they can be used as
argument for this method.

Example::

    >>> snip = sql.SQL(', ').join(
    ...     sql.Identifier(n) for n in ['foo', 'bar', 'baz'])
    >>> print(snip.as_string(conn))
    "foo", "bar", "baz"
zcan't mix Template and )rl   ÚnextÚStopIterationr=   r4   r   Úlistrt   rH   r)   r‰   r!   Úextend)r"   ra   ÚitÚfirstÚitemsÚtÚcsÚis           r   ri   r—   *  s	  € ô0 �#‹Yˆð	 Ü˜“HˆEô �eœX×&Ñ&Ü˜“KˆEÛ�Ü! !¤X×.Ñ.Ü#Ð&=¼dÀ1»g×>NÑ>NÐ=OÐ$PÓQÐQØ—‘˜TŸY™YÔ'Ø—‘˜Q–ñ	 ô
 ˜UÐ#Ð#àˆWˆÛˆAÜ˜!œX×&Ñ&ÜÐ"9¼$¸q»'×:JÑ:JÐ9KÐ LÓMÐMØ�I‰I�dŒOØ�I‰I�aŽLñ	 ô ˜‹|Ðøô' ó 	 Ü˜B“<Òð	 ús   �D ÄD2Ä1D2r\   )r   r   r   rS   rQ   )r‹   r   rŒ   r   rO   r=   )ra   zIterable[Template]rO   r   )ra   úIterable[Any]rO   r=   )ra   r¤   rO   zComposed | Template)r)   rW   rX   rY   rZ   rw   ÚstringÚ	Formatterr†   r#   r   r0   r“   r   ri   r[   rx   ry   s   @r   rs   rs   ±   s]   ø‡ ñð4 ÓØ×!Ò!Ó#€J÷Pö
ö%ô
FðP Û<ó Ø<àÛ7ó Ø7÷.ò .r   rs   c                  ó^   ^ • \ rS rSr% SrS\S'   S
U 4S jjrSS jrSSS jjrSS jr	S	r
U =r$ )Ú
Identifieri[  aÓ  
A `Composable` representing an SQL identifier or a dot-separated sequence.

Identifiers usually represent names of database objects, such as tables or
fields. PostgreSQL identifiers follow `different rules`__ than SQL string
literals for escaping (e.g. they use double quotes instead of single).

.. __: https://www.postgresql.org/docs/current/sql-syntax-lexical.html#         SQL-SYNTAX-IDENTIFIERS

Example::

    >>> t1 = sql.Identifier("foo")
    >>> t2 = sql.Identifier("ba'r")
    >>> t3 = sql.Identifier('ba"z')
    >>> print(sql.SQL(', ').join([t1, t2, t3]).as_string(conn))
    "foo", "ba'r", "ba""z"

Multiple strings can be passed to the object to represent a qualified name,
i.e. a dot-separated sequence of identifiers.

Example::

    >>> query = sql.SQL("SELECT {} FROM {}").format(
    ...     sql.Identifier("table", "field"),
    ...     sql.Identifier("schema", "table"))
    >>> print(query.as_string(conn))
    SELECT "table"."field" FROM "schema"."table"

zSequence[str]r!   c                ó¤   >• [         TU ]  U5        U(       d  [        S5      eU H(  n[        U[        5      (       a  M  [        SU< S35      e   g )NzIdentifier cannot be emptyz*SQL identifier parts must be strings, got rr   )r`   r#   rt   r4   rP   )r"   ÚstringsÚsr(   s      €r   r#   ÚIdentifier.__init__}  sO   ø€ ä‰Ñ˜Ô!æÜÐ8Ó9Ð9ãˆAÜ˜a¤×%Ó%ÜØ@ÀÁÀXÐNóð ò r   c                óˆ   • U R                   R                   SSR                  [        [        U R
                  5      5       S3$ )Nr&   ú, r'   )r(   r)   ri   ÚmapÚreprr!   r*   s    r   r+   ÚIdentifier.__repr__Š  s5   € Ø—.‘.×)Ñ)Ð*¨!¨D¯I©I´c¼$ÀÇ	Á	Ó6JÓ,KÐ+LÈAÐNÐNr   c                ó”  • U(       a  UR                   OS =n(       aZ  [        UR                  5      n[        U5      nU R                   Vs/ s H"  oSR                  UR                  U5      5      PM$     nnO8U R                   Vs/ s H!  oPR                  UR                  5       5      PM#     nnSR                  U5      $ s  snf s  snf )Nó   .)	r3   r   Úpgconnr   r!   Úescape_identifierr�   Ú_escape_identifierri   )r"   r   rƒ   Úescr9   r«   Úescss          r   r0   ÚIdentifier.as_bytes�  s˜   € Þ*1�G×&Ò&°tÐ<ˆ4Õ<Ü˜4Ÿ;™;Ó'ˆCÜ Ó%ˆCØBFÇ)Â)ÓLÂ)¸Q×)Ñ)¨!¯(©(°3«-Ö8Á)ˆDÐLˆDàAEÇÂÓKÂ¸A×+Ñ+¨A¯H©H«JÖ7ÁˆDÐKØ�y‰y˜‹Ðùò MùâKs   Á)C Â(Cc                ó2   • SUR                  SS5      -   S-   $ )z;
Approximation of PQescapeIdentifier taking no connection.
ó   "s   "")Úreplace)r"   r«   s     r   r¶   ÚIdentifier._escape_identifier–  s   € ð �a—i‘i  eÓ,Ñ,¨tÑ3Ð3r   r\   )rª   rP   rN   r   rQ   )r«   r5   rO   r5   )r)   rW   rX   rY   rZ   rw   r#   r+   r0   r¶   r[   rx   ry   s   @r   r¨   r¨   [  s*   ø‡ ñð> Ó÷ôOö÷4ò 4r   r¨   c                  ó&   • \ rS rSrSrSSS jjrSrg)r   i�  ae  
A `Composable` representing an SQL value to include in a query.

Usually you will want to include placeholders in the query and pass values
as `~cursor.execute()` arguments. If however you really really need to
include a literal value in the query you can use this object.

The string returned by `!as_string()` follows the normal :ref:`adaptation
rules <types-adaptation>` for Python objects.

Example::

    >>> s1 = sql.Literal("fo'o")
    >>> s2 = sql.Literal(42)
    >>> s3 = sql.Literal(date(2000, 1, 1))
    >>> print(sql.SQL(', ').join([s1, s2, s3]).as_string(conn))
    'fo''o', 42, '2000-01-01'::date

Nc                ód   • [         R                  " U5      nUR                  U R                  5      $ r   )r   Úfrom_contextÚ
as_literalr!   )r"   r   Útxs      r   r0   ÚLiteral.as_bytes²  s%   € Ü×%Ò% gÓ.ˆØ�}‰}˜TŸY™YÓ'Ð'r   r\   r   rQ   )r)   rW   rX   rY   rZ   r0   r[   r\   r   r   r   r   �  s   † ñ÷((ñ (r   r   c                  ór   ^ • \ rS rSrSrS\R                  4S	U 4S jjjrS
S jrSSS jjr	SSS jjr
SrU =r$ )ÚPlaceholderi·  aÁ  A `Composable` representing a placeholder for query parameters.

If the name is specified, generate a named placeholder (e.g. ``%(name)s``,
``%(name)b``), otherwise generate a positional placeholder (e.g. ``%s``,
``%b``).

The object is useful to generate SQL queries with a variable number of
arguments.

Examples::

    >>> names = ['foo', 'bar', 'baz']

    >>> q1 = sql.SQL("INSERT INTO my_table ({}) VALUES ({})").format(
    ...     sql.SQL(', ').join(map(sql.Identifier, names)),
    ...     sql.SQL(', ').join(sql.Placeholder() * len(names)))
    >>> print(q1.as_string(conn))
    INSERT INTO my_table ("foo", "bar", "baz") VALUES (%s, %s, %s)

    >>> q2 = sql.SQL("INSERT INTO my_table ({}) VALUES ({})").format(
    ...     sql.SQL(', ').join(map(sql.Identifier, names)),
    ...     sql.SQL(', ').join(map(sql.Placeholder, names)))
    >>> print(q2.as_string(conn))
    INSERT INTO my_table ("foo", "bar", "baz") VALUES (%(foo)s, %(bar)s, %(baz)s)

Ú c                óJ  >• [         TU ]  U5        [        U[        5      (       d  [	        SU< 35      eSU;   a  [        SU< 35      e[        U5      [        L a  [        U5      n[        U[        5      (       d"  [	        S[        U5      R                  < 35      eX l	        g )Nzexpected string as name, got r'   zinvalid name: z!expected PyFormat as format, got )
r`   r#   r4   rP   rt   rˆ   rH   r   r)   Ú_format)r"   r�   r“   r(   s      €r   r#   ÚPlaceholder.__init__Ó  s•   ø€ Ü‰Ñ˜ÔÜ˜$¤×$Ñ$ÜÐ;¸D¹8ÐDÓEÐEà�$‹;Ü˜~¨d©XÐ6Ó7Ð7ä�‹<œ3ÒÜ˜fÓ%ˆFÜ˜&¤(×+Ñ+ÜØ3´D¸³L×4IÑ4IÑ3LÐMóð ð "(�r   c                óP  • / nU R                   (       a$  UR                  [        U R                   5      5        U R                  [        R
                  La(  UR                  SU R                  R                   35        U R                  R                   SSR                  U5       S3$ )Nzformat=r&   r®   r'   )
r!   r‰   r°   rÈ   r   ÚAUTOr�   r(   r)   ri   )r"   Úpartss     r   r+   ÚPlaceholder.__repr__ä  sx   € ØˆØ�9�9Ø�L‰Lœ˜dŸi™i›Ô)Ø�<‰<œxŸ}™}Ò,Ø�L‰L˜7 4§<¡<×#4Ñ#4Ð"5Ð6Ô7à—.‘.×)Ñ)Ð*¨!¨D¯I©I°eÓ,<Ð+=¸QÐ?Ð?r   c                ó~   • U R                   R                  nU R                  (       a  SU R                   SU 3$ SU 3$ )Nz%(r'   Ú%)rÈ   Úvaluer!   )r"   r   Úcodes      r   r   ÚPlaceholder.as_stringí  s9   € Ø�|‰|×!Ñ!ˆØ*.¯)¯)��D—I‘I�;˜a ˜vÐ&ÐC¸1¸T¸F¸ÐCr   c                ó‚   • U(       a  UR                   OS n[        U5      nU R                  U5      R                  U5      $ r   )r3   r   r   r�   r‚   s       r   r0   ÚPlaceholder.as_bytesñ  s5   € Þ%,ˆw×!Ò!°$ˆÜ˜DÓ!ˆØ�~‰~˜gÓ&×-Ñ-¨cÓ2Ð2r   )rÈ   )r�   rP   r“   zstr | PyFormatrN   r   rS   rQ   )r)   rW   rX   rY   rZ   r   rË   r#   r+   r   r0   r[   rx   ry   s   @r   rÅ   rÅ   ·  s3   ø† ñð6 $&ÀÇÁ÷ (ñ (ô"@öD÷3ô 3r   rÅ   ÚNULLÚDEFAULTc                óÀ   • [        U [        5      (       a  U R                  US9$ [        U [        5      (       a  SSKJn  U" X5      $ [        U 5      R                  US9$ )aÏ  Convert an object to a string according to SQL rules.

:param obj: the object to convert
:param context: the context in which to convert the object
:type context: `~psycopg.abc.AdaptContext` | `!None`

Adaptation happens according to the type of `!obj`:

- `Composable` objects are converted according to their
  `~Composable.as_string()` method;
- `~string.templatelib.Template` strings are converted according to the
  rules documented in :ref:`template-strings`;
- every other object is converted as it was :ref:`a parameter passed to a
  query <types-adaptation>`.

If `!context` is specified then it is be used to customize the conversion.
for example using the encoding of a connection or the dumpers registered.
©r   r   )r   )r4   r   r   r   Ú	_tstringsr   )r   r   r   s      r   r   r   ü  sU   € ô& �#”z×"Ñ"Ø�}‰} Wˆ}Ð-Ð-Ü	�Cœ×	"Ñ	"Ý(á˜Ó&Ð&ä�s‹|×%Ñ%¨gÐ%Ð6Ð6r   c                óÀ   • [        U [        5      (       a  U R                  US9$ [        U [        5      (       a  SSKJn  U" X5      $ [        U 5      R                  US9$ )zïConvert an object to a bytes string according to SQL rules.

:param obj: the object to convert
:param context: the context in which to convert the object
:type context: `~psycopg.abc.AdaptContext` | `!None`

See `as_string()` for details.
rØ   r   re   )r4   r   r0   r   rÙ   r   )r   r   r0   s      r   r0   r0     sU   € ô �#”z×"Ñ"Ø�|‰| Gˆ|Ð,Ð,Ü	�Cœ×	"Ñ	"Ý'á˜Ó%Ð%ä�s‹|×$Ñ$¨WÐ$Ð5Ð5r   r   )r   r   r   rR   rO   rP   )r   r   r   rR   rO   r5   )&rZ   Ú
__future__r   r7   r¥   Úabcr   r   Útypingr   r   Úcollections.abcr   r	   r
   Úpqr   r   Ú_enumsr   Ú_compatr   r   Ú
_encodingsr   Ú_transformerr   r   r   r=   rs   r¨   r   rÅ   rÕ   rÖ   r   r0   r\   r   r   Ú<module>rä      s©   ðñõ #ã Û ß #ß  ß 8Ñ 8å Ý Ý ß ,Ý %Ý %ö+ô B&�ô B&ôJB&ˆzô B&ôJgˆ*ô gôT?4�ô ?4ôD(ˆjô (ô4=3�*ô =3ñB ˆ6ƒ{€Ù
ˆi‹.€ö7÷:6r   