
    9h                     <   S r SSKrSSKr\R                  " S5      r " S S\R
                  5      r\R                  " \R                  * S9r\R                  (       a  \R                  " \R                  * S9rO\r\\-
  r " S S\R
                  5      r\" 5       rg)ztzinfo implementations for psycopg2

This module holds two different tzinfo implementations that can be used as
the 'tzinfo' argument to datetime constructors, directly passed to psycopg
functions or used to set the .tzinfo_factory attribute in cursors.
    Nc                   p   ^  \ rS rSrSrSr\r0 rSS jr	SU 4S jjr
S rS rS rS	 rS
 rS rS rSrU =r$ )FixedOffsetTimezone$   a  Fixed offset in minutes east from UTC.

This is exactly the implementation__ found in Python 2.3.x documentation,
with a small change to the `!__init__()` method to allow for pickling
and a default name in the form ``sHH:MM`` (``s`` is the sign.).

The implementation also caches instances. During creation, if a
FixedOffsetTimezone instance has previously been created with the same
offset and name that instance will be returned. This saves memory and
improves comparability.

.. versionchanged:: 2.9

    The constructor can take either a timedelta or a number of minutes of
    offset. Previously only minutes were supported.

.. __: https://docs.python.org/library/datetime.html
Nc                     Ub9  [        U[        R                  5      (       d  [        R                  " US9nXl        Ub  X l        g g )N)minutes)
isinstancedatetime	timedelta_offset_name)selfoffsetnames      =/var/www/html/env/lib/python3.13/site-packages/psycopg2/tz.py__init__FixedOffsetTimezone.__init__<   s@    fh&8&899!++F;!LJ     c                    > X4n U R                   U   $ ! [         a#    [        TU ]  XU5      nX@R                   U'   Us $ f = f)z@Return a suitable instance created earlier if it exists
        )_cacheKeyErrorsuper__new__)clsr   r   keytz	__class__s        r   r   FixedOffsetTimezone.__new__D   sN     n	::c?" 	d3B JJsOI	s    *AAc                 @    SU R                   < SU R                  < S3$ )Nz'psycopg2.tz.FixedOffsetTimezone(offset=z, name=)r   r   r   s    r   __repr__FixedOffsetTimezone.__repr__O   s    ||TZZ) 	)r   c                 j    [        U[        5      (       a  U R                  UR                  :H  $ [        $ Nr   r   r   NotImplementedr   others     r   __eq__FixedOffsetTimezone.__eq__S   )    e011<<5==00!!r   c                 j    [        U[        5      (       a  U R                  UR                  :g  $ [        $ r%   r&   r(   s     r   __ne__FixedOffsetTimezone.__ne__Y   r,   r   c                 2    U R                   U R                  4$ r%   r    r!   s    r   __getinitargs__#FixedOffsetTimezone.__getinitargs___   s    ||TZZ''r   c                     U R                   $ r%   )r   r   dts     r   	utcoffsetFixedOffsetTimezone.utcoffsetb   s    ||r   c                     U R                   b  U R                   $ [        U R                  R                  5       S5      u  p#[        US5      u  pBSU-  nU(       d  U(       a  USU-  -  nU(       a  USU-  -  nU$ )N<   z%+03dz:%02d)r   divmodr   total_seconds)r   r5   r   secondshoursrvs         r   tznameFixedOffsetTimezone.tznamee   st    ::!::!$,,"<"<">C,u_g'G##Bg''	r   c                     [         $ r%   )ZEROr4   s     r   dstFixedOffsetTimezone.dsts   s    r   )r   r   )NN)__name__
__module____qualname____firstlineno____doc__r   rB   r   r   r   r   r"   r*   r.   r1   r6   r?   rC   __static_attributes____classcell__)r   s   @r   r   r   $   sK    $ EGF	)""( r   r   )r<   c                   0    \ rS rSrSrS rS rS rS rSr	g)	LocalTimezone   zfPlatform idea of local timezone.

This is the exact implementation from the Python 2.3 documentation.
c                 F    U R                  U5      (       a  [        $ [        $ r%   )_isdst	DSTOFFSET	STDOFFSETr4   s     r   r6   LocalTimezone.utcoffset   s    ;;r??r   c                 F    U R                  U5      (       a  [        $ [        $ r%   )rP   DSTDIFFrB   r4   s     r   rC   LocalTimezone.dst   s    ;;r??NKr   c                 F    [         R                  U R                  U5         $ r%   )timer?   rP   r4   s     r   r?   LocalTimezone.tzname   s    {{4;;r?++r   c           	      "   UR                   UR                  UR                  UR                  UR                  UR
                  UR                  5       SS4	n[        R                  " U5      n[        R                  " U5      nUR                  S:  $ )Nr   )yearmonthdayhourminutesecondweekdayrX   mktime	localtimetm_isdst)r   r5   ttstamps       r   rP   LocalTimezone._isdst   sg    ggrxxggryy"))jjlAr# B^^E"{{Qr    N)
rE   rF   rG   rH   rI   r6   rC   r?   rP   rJ   ri   r   r   rM   rM      s    ,r   rM   )rI   r	   rX   r
   rB   tzinfor   timezonerR   daylightaltzonerQ   rU   rM   LOCALri   r   r   <module>ro      s   :  !P(// Pf ~6	==""DLL=9II
i
HOO : 	r   