1# Copyright 2017 The Abseil Authors. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15from absl.flags import _argument_parser 16from absl.flags import _defines 17from absl.flags import _exceptions 18from absl.flags import _flag 19from absl.flags import _flagvalues 20from absl.flags import _helpers 21from absl.flags import _validators 22 23# DEFINE functions. They are explained in more details in the module doc string. 24# pylint: disable=invalid-name 25DEFINE = _defines.DEFINE 26DEFINE_flag = _defines.DEFINE_flag 27DEFINE_string = _defines.DEFINE_string 28DEFINE_boolean = _defines.DEFINE_boolean 29DEFINE_bool = DEFINE_boolean # Match C++ API. 30DEFINE_float = _defines.DEFINE_float 31DEFINE_integer = _defines.DEFINE_integer 32DEFINE_enum = _defines.DEFINE_enum 33DEFINE_enum_class = _defines.DEFINE_enum_class 34DEFINE_list = _defines.DEFINE_list 35DEFINE_spaceseplist = _defines.DEFINE_spaceseplist 36DEFINE_multi = _defines.DEFINE_multi 37DEFINE_multi_string = _defines.DEFINE_multi_string 38DEFINE_multi_integer = _defines.DEFINE_multi_integer 39DEFINE_multi_float = _defines.DEFINE_multi_float 40DEFINE_multi_enum = _defines.DEFINE_multi_enum 41DEFINE_multi_enum_class = _defines.DEFINE_multi_enum_class 42DEFINE_alias = _defines.DEFINE_alias 43# pylint: enable=invalid-name 44 45# Flag validators. 46register_validator = _validators.register_validator 47validator = _validators.validator 48register_multi_flags_validator = _validators.register_multi_flags_validator 49multi_flags_validator = _validators.multi_flags_validator 50mark_flag_as_required = _validators.mark_flag_as_required 51mark_flags_as_required = _validators.mark_flags_as_required 52mark_flags_as_mutual_exclusive = _validators.mark_flags_as_mutual_exclusive 53mark_bool_flags_as_mutual_exclusive = _validators.mark_bool_flags_as_mutual_exclusive 54 55# Key flag related functions. 56declare_key_flag = _defines.declare_key_flag 57adopt_module_key_flags = _defines.adopt_module_key_flags 58disclaim_key_flags = _defines.disclaim_key_flags 59 60# Module exceptions. 61# pylint: disable=invalid-name 62Error = _exceptions.Error 63CantOpenFlagFileError = _exceptions.CantOpenFlagFileError 64DuplicateFlagError = _exceptions.DuplicateFlagError 65IllegalFlagValueError = _exceptions.IllegalFlagValueError 66UnrecognizedFlagError = _exceptions.UnrecognizedFlagError 67UnparsedFlagAccessError = _exceptions.UnparsedFlagAccessError 68ValidationError = _exceptions.ValidationError 69FlagNameConflictsWithMethodError = _exceptions.FlagNameConflictsWithMethodError 70 71# Public classes. 72Flag = _flag.Flag 73BooleanFlag = _flag.BooleanFlag 74EnumFlag = _flag.EnumFlag 75EnumClassFlag = _flag.EnumClassFlag 76MultiFlag = _flag.MultiFlag 77MultiEnumClassFlag = _flag.MultiEnumClassFlag 78FlagHolder = _flagvalues.FlagHolder 79FlagValues = _flagvalues.FlagValues 80ArgumentParser = _argument_parser.ArgumentParser 81BooleanParser = _argument_parser.BooleanParser 82EnumParser = _argument_parser.EnumParser 83EnumClassParser = _argument_parser.EnumClassParser 84ArgumentSerializer = _argument_parser.ArgumentSerializer 85FloatParser = _argument_parser.FloatParser 86IntegerParser = _argument_parser.IntegerParser 87BaseListParser = _argument_parser.BaseListParser 88ListParser = _argument_parser.ListParser 89ListSerializer = _argument_parser.ListSerializer 90CsvListSerializer = _argument_parser.CsvListSerializer 91WhitespaceSeparatedListParser = _argument_parser.WhitespaceSeparatedListParser 92EnumClassSerializer = _argument_parser.EnumClassSerializer 93# pylint: enable=invalid-name 94 95# Helper functions. 96get_help_width = _helpers.get_help_width 97text_wrap = _helpers.text_wrap 98flag_dict_to_args = _helpers.flag_dict_to_args 99doc_to_help = _helpers.doc_to_help 100 101# The global FlagValues instance. 102FLAGS = _flagvalues.FLAGS 103 104