B xRψO@sddddgZddlZyddlmZWnek r@ddZYnXGd ddeZeZgfd dZgfd dZ d d Z ddZ ddZ ddZ edkrddlZeeejdddddgdS) GetoptErrorerrorgetopt gnu_getoptN)gettextcCs|S)N)srr)/opt/alt/python37/lib/python3.7/getopt.py_)r c@s&eZdZdZdZdddZddZdS)rcCs||_||_t|||dS)N)msgopt Exception__init__)selfr rrrr r.szGetoptError.__init__cCs|jS)N)r )rrrr __str__3szGetoptError.__str__N)r )__name__ __module__ __qualname__rr rrrrrr r+s cCsg}t|tdkr|g}nt|}x|r|ddr|ddkr|ddkr^|dd}P|ddrt||ddd||dd\}}q&t||ddd||dd\}}q&W||fS)Nr r-z--)typelist startswithdo_longs do_shorts)args shortoptslongoptsoptsrrr r8s   (*cCs6g}g}t|tr|g}nt|}|dr>|dd}d}ntjdrPd}nd}x|r,|ddkrz||dd7}P|ddddkrt||ddd||dd\}}qV|dddd kr|dd krt||ddd||dd\}}qV|r||7}PqV| |d|dd}qVW||fS) N+rTZPOSIXLY_CORRECTFrz--rr) isinstancestrrrosenvirongetrrappend)rrr r!Z prog_argsZall_options_firstrrr rcs2     ( (cCsy|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 argumentz--r )index ValueError long_has_argsrr r()r!rr rioptarghas_argrrr rs rcsfdd|D}|s(ttd|kr8dfSd|krLdfSt|dkrjttd|d }|d}|r|dd }||fS) Ncsg|]}|r|qSr)r).0o)rrr sz!long_has_args..zoption --%s not recognizedFr)Trzoption --%s not a unique prefixr)rr lenendswith)rr Z possibilitiesZ unique_matchr/r)rr r,s    r,cCsx|dkr|d|dd}}t||rj|dkr^|sHttd|||d|dd}}|d}}nd}|d||fqW||fS)Nr rrzoption -%s requires argumentr) short_has_argrr r()r!Z optstringrrrr.rrr rs    rcCsXx@tt|D]0}|||kr*dkrnq|d|dSqWttd||dS)N:rzoption -%s not recognized)ranger4rrr )rrr-rrr r6sr6__main__rza:bzalpha=Zbeta)__all__r%rr ImportErrorrrrrrrr,rr6rsysprintargvrrrr "s   + 2