tf.compat.v1.flags.ArgumentParser
Stay organized with collections
Save and categorize content based on your preferences.
Base class used to parse and convert arguments.
The :meth:parse
method checks to make sure that the string argument is a
legal value and convert it to a native type. If the value cannot be
converted, it should throw a ValueError
exception with a human
readable explanation of why the value is illegal.
Subclasses should also define a syntactic_help string which may be
presented to the user to describe the form of the legal values.
Argument parser classes must be stateless, since instances are cached
and shared between flags. Initializer arguments are allowed, but all
member variables must be derived from initializer arguments only.
Methods
flag_type
flag_type() -> Text
Returns a string representing the type of the flag.
parse
parse(
argument: Text
) -> Optional[_T]
Parses the string argument and returns the native value.
By default it returns its argument unmodified.
Args |
argument
|
string argument passed in the commandline.
|
Raises |
ValueError
|
Raised when it fails to parse the argument.
|
TypeError
|
Raised when the argument has the wrong type.
|
Returns |
The parsed value in native type.
|
Class Variables |
syntactic_help
|
''
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates. Some content is licensed under the numpy license.
Last updated 2024-04-26 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-04-26 UTC."],[],[],null,["# tf.compat.v1.flags.ArgumentParser\n\n\u003cbr /\u003e\n\nBase class used to parse and convert arguments.\n\nThe :meth:`parse` method checks to make sure that the string argument is a\nlegal value and convert it to a native type. If the value cannot be\nconverted, it should throw a `ValueError` exception with a human\nreadable explanation of why the value is illegal.\n\nSubclasses should also define a syntactic_help string which may be\npresented to the user to describe the form of the legal values.\n\nArgument parser classes must be stateless, since instances are cached\nand shared between flags. Initializer arguments are allowed, but all\nmember variables must be derived from initializer arguments only.\n\nMethods\n-------\n\n### `flag_type`\n\n flag_type() -\u003e Text\n\nReturns a string representing the type of the flag.\n\n### `parse`\n\n parse(\n argument: Text\n ) -\u003e Optional[_T]\n\nParses the string argument and returns the native value.\n\nBy default it returns its argument unmodified.\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Args ||\n|------------|--------------------------------------------|\n| `argument` | string argument passed in the commandline. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Raises ||\n|--------------|----------------------------------------------|\n| `ValueError` | Raised when it fails to parse the argument. |\n| `TypeError` | Raised when the argument has the wrong type. |\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Returns ||\n|---|---|\n| The parsed value in native type. ||\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n\u003cbr /\u003e\n\n| Class Variables --------------- ||\n|----------------|------|\n| syntactic_help | `''` |\n\n\u003cbr /\u003e"]]