B @`@sdZddlmZddlmZddlmZddlZddlmZej e ej e Gddde ZGd d d eZGd d d eZGd ddeZGdddeZGdddeZGdddeZGdddeZdS)zException classes in ABSL flags library. Do NOT import this module directly. Import the flags package and use the aliases defined at the package level instead. )absolute_import)division)print_functionN)_helpersc@seZdZdZdS)Errorz$The base class for all flags errors.N)__name__ __module__ __qualname____doc__r r :/tmp/pip-unpacked-wheel-01biqzia/absl/flags/_exceptions.pyr!src@seZdZdZdS)CantOpenFlagFileErrorz`Raised when flagfile fails to open. E.g. the file doesn't exist, or has wrong permissions. N)rrr r r r r r r %sr c@seZdZdZedddZdS)DuplicateFlagErrorz*Raised if there is a flag naming conflict.NcCsP|j|dd}|dkr t}n|j|dd}||j}d||||f}||S)aCreates a DuplicateFlagError by providing flag name and values. Args: flagname: str, the name of the flag being redefined. flag_values: FlagValues, the FlagValues instance containing the first definition of flagname. other_flag_values: FlagValues, if it is not None, it should be the FlagValues object where the second definition of flagname occurs. If it is None, we assume that we're being called when attempting to create the flag a second time, and we use the module calling this one as the source of the second definition. Returns: An instance of DuplicateFlagError. z )defaultNzeThe flag '%s' is defined twice. First from %s, Second from %s. Description from first occurrence: %s)Zfind_module_defining_flagrZget_calling_modulehelp)clsflagnameZ flag_valuesZother_flag_valuesZ first_moduleZ second_moduleZ flag_summarymsgr r r from_flag/s    zDuplicateFlagError.from_flag)N)rrr r classmethodrr r r r r,src@seZdZdZdS)IllegalFlagValueErrorz6Raised when the flag command line argument is illegal.N)rrr r r r r r rNsrcs"eZdZdZdfdd ZZS)UnrecognizedFlagErrorzRaised when a flag is unrecognized. Attributes: flagname: str, the name of the unrecognized flag. flagvalue: The value of the flag, empty if the flag is not defined. Ncs@||_||_|r dd|}nd}tt|d||fdS)Nz. Did you mean: %s ?z, rz Unknown command line flag '%s'%s)r flagvaluejoinsuperr__init__)selfrrZ suggestionsZtip) __class__r r rZs zUnrecognizedFlagError.__init__)rN)rrr r r __classcell__r r )rr rRsrc@seZdZdZdS)UnparsedFlagAccessErrorz>Raised when accessing the flag value from unparsed FlagValues.N)rrr r r r r r r gsr c@seZdZdZdS)ValidationErrorz7Raised when flag validator constraint is not satisfied.N)rrr r r r r r r!ksr!c@seZdZdZdS) FlagNameConflictsWithMethodErrorz:Raised when a flag name conflicts with FlagValues methods.N)rrr r r r r r r"osr")r __future__rrrsysZ absl.flagsrZdisclaim_module_idsaddidmodulesr Exceptionrr rrrr r!r"r r r r s    "