Revision: 2561
Author: janne.t.harkonen
Date: Fri Feb 26 04:44:36 2010
Log: whitespace
http://code.google.com/p/robotframework/source/detail?r=2561

Modified:
 /trunk/src/robot/libraries/OperatingSystem.py

=======================================
--- /trunk/src/robot/libraries/OperatingSystem.py       Wed Aug 12 00:44:16 2009
+++ /trunk/src/robot/libraries/OperatingSystem.py       Fri Feb 26 04:44:36 2010
@@ -46,7 +46,7 @@


 class OperatingSystem:
-
+
     """A test library providing keywords for OS related tasks.

     `OperatingSystem` is Robot Framework's standard library that
@@ -82,7 +82,7 @@

     ROBOT_LIBRARY_SCOPE = 'GLOBAL'
     ROBOT_LIBRARY_VERSION = __version__
-
+
     def run(self, command, return_mode='DEPRECATED'):
         """Runs the given command in the system and returns the output.

@@ -100,16 +100,16 @@
         executed command does not contain additional output
         redirections. You can thus freely forward the standard error
         somewhere else, for example, like 'my_command 2>stderr.txt'.
-
+
         The returned output contains everything written into the
         standard output or error by the command (unless either of them
         is redirected explicitly). Many commands add an extra newline
         (\\n) after the output to make it easier to read in the
         console. To ease processing the returned output, this possible
         trailing newline is stripped.
-
+
         Examples:
-        | ${output} =        | Run       | ls -lhF /tmp |
+        | ${output} =        | Run       | ls -lhF /tmp |
         | Log                | ${output} |
| ${result} = | Run | ${CURDIR}${/}tester.py arg1 arg2 |
         | Should Not Contain | ${result} | FAIL |
@@ -136,7 +136,7 @@
         the 0-255 range. Since the RC is an integer, it must be
         checked e.g. with the keyword `Should Be Equal As Integers`
         instead of `Should Be Equal` (both are built-in keywords).
-
+
         Examples:
         | ${rc} = | Run and Return RC | ${CURDIR}${/}script.py arg |
         | Should Be Equal As Integers | ${rc} | 0 |
@@ -147,7 +147,7 @@
         output of the executed comand.
         """
         return self._run(command, 'RC')
-
+
     def run_and_return_rc_and_output(self, command):
"""Runs the given command in the system and returns the RC and output.

@@ -164,24 +164,24 @@
         | File Should Be Empty | /tmp/stderr.txt |
         """
         return self._run(command, 'RC,Output')
-
+
     def _run(self, command, mode):
         process = os.popen(self._process_command(command))
         stdout = process.read()
         if stdout.endswith('\n'):
             stdout = stdout[:-1]
         try:
-            rc = process.close()
+            rc = process.close()
         except IOError:  # Has occurred sometimes in Windows
             rc = -1      # -1 is eventually turned into 255
-        if rc is None:
+        if rc is None:
             rc = 0
-        # In Windows (Python and Jython) return code is value returned by
+        # In Windows (Python and Jython) return code is value returned by
         # command (can be almost anything)
         # In other OS:
         #   In Jython return code can be between '-255' - '255'
# In Python return code must be converted with 'rc >> 8' and it is
-        #   between 0-255 after conversion
+        #   between 0-255 after conversion
         if os.sep == '\\' or sys.platform.startswith('java'):
             rc = rc % 256
         else:
@@ -192,7 +192,7 @@
                 return rc, stdout
             return rc
         return stdout
-
+
     def _process_command(self, command):
         if sys.platform.startswith('java'):
             # Jython's os.popen doesn't handle Unicode as explained in
@@ -201,38 +201,38 @@
         if '>' not in command:
             if command.endswith('&'):
                 command = command[:-1] + ' 2>&1 &'
-            else:
+            else:
                 command += ' 2>&1'
         self._info("Running command '%s'" % command)
         return command
-
+
     def start_process(self, command, stdin=None, alias=None):
         """Starts the given command as a background process.
-
+
         Starts the process in the background and sets this process as
         the current process. The following calls of the keywords `Read
         Process Output` or `Stop Process` affect this process, unless
         the keyword `Switch Process` is used.
-
+
         If the command needs input through the standard input stream,
         it can be defined with the `stdin` argument.  It is not
         possible to give input to the command later. Possible command
         line arguments must be given as part of the command like
         '/tmp/script.sh arg1 arg2'.
