
    qh                         S r / SQrSSKrSSKrSSKJr  \R                  " \5      rSS/r	/ SQr
S rSS	 jrSS
 jrSS jrSS jrS rS rS r " S S\5      rg)zOThis module contains general utility code that is used throughout
the library.
)log
appendArgstoBase64
fromBase64autoSubmitHTML	toUnicode    N)	urlencodezdefusedxml.cElementTreezdefusedxml.ElementTree)zxml.etree.cElementTreezxml.etree.ElementTreecElementTreezelementtree.ElementTreec                 d    [        U [        5      (       a  U R                  S5      $ [        U 5      $ )zReturns the given argument as a unicode object.

@param value: A UTF-8 encoded string or a unicode (coercable) object
@type message: str or unicode

@returns: Unicode object representing the input value.
utf-8)
isinstancebytesdecodestr)values    @/var/www/html/env/lib/python3.13/site-packages/openid/oidutil.pyr   r      s*     %||G$$u:    c                     [        U [        5      (       a
  [        U SS9n [        U[        5      (       a
  [        USS9nSU< SU < S3nU$ )Nr   encodingz
<html>
<head>
  <title>z=</title>
</head>
<body onload="document.forms[0].submit();">
z
<script>
var elements = document.forms[0].elements;
for (var i = 0; i < elements.length; i++) {
  elements[i].style.display = "none";
}
</script>
</body>
</html>
)r   r   r   )formtitlehtmls      r   r   r   ,   sJ    $4'*%EG,  dD  Kr   c                 f    U c  [         n  [        U 5      $ ! [         a    [        SU < 35      ef = f)aR  Find a working ElementTree implementation that is not vulnerable
to XXE, using `defusedxml`.

>>> XXESafeElementTree = importSafeElementTree()

@param module_names: The names of modules to try to use as
    a safe ElementTree. Defaults to C{L{xxe_safe_elementtree_modules}}

@returns: An ElementTree module that is not vulnerable to XXE.
zSUnable to find a ElementTree module that is not vulnerable to XXE. Tried importing )xxe_safe_elementtree_modulesimportElementTreeImportError)module_namess    r   importSafeElementTreer   D   sI     3C .. C2>B C 	CCs   
 0c                    U c  [         n U  H'  n [        USSS/5      n UR                  S5        Us  $    [        SU < 35      e! [        [        [
        4 a    e   [        R                  SU-  5         Ml  = f! [         a     M|  f = f)a"  Find a working ElementTree implementation, trying the standard
places that such a thing might show up.

>>> ElementTree = importElementTree()

@param module_names: The names of modules to try to use as
    ElementTree. Defaults to C{L{elementtree_modules}}

@returns: An ElementTree module
Nunusedz	<unused/>zRNot using ElementTree library %r because it failed to parse a trivial document: %szKNo ElementTree library found. You may need to install one. Tried importing )	elementtree_modules
__import__XML
SystemExitMemoryErrorAssertionErrorlogger	exceptionr   )r   mod_nameElementTrees      r   r   r   Y   s     * 	#$XtTH:FK
	#, #"! !$ 2>B C 	C ^< ?  35=>?  		s   A;A/A8;
B	B	c                 0    [         R                  SU 5        g)a  Handle a log message from the OpenID library.

This is a legacy function which redirects to logger.error.
The logging module should be used instead of this

@param message: A string containing a debugging message from the
    OpenID library
@type message: str

@param level: The severity of the log message. This parameter is
    currently unused, but in the future, the library may indicate
    more important information with a higher level value.
@type level: int or None

@returns: Nothing.
zHThis is a legacy log message, please use the logging module. Message: %sN)r(   error)messagelevels     r   r   r   ~   s    $ LL 018:r   c                    [        US5      (       a  [        UR                  5       5      nO[        U5      n[	        U [
        5      (       d
  [        U SS9n U(       d  U $ SU ;   a  SnOSnSnU H[  u  pE[	        U[        5      (       d  UR                  S5      n[	        U[        5      (       d  UR                  S5      nXE4X'   US-  nM]     U < U< [        U5      < 3$ )a  Append query arguments to a HTTP(s) URL. If the URL already has
query arguemtns, these arguments will be added, and the existing
arguments will be preserved. Duplicate arguments will not be
detected or collapsed (both will appear in the output).

@param url: The url to which the arguments will be appended
@type url: str

@param args: The query arguments to add to the URL. If a
    dictionary is passed, the items will be sorted before
    appending them to the URL. If a sequence of pairs is passed,
    the order of the sequence will be preserved.
@type args: A dictionary from string to string, or a sequence of
    pairs of strings.

@returns: The URL with the parameters added
@rtype: str
itemsr   r   ?&r      )	hasattrsortedr1   listr   r   r   encoder	   )urlargssepikvs         r   r   r      s    & tWdjjl#Dzc3#(

cz 	
A!U##!A!U##!A&	Q  C411r   c                     [        U [        5      (       a  U R                  S5      n [        R                  " U 5      SS $ )z7Represent string / bytes s as base64, omitting newlinesr   N)r   r   r8   binascii
b2a_base64)ss    r   r   r      s5    !SHHWq!#2&&r   c                     [        U [        5      (       a  U R                  S5      n  [        R                  " U 5      $ ! [        R
                   a  n[        [        U5      5      eS nAff = f)Nr   )r   r   r8   rA   
a2b_base64Error
ValueError)rC   whys     r   r   r      sV    !SHHW#""1%%>> #S""#s   > A+A&&A+c                   6    \ rS rSrSrS rS rS rS rS r	Sr
g	)
Symbol   zThis class implements an object that compares equal to others
of the same type that have the same name. These are distict from
str or unicode objects.
c                     Xl         g Nname)selfrO   s     r   __init__Symbol.__init__   s    	r   c                 n    [        U 5      [        U5      L =(       a    U R                  UR                  :H  $ rM   )typerO   rP   others     r   __eq__Symbol.__eq__   s'    DzT%[(DTYY%**-DDr   c                     X:X  + $ rM    rU   s     r   __ne__Symbol.__ne__   s    ""r   c                 D    [        U R                  U R                  45      $ rM   )hash	__class__rO   rP   s    r   __hash__Symbol.__hash__   s    T^^TYY/00r   c                 $    SU R                   < S3$ )Nz<Symbol >rN   r`   s    r   __repr__Symbol.__repr__   s     $		,,r   rN   N)__name__
__module____qualname____firstlineno____doc__rQ   rW   r[   ra   re   __static_attributes__rZ   r   r   rJ   rJ      s!    
E#1-r   rJ   )zOpenID transaction in progressrM   )r   )rk   __all__rA   loggingurllib.parser	   	getLoggerrg   r(   r   r"   r   r   r   r   r   r   r   r   objectrJ   rZ   r   r   <module>rr      s~   
   #			8	$   
 
0C*"CJ:,02f'#-V -r   