Python: module telemetry.internal.util.command_line

telemetry.internal.util.command_line | index telemetry/internal/util/command_line.py

`# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.`

Modules
`` |  |
argparse | telemetry.internal.util.camel_case | difflib | optparse

Classes
`` |  | __builtin__.object ArgumentHandlerMixIn Command OptparseCommand SubcommandCommand
class ArgumentHandlerMixIn(__builtin__.object)
`` | `A structured way to handle command-line arguments. In AddCommandLineArgs, add command-line arguments. In ProcessCommandLineArgs, validate them and store them in a private class variable. This way, each class encapsulates its own arguments, without needing to pass an arguments object around everywhere.`
| Class methods defined here: AddCommandLineArgs(cls, parser) from __builtin__.type `Override to accept custom command-line arguments.` ProcessCommandLineArgs(cls, parser, args) from __builtin__.type `Override to process command-line arguments. We pass in parser so we can call parser.error().` Data descriptors defined here: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class Command(ArgumentHandlerMixIn)
`` | `An abstraction for things that run from the command-line.`
| Method resolution order: Command ArgumentHandlerMixIn __builtin__.object Methods defined here: Run(self, args) Class methods defined here: Description(cls) from __builtin__.type Name(cls) from __builtin__.type main(cls, args=None) from __builtin__.type `Main method to run this command as a standalone script.` Class methods inherited from ArgumentHandlerMixIn: AddCommandLineArgs(cls, parser) from __builtin__.type `Override to accept custom command-line arguments.` ProcessCommandLineArgs(cls, parser, args) from __builtin__.type `Override to process command-line arguments. We pass in parser so we can call parser.error().` Data descriptors inherited from ArgumentHandlerMixIn: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class OptparseCommand(Command)
`` | `# TODO: Convert everything to argparse.`
| Method resolution order: OptparseCommand Command ArgumentHandlerMixIn __builtin__.object Methods defined here: Run(self, args) Class methods defined here: AddCommandLineArgs(cls, parser, environment) from __builtin__.type CreateParser(cls) from __builtin__.type ProcessCommandLineArgs(cls, parser, args, environment) from __builtin__.type main(cls, args=None) from __builtin__.type `Main method to run this command as a standalone script.` Data and other attributes defined here: usage = '' Class methods inherited from Command: Description(cls) from __builtin__.type Name(cls) from __builtin__.type Data descriptors inherited from ArgumentHandlerMixIn: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`
class SubcommandCommand(Command)
`` | `Combines Commands into one big command with sub-commands. E.g. "svn checkout", "svn update", and "svn commit" are separate sub-commands. Example usage: class MyCommand(command_line.SubcommandCommand): commands = (Help, List, Run) if __name__ == '__main__': sys.exit(MyCommand.main())`
| Method resolution order: SubcommandCommand Command ArgumentHandlerMixIn __builtin__.object Methods defined here: Run(self, args) Class methods defined here: AddCommandLineArgs(cls, parser) from __builtin__.type ProcessCommandLineArgs(cls, parser, args) from __builtin__.type Data and other attributes defined here: commands = () Class methods inherited from Command: Description(cls) from __builtin__.type Name(cls) from __builtin__.type main(cls, args=None) from __builtin__.type `Main method to run this command as a standalone script.` Data descriptors inherited from ArgumentHandlerMixIn: __dict__ `dictionary for instance variables (if defined)` __weakref__ `list of weak references to the object (if defined)`

Functions
`` |  | GetMostLikelyMatchedObject(objects, target_name, name_func=<function <lambda>>, matched_score_threshold=0.4) `Matches objects whose names are most likely matched with target. Args: objects: list of objects to match. target_name: name to match. name_func: function to get object name to match. Default bypass. matched_score_threshold: threshold of likelihood to match. Returns: A list of objects whose names are likely target_name.`