-
+
Returns the index of this process. The indexing starts from 1, and it can be used to switch between the processes with the `Switch Process`
         keyword. To end all processes and reset indexing, the
         `Stop All Processes` keyword must be used.
-
- The optional `alias` is a name for this process that may be used with
+
+ The optional `alias` is a name for this process that may be used with
         `Switch Process` instead of the returned index.

         Starting from Robot Framework 2.0.2, the standard error stream
         is redirected to the standard input stream automatically by
         adding '2>&1' after the executed command. This is done the
         same way, and for the same reasons, as with `Run` keyword.
-
+
         Example:
         | Start Process  | /path/longlasting.sh |
         | Do Something   |                      |
@@ -242,10 +242,10 @@
         """
         process = _Process(self._process_command(command), stdin)
         return PROCESSES.register(process, alias)
-
+
     def switch_process(self, index_or_alias):
         """Switches the active process to the specified process.
-
+
         The index is the return value of the `Start Process` keyword and an
         alias may have been defined to it.

@@ -260,10 +260,10 @@
         | [Teardown]     | Stop All Processes   |
         """
         PROCESSES.switch(index_or_alias)
-
+
     def read_process_output(self, mode='DEPRECATED'):
         """Waits for the process to finish and returns its output.
-
+
         In Robot Framework versions prior to 2.0.2 it was possible to
         read either the standard output, standard error or both. As
         mentioned in the documentation of `Start Process`, the
@@ -277,7 +277,7 @@
         from the process list. Trying to read from a stopped process
         nevertheless fails. To reset the process list (and indexes and
         aliases), `Stop All Processes` must be used.
-
+
         See `Start Process` and `Switch Process` for more information
         and examples about running processes.
         """
@@ -285,21 +285,21 @@
self._warn("'mode' argument for 'Read Process Output' keyword is "
                        "deprecated and will be removed in RF 2.2.")
         return PROCESSES.current.read()
-
+
     def stop_process(self):
         """Stops the current process without reading from it.
-
+
Stopping a process does not remove it from the process list. To reset the process list (and indexes and aliases), `Stop All Processes` must
         be used. Stopping an already stopped process has no effect.
-
+
         See `Start Process` and `Switch Process` for more information.
         """
         PROCESSES.current.close()
-
+
     def stop_all_processes(self):
         """Stops all the processes and removes them from the process list.
-
+
         Resets the indexing that `Start Process` uses. All aliases are
         also deleted. It does not matter have some of the processes
         already been closed or not.
@@ -308,12 +308,12 @@
         teardown to make sure all the started processes are closed.
         """
         PROCESSES.close_all()
-
+
     def get_file(self, path, encoding='UTF-8'):
         """Returns the contents of a specified file.
-
+
         This keyword reads the specified file and returns the contents.
- `encoding` defines the encoding of the file. By default the value is + `encoding` defines the encoding of the file. By default the value is
         'UTF-8', which means that UTF-8 and ASCII-encoded files are read
         correctly.
         """
@@ -323,7 +323,7 @@
         content = f.read()
         f.close()
         return unicode(content, encoding).replace('\r\n', '\n')
-
+
def grep_file(self, path, pattern, pattern_type='DEPRECATED', encoding='UTF-8'): """Returns the lines of the specified file that match the `pattern`.

@@ -359,23 +359,23 @@
         matches = _filter_lines(lines, pattern, pattern_type)
self._info('%d out of %d lines matched' % (len(matches), len(lines)))
         return '\n'.join(matches)
-
+
     def log_file(self, path, encoding='UTF-8'):
         """Wrapper for `Get File` that also logs the returned file.
-
+
         The file is logged with the INFO level. If you want something else,
         just use `Get File` and the built-in keyword `Log` with the desired
-        level.
+        level.
         """
         content = self.get_file(path, encoding)
         self._info(content)
         return content
-
+
     # File and directory existence
-
+
     def should_exist(self, path, msg=None):
         """Fails unless the given path (file or directory) exists.
-
+
         The path can be given as an exact path or as a pattern
         similarly as with `File Should Exist` keyword. The default
         error message can be overridden with the `msg` argument.
@@ -384,7 +384,7 @@
         if not glob.glob(path):
self._fail(msg, "Path '%s' does not match any file or directory" % path)
         self._link("Path '%s' exists", path)
-
+
     def should_not_exist(self, path, msg=None):
         """Fails if the given path (file or directory) exists.

