diff --git a/pcl_expect/__init__.py b/pcl_expect/__init__.py index 53e643858eb018bb6e4586150a4f733a84ce25ec..4e42165716f57197ebb0338b35eb889401d2f4fa 100644 --- a/pcl_expect/__init__.py +++ b/pcl_expect/__init__.py @@ -19,8 +19,8 @@ __all__ = [ "BREAK", "Timeout", "BadArgs", - "expectable", - "controller", + "Expectable", + "Controller", "expect_after", "expect_before", "expect", @@ -54,7 +54,7 @@ def debug(s): if 0: sys.stderr.write("pcl-expect: %s\n" % s) -class expectable: +class Expectable: """Base class for something you can expect input from. This class is usable as-is if you want to expect input from a @@ -99,19 +99,19 @@ class expectable: """ def __init__(self, fileno): - """Create an expectable that reads from file descriptor fileno.""" + """Create an Expectable that reads from file descriptor fileno.""" self.__fileno = fileno self.__buffer = "" self.__eof_seen = False def close(self): - """Release all resources allocated by this expectable.""" + """Release all resources allocated by this Expectable.""" self.__fileno = None self.__buffer = "" self.__eof_seen = True def fileno(self): - """Return file descriptor number used by this expectable.""" + """Return file descriptor number used by this Expectable.""" return self.__fileno def _read(self): @@ -186,13 +186,13 @@ class expectable: self.__buffer = self.__buffer[n:] -class controller: +class Controller: """Loop controller object. This class is intended to be used to control a while loop that contains a single if...elif...elif statement, like this: - x = controller() + x = pcl_expect.Controller() while x.loop(): if x.<method>(...): ... @@ -476,13 +476,13 @@ def expect_after(expectations): If output from exp matches regexp, call callback. The regexp can be either a string (which will be compiled using re.compile()) or a precompiled regexp. See - controller.re() for info about attributes that are set + Controller.re() for info about attributes that are set on exp. (pcl_expect.EOF, exp, callback) If end-of-file is reached on exp, call callback. See - controller.timeout() for info about attributes that are + Controller.timeout() for info about attributes that are set on exp. (pcl_expect.TIMEOUT, callback) @@ -503,7 +503,7 @@ def expect_after(expectations): pcl_expect.expect_after([(pcl_expect.TIMEOUT, timeout_cb)]) The above example will cause timeouts to exit the process after - printing a message. Both timeouts during a controller- + printing a message. Both timeouts during a Controller- controlled loop and during a call to pcl_expect.expect will be affected. @@ -520,7 +520,7 @@ def expect_before(expectations): See expect_after for more info. The patterns supplied via this function will be tried before the patterns specified in a - specific call to pcl_expect.expect or in a controller- + specific call to pcl_expect.expect or in a Controller- controlled loop. """ @@ -547,7 +547,7 @@ def __validate_expectations(expectations): def expect(expectations): """Wait for input. - The controller class provides an alternative API, which the + The Controller class provides an alternative API, which the author of pcl_expect believes produces more readable code. This function provides an API which is closer to the previous expect-like Python modules. @@ -559,13 +559,13 @@ def expect(expectations): If output from exp matches regexp, call callback. The regexp can be either a string (which will be compiled using re.compile()) or a precompiled regexp. See - controller.re() for info about attributes that are set + Controller.re() for info about attributes that are set on exp. (pcl_expect.EOF, exp[, callback]) If end-of-file is reached on exp, call callback. See - controller.timeout() for info about attributes that are + Controller.timeout() for info about attributes that are set on exp. (pcl_expect.TIMEOUT, [callback]) @@ -602,12 +602,12 @@ def expect(expectations): will also be returned if an unhandled timeout occurs and timeout_raises_exception is set to False. - - The expectable object that caused expect() to return, or + - The Expectable object that caused expect() to return, or None if it returned because of a timeout. If the first value is None, the second value will also be None. """ - x = controller() + x = Controller() while x.loop(): for ix in range(len(expectations)): pattern = expectations[ix]