aboutsummaryrefslogtreecommitdiff
path: root/absl/flags/__init__.py
diff options
context:
space:
mode:
authorMaxwell Bileschi <mlbileschi@google.com>2020-05-15 08:43:05 -0700
committerCopybara-Service <copybara-worker@google.com>2020-05-15 08:43:28 -0700
commit44c3e1becc77c5c096727c48cacfb3eb78839d82 (patch)
tree48ea09642992cf9545cd27dbe98ed2631c8b2a52 /absl/flags/__init__.py
parent3689f7e275b6bb5d2c28cf775c04b5109ba46a08 (diff)
downloadabsl-py-44c3e1becc77c5c096727c48cacfb3eb78839d82.tar.gz
Revert adding type annotations for ArgumentParser and Flag.
Some Google-internal code wasn't ready for this yet. PiperOrigin-RevId: 311736234 Change-Id: I4ff0f0405124b304fa30dab03447ce8ef591a94a
Diffstat (limited to 'absl/flags/__init__.py')
-rw-r--r--absl/flags/__init__.py23
1 files changed, 15 insertions, 8 deletions
diff --git a/absl/flags/__init__.py b/absl/flags/__init__.py
index a82986b..226f4f1 100644
--- a/absl/flags/__init__.py
+++ b/absl/flags/__init__.py
@@ -11,6 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
+
"""This package is used to define and parse command line flags.
This package defines a *distributed* flag-definition policy: rather than
@@ -74,6 +75,7 @@ DEFINE_multi_enum_class = _defines.DEFINE_multi_enum_class
DEFINE_alias = _defines.DEFINE_alias
# pylint: enable=invalid-name
+
# Flag validators.
register_validator = _validators.register_validator
validator = _validators.validator
@@ -84,11 +86,13 @@ mark_flags_as_required = _validators.mark_flags_as_required
mark_flags_as_mutual_exclusive = _validators.mark_flags_as_mutual_exclusive
mark_bool_flags_as_mutual_exclusive = _validators.mark_bool_flags_as_mutual_exclusive
+
# Key flag related functions.
declare_key_flag = _defines.declare_key_flag
adopt_module_key_flags = _defines.adopt_module_key_flags
disclaim_key_flags = _defines.disclaim_key_flags
+
# Module exceptions.
# pylint: disable=invalid-name
Error = _exceptions.Error
@@ -100,6 +104,7 @@ UnparsedFlagAccessError = _exceptions.UnparsedFlagAccessError
ValidationError = _exceptions.ValidationError
FlagNameConflictsWithMethodError = _exceptions.FlagNameConflictsWithMethodError
+
# Public classes.
Flag = _flag.Flag
BooleanFlag = _flag.BooleanFlag
@@ -123,26 +128,28 @@ CsvListSerializer = _argument_parser.CsvListSerializer
WhitespaceSeparatedListParser = _argument_parser.WhitespaceSeparatedListParser
# pylint: enable=invalid-name
+
# Helper functions.
get_help_width = _helpers.get_help_width
text_wrap = _helpers.text_wrap
flag_dict_to_args = _helpers.flag_dict_to_args
doc_to_help = _helpers.doc_to_help
+
# Special flags.
_helpers.SPECIAL_FLAGS = FlagValues()
DEFINE_string(
'flagfile', '',
'Insert flag definitions from the given file into the command line.',
- _helpers.SPECIAL_FLAGS) # pytype: disable=wrong-arg-types
-
-DEFINE_string('undefok', '',
- 'comma-separated list of flag names that it is okay to specify '
- 'on the command line even if the program does not define a flag '
- 'with that name. IMPORTANT: flags in this list that have '
- 'arguments MUST use the --flag=value format.',
- _helpers.SPECIAL_FLAGS) # pytype: disable=wrong-arg-types
+ _helpers.SPECIAL_FLAGS)
+
+DEFINE_string(
+ 'undefok', '',
+ 'comma-separated list of flag names that it is okay to specify '
+ 'on the command line even if the program does not define a flag '
+ 'with that name. IMPORTANT: flags in this list that have '
+ 'arguments MUST use the --flag=value format.', _helpers.SPECIAL_FLAGS)
# The global FlagValues instance.
FLAGS = _flagvalues.FLAGS