@@ -404,10 +404,10 @@
             else:
                 msg = "Path '%s' exists" % path
         raise AssertionError(msg)
-
+
     def file_should_exist(self, path, msg=None):
         """Fails unless the given path points to an existing file.
-
+
         The path can be given as an exact path or as a pattern where:
         | *        | matches everything |
         | ?        | matches any single character |
@@ -428,7 +428,7 @@

     def file_should_not_exist(self, path, msg=None):
         """Fails if the given path points to an existing file.
-
+
         The path can be given as an exact path or as a pattern
         similarly as with `File Should Exist` keyword. The default
         error message can be overridden with the `msg` argument.
@@ -449,7 +449,7 @@

     def directory_should_exist(self, path, msg=None):
         """Fails unless the given path points to an existing directory.
-
+
         The path can be given as an exact path or as a pattern
         similarly as with `File Should Exist` keyword. The default
         error message can be overridden with the `msg` argument.
@@ -462,7 +462,7 @@

     def directory_should_not_exist(self, path, msg=None):
         """Fails if the given path points to an existing file.
-
+
         The path can be given as an exact path or as a pattern
         similarly as with `File Should Exist` keyword. The default
         error message can be overridden with the `msg` argument.
@@ -471,7 +471,7 @@
         matches = [ p for p in glob.glob(path) if os.path.isdir(p) ]
         if not matches:
             self._link("Directory '%s' does not exist", path)
-            return
+            return
         if msg is None:
             if self._is_pattern_path(path):
                 matches.sort()
@@ -480,7 +480,7 @@
             else:
                 msg = "Directory '%s' exists" % path
         raise AssertionError(msg)
-
+
     def _is_pattern_path(self, path):
         return '*' in path or '?' in path or ('[' in path and ']' in path)

@@ -493,7 +493,7 @@
         similarly as with `File Should Exist` keyword. If the path is
         a pattern, the keyword waits until all matching items are
         removed.
-
+
         The optional `timeout` can be used to control the maximum time of
         waiting. The timeout is given as a timeout string, e.g. in a format
         '15 seconds', '1min 10s' or just '10'. The time string format is
@@ -508,10 +508,10 @@
         while glob.glob(path):
             time.sleep(0.1)
             if timeout >= 0 and time.time() > maxtime:
