U e5dA@sddddgZddlZzddlmZWnek r@ddZYnXGd ddeZeZgfd dZgfd dZ d d Z ddZ ddZ ddZ edkrddlZeeejdddddgdS) GetoptErrorerrorgetopt gnu_getoptN)gettextcCs|SN)srr/usr/lib64/python3.8/getopt.py_)r c@s&eZdZdZdZdddZddZdS)rcCs||_||_t|||dSr)msgopt Exception__init__)selfrrrrr r.szGetoptError.__init__cCs|jSr)r)rrrr __str__3szGetoptError.__str__N)r )__name__ __module__ __qualname__rrrrrrrr r+s cCsg}t|tdkr|g}nt|}|r|ddr|ddkr|ddkr\|dd}q|ddrt||ddd||dd\}}q$t||ddd||dd\}}q$||fS)Nr r---)typelist startswithdo_longs do_shorts)args shortoptslongoptsoptsrrr r8s  ((cCs6g}g}t|tr|g}nt|}|dr>|dd}d}ntjdrPd}nd}|r.|ddkrz||dd7}q.|ddddkrt||ddd||dd\}}qT|dddd kr|dd krt||ddd||dd\}}qT|r||7}q.qT| |d|dd}qT||fS) N+rTZPOSIXLY_CORRECTFrrrr) isinstancestrrrosenvirongetrrappend)r r!r"r#Z prog_argsZall_options_firstrrr rcs2     ( (cCsz|d}Wntk r&d}Yn X|d|||dd}}t||\}}|r|dkr|svttd|||d|dd}}n|dk rttd|||d||pdf||fS)N=rzoption --%s requires argumentrz%option --%s must not have an argumentrr )index ValueError long_has_argsrr r*)r#rr"r ioptarghas_argrrr rs rcsfdd|D}|s(ttd|kr8dfSd|krLdfSt|dkrjttd|d }|d}|r|dd }||fS) Ncsg|]}|r|qSr)r).0orrr s z!long_has_args..zoption --%s not recognizedFr+Trzoption --%s not a unique prefixr)rr lenendswith)rr"Z possibilitiesZ unique_matchr1rr4r r.s    r.cCs|dkr|d|dd}}t||rh|dkr\|sFttd|||d|dd}}|d}}nd}|d||fq||fS)Nr rrzoption -%s requires argumentr) short_has_argrr r*)r#Z optstringr!r rr0rrr rs   rcCsXtt|D]4}|||kr(dkr nq |d|dSq ttd||dS)N:rzoption -%s not recognized)ranger7rrr )rr!r/rrr r9sr9__main__rza:bzalpha=Zbeta)__all__r'rr ImportErrorrrrrrrr.rr9rsysprintargvrrrr "s   + 2