pyfarm.agent.entrypoints.parser module¶
Parser¶
Module which forms the basis of a custom argparse based command line parser which handles setting configuration values automatically.
- pyfarm.agent.entrypoints.parser.assert_parser(func)[source]¶
ensures that the instance argument passed along to the validation function contains data we expect
- pyfarm.agent.entrypoints.parser.ip(*args, **kwargs)[source]¶
make sure the ip address provided is valid
- pyfarm.agent.entrypoints.parser.port(*args, **kwargs)[source]¶
convert and check to make sure the provided port is valid
- pyfarm.agent.entrypoints.parser.uuid_type(*args, **kwargs)[source]¶
validates that a string is a valid UUID type
- pyfarm.agent.entrypoints.parser.uidgid(*args, **kwargs)[source]¶
Retrieves and validates the user or group id for a command line flag
- pyfarm.agent.entrypoints.parser.direxists(*args, **kwargs)[source]¶
checks to make sure the directory exists
- pyfarm.agent.entrypoints.parser.fileexists(*args, **kwargs)[source]¶
checks to make sure the provided file exists
- pyfarm.agent.entrypoints.parser.number(*args, **kwargs)[source]¶
convert the given value to a number
- pyfarm.agent.entrypoints.parser.enum(*args, **kwargs)[source]¶
ensures that value is a valid entry in enum
- class pyfarm.agent.entrypoints.parser.ActionMixin(*args, **kwargs)[source]¶
Bases: object
A mixin which overrides the __init__ and __call__ methods on an action so we can:
- Setup attributes to manipulate the config object when the arguments are parsed
- Ensure we all required arguments are present
- Convert the type keyword into an internal representation so we don’t require as much work when we add arguments to the parser
- TYPE_MAPPING = {<function isdir at 0x7f9c4c95e0c8>: <function direxists at 0x7f9c45732758>, <function isfile at 0x7f9c4c95e050>: <function fileexists at 0x7f9c45732848>, <type 'int'>: <functools.partial object at 0x7f9c4572f940>}¶
- pyfarm.agent.entrypoints.parser.mix_action(class_)¶
- pyfarm.agent.entrypoints.parser.StoreAction¶
alias of _StoreAction
- pyfarm.agent.entrypoints.parser.SubParsersAction¶
alias of _SubParsersAction
- pyfarm.agent.entrypoints.parser.StoreConstAction¶
alias of _StoreConstAction
- pyfarm.agent.entrypoints.parser.StoreTrueAction¶
alias of _StoreTrueAction
- pyfarm.agent.entrypoints.parser.StoreFalseAction¶
alias of _StoreFalseAction
- pyfarm.agent.entrypoints.parser.AppendAction¶
alias of _AppendAction
- pyfarm.agent.entrypoints.parser.AppendConstAction¶
alias of _AppendConstAction
- class pyfarm.agent.entrypoints.parser.AgentArgumentParser(*args, **kwargs)[source]¶
Bases: argparse.ArgumentParser
A modified ArgumentParser which interfaces with the agent’s configuration.