-                raise AssertionError("'%s' was not removed in %s"
+                raise AssertionError("'%s' was not removed in %s"
                                      % (path, secs_to_timestr(timeout)))
         self._link("'%s' was removed", path)
-
+
     def wait_until_created(self, path, timeout='1 minute'):
         """Waits until the given file or directory is created.

@@ -534,7 +534,7 @@
         while not glob.glob(path):
             time.sleep(0.1)
             if timeout >= 0 and time.time() > maxtime:
-                raise AssertionError("'%s' was not created in %s"
+                raise AssertionError("'%s' was not created in %s"
                                      % (path, secs_to_timestr(timeout)))
         self._link("'%s' was created", path)

@@ -542,7 +542,7 @@

     def directory_should_be_empty(self, path, msg=None):
         """Fails unless the specified directory is empty.
-
+
The default error message can be overridden with the `msg` argument.
         """
         path = self._absnorm(path)
@@ -555,10 +555,10 @@
                         % (path, seq2str(items, lastsep=', '))
             raise AssertionError(msg)
         self._link("Directory '%s' is empty.", path)
-
+
     def directory_should_not_be_empty(self, path, msg=None):
         """Fails if the specified directory is empty.
-
+
The default error message can be overridden with the `msg` argument.
         """
         path = self._absnorm(path)
@@ -573,7 +573,7 @@

     def file_should_be_empty(self, path, msg=None):
         """Fails unless the specified file is empty.
-
+
The default error message can be overridden with the `msg` argument.
         """
         path = self._absnorm(path)
@@ -583,10 +583,10 @@
         if size > 0:
self._fail(msg, "File '%s' is not empty. Size: %d bytes" % (path, size))
         self._link("File '%s' is empty", path)
-
+
     def file_should_not_be_empty(self, path, msg=None):
         """Fails if the specified directory is empty.
-
+
The default error message can be overridden with the `msg` argument.
         """
         path = self._absnorm(path)
@@ -596,12 +596,12 @@
         if size == 0:
             self._fail(msg, "File '%s' is empty." % path)
         self._link("File '%%s' contains %d bytes" % size, path)
-
+
     # Creating and removing files and directory

     def create_file(self, path, content='', mode='DEPRECATED'):
         """Creates a file to the given path with the given content.
-
+
Old `mode` argument is deprecated in Robot Framework 2.1 and will be replaced with `encoding` in 2.2. Use new `Append To File` keyword if there is a need to append to a file, and use `File Should Not Exist`
@@ -610,7 +610,7 @@
         In Robot Framework 2.1 this keyword always uses UTF-8 encoding
         and `Create File With Encoding` can be used if other encodings
         are needed. Earlier versions used more limiting ASCII encoding.
-
+
If the directory where to create file does not exist it, and possible
         intermediate missing directories, are created.
         """
@@ -625,17 +625,17 @@
             open_mode = 'APPEND' in mode and 'a' or 'w'
         path = self._write_to_file(path, content, 'UTF-8', open_mode)
         self._link("Created file '%s'", path)
-
+
def create_file_with_encoding(self, path, content='', encoding='UTF-8'):
         """Writes the given contend to the specified file.

         Use `Append To File` if you want to append to an existing file.
-
+
If the directory where to create file does not exist it, and possible
         intermediate missing directories, are created.

This is a temporary keyword added in Robot Framework 2.1 and will be
-        deprecated in 2.2 when `Create File` gets `encoding` argument.
+        deprecated in 2.2 when `Create File` gets `encoding` argument.
         """
         path = self._write_to_file(path, content, encoding, 'w')
         self._link("Created file '%s'", path)
@@ -661,10 +661,10 @@

     def remove_file(self, path):
         """Removes a file with the given path.
-
+
         Passes if the file does not exist, but fails if the path does
         not point to a regular file (e.g. it points to a directory).
-
+
         The path can be given as an exact path or as a pattern
         similarly as with `File Should Exist` keyword. If the path is
         a pattern, all files matching it are removed.
@@ -678,7 +678,7 @@
                 raise DataError("Path '%s' is not a file" % match)
             os.remove(match)
             self._link("Removed file '%s'", match)
-
+
     def remove_files(self, *paths):
         """Uses `Remove File` to remove multiple files one-by-one.

@@ -687,7 +687,7 @@
         """
         for path in paths:
             self.remove_file(path)
-
+
     def empty_directory(self, path):
"""Deletes all the content (incl. subdirectories) from the given directory."""
         path = self._absnorm(path)
@@ -714,14 +714,14 @@
raise DataError("Path '%s' already exists but is not a directory" % path)
         os.makedirs(path)
         self._link("Created directory '%s'", path)
-
+
     def remove_directory(self, path, recursive=False):
         """Removes the directory pointed to by the given `path`.
-
+
         If the second argument `recursive` is set to any non-empty string,
         the directory is removed recursively. Otherwise removing fails if
         the directory is not empty.
-
+
If the directory pointed to by the `path` does not exist, the keyword
         passes, but it fails, if the `path` points to a file.
         """
@@ -738,13 +738,13 @@
             self.directory_should_be_empty(path, msg)
             os.rmdir(path)
         self._link("Removed directory '%s'", path)
-
+

     # Moving and copying files and directories
-
+
     def copy_file(self, source, destination):
         """Copies the source file into a new destination.
-
+
1) If the destination is an existing file, the source file is copied
         over it.

@@ -762,7 +762,7 @@
         """
         source, destination = self._copy_file(source, destination)
         self._link("Copied file from '%s' to '%s'", source, destination)
-
+
     def move_file(self, source, destination):
         """Moves the source file into a new destination.

@@ -794,17 +794,17 @@

     def copy_directory(self, source, destination):
         """Copies the source directory into the destination.
-
+
         If the destination exists, the source is copied under it. Otherwise
         the destination directory and the possible missing intermediate
         directories are created.
         """
         source, destination = self._copy_dir(source, destination)
self._link("Copied directory from '%s' to '%s'", source, destination)
-
+
     def move_directory(self, source, destination):
         """Moves the source directory into a destination.
-
+
         Uses `Copy Directory` keyword internally, and `source` and
         `destination` arguments have exactly same semantics as with
         that keyword.
@@ -837,10 +837,10 @@

     def get_environment_variable(self, name, default=None):
"""Returns the value of an environment variable with the given name.
-
- If no such environment variable is set, returns the default value, if
+
+ If no such environment variable is set, returns the default value, if
         given. Otherwise fails the test case.
-
+
         Note that you can also access environment variables directly using
         the variable syntax %{ENV_VAR_NAME}.
         """
@@ -848,7 +848,7 @@
         if ret is None:
raise DataError("Environment variable '%s' does not exist" % name)
         return ret
-
+
     def set_environment_variable(self, name, value):
         """Sets an environment variable to a specified value.

@@ -865,7 +865,7 @@

     def remove_environment_variable(self, name):
         """Deletes the specified environment variable.
-
+
         Does nothing if the environment variable is not set.
         """
         if os.environ.has_key(name):
@@ -873,10 +873,10 @@
             self._info("Environment variable '%s' deleted" % name)
         else:
             self._info("Environment variable '%s' does not exist" % name)
-
+
     def environment_variable_should_be_set(self, name, msg=None):
         """Fails if the specified environment variable is not set.
-
+
The default error message can be overridden with the `msg` argument.
         """
         try:
@@ -885,10 +885,10 @@
             self._fail(msg, "Environment variable '%s' is not set" % name)
         else:
self._info("Environment variable '%s' is set to '%s'" % (name, value))
-
+
     def environment_variable_should_not_be_set(self, name, msg=None):
         """Fails if the specified environment variable is set.
-
+
The default error message can be overridden with the `msg` argument.
         """
         try:
@@ -899,14 +899,14 @@
self._fail(msg, "Environment variable '%s' is set to '%s'" % (name, value))

     # Path
-
+
     def join_path(self, base, *parts):
         """Joins the given path part(s) to the given base path.
-
+
         The path separator ('/' or '\\') is inserted when needed and
         the possible absolute paths handled as expected. The resulted
-        path is also normalized.
-
+        path is also normalized.
+
         Examples:
         | ${path} = | Join Path | my        | path  |
         | ${p2} =   | Join Path | my/       | path/ |
@@ -918,17 +918,17 @@
         - ${p2} = 'my/path'
         - ${p3} = 'my/path/my/file.txt'
         - ${p4} = '/path'
-        - ${p5} = '/my/path2'
+        - ${p5} = '/my/path2'
         """
         base = base.replace('/', os.sep)
         parts = [ p.replace('/', os.sep) for p in parts ]
         return self.normalize_path(os.path.join(base, *parts))
-
+
     def join_paths(self, base, *paths):
         """Joins given paths with base and returns resulted paths.

         See `Join Path` for more information.
-
+
         Examples:
| @{p1} = | Join Path | base | example | other | | | @{p2} = | Join Path | /my/base | /example | other | |
@@ -939,10 +939,10 @@
- @{p3} = ['my/base/example/path', 'my/base/other', 'my/base/one/more']
         """
         return [ self.join_path(base, path) for path in paths ]
-
+
     def normalize_path(self, path):
         """Normalizes the given path.
-
+
         Examples:
         | ${path} = | Normalize Path | abc        |
         | ${p2} =   | Normalize Path | abc/       |
@@ -954,23 +954,23 @@
         - ${p2} = 'abc'
         - ${p3} = 'def'
         - ${p4} = 'abc/def'
-        - ${p5} = 'abc/def'
+        - ${p5} = 'abc/def'
         """
         ret = os.path.normpath(path.replace('/', os.sep))
         if ret == '': return '.'
         return ret
-
+
     def split_path(self, path):
"""Splits the given path from the last path separator ('/' or '\\').
-
+
         The given path is first normalized (e.g. a possible trailing
         path separator is removed, special directories '..' and '.'
         removed). The parts that are split are returned as separate
         components.
-
+
         Examples:
         | ${path1} | ${dir} =  | Split Path | abc/def         |
-        | ${path2} | ${file} = | Split Path | abc/def/ghi.txt |
+        | ${path2} | ${file} = | Split Path | abc/def/ghi.txt |
         | ${path3} | ${d2}  =  | Split Path | abc/../def/ghi/ |
         =>
         - ${path1} = 'abc' & ${dir} = 'def'
@@ -978,10 +978,10 @@
         - ${path3} = 'def' & ${d2} = 'ghi'
         """
         return os.path.split(self.normalize_path(path))
-
+
     def split_extension(self, path):
         """Splits the extension from the given path.
-
+
         The given path is first normalized (e.g. possible trailing
         path separators removed, special directories '..' and '.'
         removed). The base path and extension are returned as separate
@@ -1026,14 +1026,14 @@
         return basepath, ext

     # Misc
-
+
     def get_modified_time(self, path, format='timestamp'):
         """Returns the last modification time of a file or directory.

         How time is returned is determined based on the given `format`
         string as follows. Note that all checks are case-insensitive.
         Returned time is also automatically logged.
-
+
         1) If `format` contains the word 'epoch', the time is returned
            in seconds after the UNIX epoch. The return value is always
            an integer.
@@ -1047,7 +1047,7 @@

         3) Otherwise, and by default, the time is returned as a
            timestamp string in the format '2006-02-24 15:08:31'.
-
+
         Examples (when the modified time of the ${CURDIR} is
         2006-03-29 15:06:21):
         | ${time} = | Get Modified Time | ${CURDIR} |
@@ -1072,18 +1072,18 @@

     def set_modified_time(self, path, mtime):
         """Sets the file modification time.
-
+
         Changes the modification and access times of the given file to the
value determined by `mtime`, which can be given in four different ways.
-
+
         1) If `mtime` is a floating point number, it is interpreted as
            seconds since epoch (Jan 1, 1970 0:00:00). This
            documentation is written about 1177654467 seconds since
            epoch.
