a *Na@sUddlZddlZddlZddlZddlmZmZddlmZm Z m Z ddl m Z ee dddZedejd gZee ed <d Zgd ZGd ddeZGdddeZGdddeZGdddeZGdddeZGdddeZdS)N expanduser expandvars)ListOptionalUnion) USER_AGENTreturncCsdtjvrtjdgSgS)NZPYTHON_GITLAB_CFG)osenvironr r h/private/var/folders/js/6pj4vh5d4zd0k6bxv74qrbhr0000gr/T/pip-target-22xwyzbs/lib/python/gitlab/config.py _env_configs  rz/etc/python-gitlab.cfgz~/.python-gitlab.cfg_DEFAULT_FILESzhelper:) job_token http_password private_token oauth_tokenc@s eZdZdS) ConfigErrorN__name__ __module__ __qualname__r r r rr,src@s eZdZdS) GitlabIDErrorNrr r r rr0src@s eZdZdS)GitlabDataErrorNrr r r rr4src@s eZdZdS)GitlabConfigMissingErrorNrr r r rr8src@s eZdZdS)GitlabConfigHelperErrorNrr r r rr<src@s:eZdZdeeeeeddddZddddZdS) GitlabConfigParserN) gitlab_id config_filesr c Cs||_|p t}d}|D]}tj|rd}q|sDtddtt |_ |j ||jdurz|j dd|_Wn.t y}ztd|WYd}~n d}~00z|j |jd|_Wn4t y}ztd |j|WYd}~n d}~00d|_z|j dd |_WnPtyLz|j dd |_Wnt yFYn0Ynt y^Yn0z|j |jd |_WnRtyz|j |jd |_Wnt yYn0Ynt yYn0d |_z|j dd |_Wnt yYn0z|j |jd |_Wnt y$Yn0d|_z|j |jd |_Wnt yVYn0d|_z|j |jd|_Wnt yYn0d|_z|j |jd|_Wnt yYn0d|_d|_z(|j |jd|_|j |jd|_Wnt yYn0|d|_z|j dd|_Wnt y<Yn0z|j |jd|_Wnt yhYn0|jdvrtd|jd|_d|jfD]0}z|j |d|_Wnt yYn0q|jdurd|jkrdksntd|jd|_z|j |jd|_Wnt y,Yn0d|_z|j |jd|_Wnt y^Yn0t |_!z|j dd|_!Wnt yYn0z|j |jd|_!Wnt yYn0dS)NFTzConfig file not found. Please create one in one of the following locations: {} or specify a config file using the '-c' parameter.z, globaldefaultz>Impossible to get the gitlab id (not specified in config file)urlz=Impossible to get gitlab informations from configuration (%s) ssl_verify<timeoutrrr http_usernamer4 api_version)r(zUnsupported API version: %sper_pagerdzUnsupported per_page number: %s paginationorder_by user_agent)"rrr pathexistsrformatjoin configparser ConfigParser_configreadget Exceptionrr#rr$ getboolean ValueErrorr&getintrrrr'r_get_values_from_helperr)r*r,r-rr.)selfrr _filesZ file_existfileesectionr r r__init__As        (zGitlabConfigParser.__init__r c CstD]}t||}t|tsq|ts2q|ttd}ddt |D}zt j |t j dd}WnRt jy}z8|j}td|d|jd||WYd}~n d}~00t|||qdS) zEUpdate attributes that may get values from an external helper programNcSsg|]}tt|qSr r).0tokenr r r z>GitlabConfigParser._get_values_from_helper..)stderrzutf-8zFailed to read z value from helper for z: )HELPER_ATTRIBUTESgetattr isinstancestrlowerstrip startswith HELPER_PREFIXlenshlexsplit subprocess check_outputPIPEdecodeCalledProcessErrorrGrrsetattr)r=attrvaluehelperZcommmandr@rGr r rr<s2  z*GitlabConfigParser._get_values_from_helper)NN)rrrrrKrrBr<r r r rr@s r)r3r rQrSos.pathrrtypingrrrZ gitlab.constrrKrr/r__annotations__rOrHr8rrrrrobjectrr r r rs&