
    K.h                    Z    d Z ddlmZ ddlZddlZddlZddlZddlmZ 	 	 	 	 	 	 	 dddZ	dS )a  Config handler.

This module allows people to keep their jira server credentials outside their script,
in a configuration file that is not saved in the source control.

Also, this simplifies the scripts by not having to write the same initialization code for each script.
    )annotationsN)JIRAhttp://localhost:2990adminFTprofile
str | Noneurlstrusernamepasswordverify
bool | strc                p   d }t          |t                    r|rdnd}n|}t          j        dd|||dd          } |d          }	|	rt	          j        d	|	 d
           | sD|	rB|                    |	           	 |                    dd          } n# t          j        $ r Y nw xY w| r|	r|                    |	           |                    | d          }|                    | d          }|                    | d          }|                    | d          }|                    | d          }	 |	                    | d          }n=# t          $ r |                    | d          }Y nw xY wt          t           d          t          j        }
||
d<   ||
d<   ||
d<   ||
d<   t          |
||f          S )a|  Return a JIRA object by loading the connection details from the `config.ini` file.

    Args:
        profile (Optional[str]): The name of the section from config.ini file that stores server config url/username/password
        url (str): URL of the Jira server
        username (str): username to use for authentication
        password (str): password to use for authentication
        appid: appid
        autofix: autofix
        verify (Union[bool, str]): True to indicate whether SSL certificates should be verified or
            str path to a CA_BUNDLE file or directory with certificates of trusted CAs. (Default: ``True``)

    Returns:
        JIRA: an instance to a JIRA object.

    Raises:
        EnvironmentError

    Usage:

        >>> from jira.config import get_jira
        >>>
        >>> jira = get_jira(profile='jira')

    Also create a `config.ini` like this and put it in current directory, user home directory or PYTHONPATH.

    .. code-block:: none

        [jira]
        url=https://jira.atlassian.com
        # only the `url` is mandatory
        user=...
        pass=...
        appid=...
        verify=...

    c                P   dt           j                            d          g}|                    t          j                   |D ]b}t           j                            t           j                            ||                     }t           j                            |          r|c S cdS )zrFind the file named path in the sys.path.

        Returns the full path name if found, None if not found
        .~N)ospath
expanduserextendsysabspathjoinisfile)r   pathsdirnamepossibles       ]/Users/user/workspace/sujinbaek/cqa-test-app/venv/lib/python3.11/site-packages/jira/config.pyfindfilezget_jira.<locals>.findfileB   s    
 bg((--.SX 	  	 Gwrw||GT'B'BCCHw~~h''   t    yesnoN)userpassappidautofixr   T)defaultsallow_no_valuez
config.inizFound z config filegeneralzdefault-jira-profiler	   r#   r$   r%   r&   r   zd was not able to locate the config.ini file in current directory, user home directory or PYTHONPATH.server)options
basic_auth)
isinstanceboolconfigparserConfigParserloggingdebugreadgetNoOptionError
getboolean
ValueErrorOSError__name__r   DEFAULT_OPTIONS)r   r	   r   r   r%   r&   r   r   configconfig_filer+   s              r   get_jirar=      sI   ^   &$  *d&
 
 	 	 	F (<((K :8{888999  	KK$$$ **Y0FGG-      	KK$$$**We,,Czz'622Hzz'622HJJw00Ejj)44G7**7H== 7 7 7GX667   B  B  B   "GGH GIGGGHXx,@AAAAs$   =B B&%B&1E  E+*E+)Nr   r   r   NFT)
r   r   r	   r
   r   r
   r   r
   r   r   )
__doc__
__future__r   r/   r1   r   r   jira.clientr   r=    r    r   <module>rB      s     # " " " " "      				 



       &
oB oB oB oB oB oB oBr    