-
+
         2) If `mtime` is a valid timestamp, that time will be used. Valid
timestamp formats are 'YYYY-MM-DD hh:mm:ss' and 'YYYYMMDD hhmmss'.
-
+
         3) If `mtime` is equal to 'NOW' (case-insensitive), the
            current time is used.

@@ -1091,7 +1091,7 @@
            30 min', the current time plus/minus the time specified
            with the time string is used. The time string format is
            described in an appendix of Robot Framework User Guide.
-
+
         Examples:
| Set Modified Time | /path/file | 1177654467 | #(2007-04-27 9:14:27) |
         | Set Modified Time | /path/file | 2007-04-27 9:14:27 |
@@ -1113,7 +1113,7 @@
         time.sleep(0.1)  # Give os some time to really set these times
         tstamp = secs_to_timestamp(mtime, ('-',' ',':'))
         self._link("Set modified time of '%%s' to %s" % tstamp, path)
-
+

     def get_file_size(self, path):
         """Returns and logs file size as an integer in bytes"""
@@ -1124,15 +1124,15 @@
self._link("Size of file '%%s' is %d byte%s" % (size, plural), path)
         return size

-    def list_directory(self, path, pattern=None, pattern_type='DEPRECATED',
+    def list_directory(self, path, pattern=None, pattern_type='DEPRECATED',
                        absolute=False):
"""Returns items from a directory, optionally filtered with `pattern`.
-
- File and directory names are returned in case-sensitive alphabetical
+
+ File and directory names are returned in case-sensitive alphabetical
         order, e.g. ['A Name', 'Second', 'a lower case name', 'one more'].
Implicit directories '.' and '..' are not returned. The returned items
         are automatically logged.
-
+
By default, the file and directory names are returned relative to the
         given path (e.g. 'file.txt'). If you want them be returned in the
         absolute format (e.g. '/home/robot/file.txt'), set the `absolute`
@@ -1141,12 +1141,12 @@
If `pattern` is given, only items matching it are returned. By default `pattern` is considered to be a simple glob pattern where '*' and '?'
         can be used as wildcards (e.g. '*.txt' or 'file.???'). Using other
-        pattern types has been deprecated in Robot Framework 2.1.
+        pattern types has been deprecated in Robot Framework 2.1.

         Examples (using also other `List Directory` variants):
         | @{items} = | List Directory           | ${TEMPDIR} |
| @{files} = | List Files In Directory | /tmmp | *.txt | | absolute |
-        | ${count} = | Count Files In Directory | ${CURDIR} | ??? |
+        | ${count} = | Count Files In Directory | ${CURDIR} | ??? |
         """
         items = self._list_dir(path, pattern, pattern_type, absolute)
         self._info('\n'.join(items))
@@ -1158,7 +1158,7 @@
files = self._list_files_in_dir(path, pattern, pattern_type, absolute)
         self._info('\n'.join(files))
         return files
-
+
     def list_directories_in_directory(self, path, pattern=None,
pattern_type='DEPRECATED', absolute=False):
         """A wrapper for `List Directory` that returns only directories."""
@@ -1168,7 +1168,7 @@

def count_items_in_directory(self, path, pattern=None, pattern_type='DEPRECATED'):
         """Returns the number of all items in the given directory.
-
+
         The arguments `pattern` and `pattern_type` have the same
         semantics as in the `List Directory` keyword. The count is
         returned as an integer, so it must be checked e.g. with the
@@ -1176,10 +1176,10 @@
         """
         items = self._list_dir(path, pattern, pattern_type)
         return len(items)
-
+
def count_files_in_directory(self, path, pattern=None, pattern_type='DEPRECATED'):
         """Returns the number of files in the given directory.
-
+
         The arguments `pattern` and `pattern_type` have the same
         semantics as in the `List Directory` keyword. The count is
         returned as an integer, so it must be checked e.g. with the
@@ -1187,10 +1187,10 @@
         """
         files = self._list_files_in_dir(path, pattern, pattern_type)
         return len(files)
-
+
def count_directories_in_directory(self, path, pattern=None, pattern_type='DEPRECATED'):
         """Returns the number of subdirectories in the given directory.
-
+
         The arguments `pattern` and `pattern_type` have the same
         semantics as in the `List Directory` keyword. The count is
         returned as an integer, so it must be checked e.g. with the
@@ -1199,7 +1199,7 @@
         dirs = self._list_dirs_in_dir(path, pattern, pattern_type)
         return len(dirs)

-    def _list_dir(self, path, pattern=None, pattern_type='DEPRECATED',
+    def _list_dir(self, path, pattern=None, pattern_type='DEPRECATED',
                   absolute=False):
         path = self._absnorm(path)
         self._link("Listing contents of directory '%s'", path)
@@ -1221,22 +1221,22 @@

def _list_files_in_dir(self, path, pattern=None, pattern_type='DEPRECATED',
                            absolute=False):
-        return [ item for item in
+        return [ item for item in
                  self._list_dir(path, pattern, pattern_type, absolute)
                  if os.path.isfile(os.path.join(path,item)) ]

def _list_dirs_in_dir(self, path, pattern=None, pattern_type='DEPRECATED',
                           absolute=False):
-        return [ item for item in
+        return [ item for item in
                  self._list_dir(path, pattern, pattern_type, absolute)
                  if os.path.isdir(os.path.join(path,item)) ]

     def touch(self, path):
         """Emulates the UNIX touch command.
-
- Creates a file, if it does not exist. Otherwise changes its access and
+
+ Creates a file, if it does not exist. Otherwise changes its access and
         modification times to the current time.
-
+
Fails if used with the directories or the parent directory of the given
         file does not exist.
         """
@@ -1253,7 +1253,7 @@
         else:
             open(path, 'w').close()
             self._link("Touched new file '%s'", path)
-
+
     def _absnorm(self, path):
         return os.path.normpath(os.path.abspath(path.replace('/', os.sep)))

@@ -1268,26 +1268,26 @@
     def _link(self, msg, *paths):
paths = tuple([ '<a href="file://%s">%s</a>' % (p, p) for p in paths ])
         self._log(msg % paths, 'HTML')
-
+
     def _warn(self, msg):
         self._log(msg, 'WARN')
-
+
     def _log(self, msg, level):
         print '*%s* %s' % (level, msg)
-
+

 # TODO: Could we use _Process also with Run keyword? We would get rid of
 # duplicate code and have all process related code in separate class.

 class _Process:
-
+
     def __init__(self, command, input_):
         stdin, self.stdout = os.popen2(command)
         if input_:
             stdin.write(input_)
         stdin.close()
         self.closed = False
-
+
     def read(self):
         if self.closed:
             raise DataError('Cannot read from a closed process')
@@ -1296,10 +1296,10 @@
             out = out[:-1]
         self.close()
         return out
-
+
     def close(self):
         if not self.closed:
-            self.stdout.close()
+            self.stdout.close()
             self.closed = True


Reply via email to