PEP8 fixes

Change-Id: Ib1ebe393e967e7a9cef929e75892f96474f5c2fb
Partial-Bug: #1575759
diff --git a/trsync/cmd/cli.py b/trsync/cmd/cli.py
index e120409..eb7fa8f 100644
--- a/trsync/cmd/cli.py
+++ b/trsync/cmd/cli.py
@@ -1,17 +1,33 @@
 #!/usr/bin/env python
 # -*- coding: utf-8 -*-
 
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import logging
 import os
 import sys
-import logging
 
 from cliff import app
-from cliff import commandmanager
 from cliff import command
+from cliff import commandmanager
 
 import trsync
+
 from trsync.objects import rsync_mirror
 
+
 class PushCmd(command.Command):
     log = logging.getLogger(__name__)
 
@@ -28,8 +44,8 @@
                             help='Destination rsync url')
         parser.add_argument('-t', '--timestamp',
                             required=False,
-                            help='Specified timestamp will be used for snapshot.'
-                            'Format:yyyy-mm-dd-hhMMSS')
+                            help='Specified timestamp will be used for '
+                            'snapshot. Format:yyyy-mm-dd-hhMMSS')
         parser.add_argument('--snapshot-dir',
                             required=False,
                             default='snapshots',
@@ -40,33 +56,35 @@
                             required=False,
                             default=False,
                             help='It specified, all directories including'
-                            '"snapshots-dir" will be created on remote location')
+                            '"snapshots-dir" will be created on remote '
+                            'location')
         parser.add_argument('--save-latest-days',
                             required=False,
                             default=61,
-                            help='Snapshots for specified number of days will be '
-                            'saved. All older will be removed. 61 by default. '
-                            '0 mean that old snapshots will not be deleted, '
-                            '"None" mean that all snapshots excluding latest '
-                            'will be deleted')
+                            help='Snapshots for specified number of days will '
+                            'be saved. All older will be removed. 61 by '
+                            'default. 0 mean that old snapshots will not be '
+                            'deleted, "None" mean that all snapshots '
+                            'excluding latest will be deleted')
         parser.add_argument('--latest-successful-postfix',
                             required=False,
                             default='latest',
                             help='Postfix for symlink to latest successfully '
-                            'synced snapshot. Also used as --link-dest target. '
-                            '"latest" by default.')
+                            'synced snapshot. Also used as --link-dest '
+                            'target. "latest" by default.')
         parser.add_argument('-s', '--symlinks',
                             nargs='+',
                             required=False,
                             default=[],
-                            help='Update additional symlinks relative destination')
+                            help='Update additional symlinks relative '
+                            'destination')
         parser.add_argument('--extra',
                             required=False,
                             default='',
-                            #action='store_const',
-                            help='String with additional rsync parameters. For '
-                            'example it may be "\--dry-run --any-rsync-option".'
-                            'Use "\\" to disable argparse to parse extra value.')
+                            help='String with additional rsync parameters. '
+                            'For example it may be "\--dry-run '
+                            '--any-rsync-option".Use "\\" to disable '
+                            'argparse to parse extra value.')
 
         return parser
 
@@ -81,7 +99,7 @@
         properties['rsync_extra_params'] = properties.pop('extra')
         properties['save_latest_days'] = \
             None if properties['save_latest_days'] == 'None' \
-                else int(properties['save_latest_days'])
+            else int(properties['save_latest_days'])
 
         failed = list()
         for server in servers:
@@ -92,13 +110,14 @@
             try:
                 remote.push(source_dir, mirror_name, symlinks=symlinks)
             except Exception as e:
-                print e.message
+                print(e.message)
                 failed.append(server)
 
         if failed:
-            print "Failed to push to {}".format(str(failed))
+            print("Failed to push to {}".format(str(failed)))
             sys.exit(1)
-            #self.app.stdout.write(parsed_args.arg + "\n")
+            # self.app.stdout.write(parsed_args.arg + "\n")
+
 
 class RemoveCmd(command.Command):
     log = logging.getLogger(__name__)
@@ -119,9 +138,10 @@
         parser.add_argument('--extra',
                             required=False,
                             default='',
-                            help='String with additional rsync parameters. For '
-                            'example it may be "\--dry-run --any-rsync-option".'
-                            'Use "\\" to disable argparse to parse extra value.')
+                            help='String with additional rsync parameters. '
+                            'For example it may be "\--dry-run '
+                            '--any-rsync-option". Use "\\" to disable '
+                            'argparse to parse extra value.')
         return parser
 
     def take_action(self, parsed_args):
@@ -131,22 +151,23 @@
         if properties['extra'].startswith('\\'):
             properties['extra'] = properties['extra'][1:]
         properties['init_directory_structure'] = False
-        properties['rsync_extra_params'] = properties.pop('extra')# + ' --dry-run'
+        properties['rsync_extra_params'] = properties.pop('extra')
 
         failed = list()
         for server in servers:
             remote = rsync_mirror.TRsync(server, **properties)
             try:
-                print "Removing items {}".format(str(path))
+                print("Removing items {}".format(str(path)))
                 remote.rm_all(path)
             except Exception as e:
-                print e.message
+                print(e.message)
                 failed.append(server)
 
         if failed:
-            print "Failed to remove {}".format(str(failed))
+            print("Failed to remove {}".format(str(failed)))
             sys.exit(1)
 
+
 class TRsyncApp(app.App):
     log = logging.getLogger(__name__)
 
@@ -158,6 +179,7 @@
             deferred_help=True,
             )
 
+
 def main(argv=sys.argv[1:]):
     app = TRsyncApp()
     return app.run(argv)
diff --git a/trsync/cmd/trsync_push.py b/trsync/cmd/trsync_push.py
index fd70bb0..0490ee5 100755
--- a/trsync/cmd/trsync_push.py
+++ b/trsync/cmd/trsync_push.py
@@ -1,10 +1,23 @@
 #!/usr/bin/env python
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import argparse
 import os
 import sys
-import argparse
-
 
 from trsync.objects.rsync_mirror import TRsync
 
@@ -67,7 +80,6 @@
     parser.add_argument('--extra',
                         required=False,
                         default='',
-                        #action='store_const',
                         help='String with additional rsync parameters. For '
                         'example it may be "\--dry-run --any-rsync-option".'
                         'Use "\\" to disable argparse to parse extra value.')
@@ -89,7 +101,7 @@
     properties['rsync_extra_params'] = properties.pop('extra')
     properties['save_latest_days'] = \
         None if options.save_latest_days == 'None' \
-            else int(options.save_latest_days)
+        else int(options.save_latest_days)
 
     failed = list()
     for server in servers:
@@ -100,11 +112,11 @@
         try:
             remote.push(source_dir, mirror_name, symlinks=symlinks)
         except Exception as e:
-            print e.message
+            print(e.message)
             failed.append(server)
 
     if failed:
-        print "Failed to push to {}".format(str(failed))
+        print("Failed to push to {}".format(str(failed)))
         sys.exit(1)
 
 
diff --git a/trsync/cmd/trsync_remove.py b/trsync/cmd/trsync_remove.py
index 2e43a26..95af858 100755
--- a/trsync/cmd/trsync_remove.py
+++ b/trsync/cmd/trsync_remove.py
@@ -1,10 +1,22 @@
 #!/usr/bin/env python
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
-import os
-import sys
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
 import argparse
-
+import sys
 
 from trsync.objects.rsync_mirror import TRsync
 
@@ -28,7 +40,6 @@
     parser.add_argument('--extra',
                         required=False,
                         default='',
-                        #action='store_const',
                         help='String with additional rsync parameters. For '
                         'example it may be "\--dry-run --any-rsync-option".'
                         'Use "\\" to disable argparse to parse extra value.')
@@ -46,20 +57,20 @@
     if properties['extra'].startswith('\\'):
         properties['extra'] = properties['extra'][1:]
     properties['init_directory_structure'] = False
-    properties['rsync_extra_params'] = properties.pop('extra')# + ' --dry-run'
+    properties['rsync_extra_params'] = properties.pop('extra')
 
     failed = list()
     for server in servers:
         remote = TRsync(server, **properties)
         try:
-            print "Removing items {}".format(str(path))
+            print("Removing items {}".format(str(path)))
             remote.rm_all(path)
         except Exception as e:
-            print e.message
+            print(e.message)
             failed.append(server)
 
     if failed:
-        print "Failed to push to {}".format(str(failed))
+        print("Failed to push to {}".format(str(failed)))
         sys.exit(1)
 
 
diff --git a/trsync/tests/test_utils.py b/trsync/tests/test_utils.py
index 70f2c71..8ee12d6 100644
--- a/trsync/tests/test_utils.py
+++ b/trsync/tests/test_utils.py
@@ -1,4 +1,18 @@
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
 
 import unittest
 
diff --git a/trsync/utils/shell.py b/trsync/utils/shell.py
index 7a48821..ca45805 100644
--- a/trsync/utils/shell.py
+++ b/trsync/utils/shell.py
@@ -1,4 +1,19 @@
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
+
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
 
 import subprocess
 import utils
diff --git a/trsync/utils/utils.py b/trsync/utils/utils.py
index cdd4bcb..dc04089 100644
--- a/trsync/utils/utils.py
+++ b/trsync/utils/utils.py
@@ -1,5 +1,18 @@
-#-*- coding: utf-8 -*-
+# -*- coding: utf-8 -*-
 
+# Copyright (c) 2015-2016, Mirantis, Inc.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+#      http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
 
 import datetime
 import logging
@@ -80,15 +93,16 @@
 
 
 class Retry(object):
-    """
-    Waits while the function reaches the specified status.
+    """Waits while the function reaches the specified status.
 
     :param function: function that returns some status
     :param expected_status: status the machine should turn to
     :param attempts: how many times to check status
     :param timeout: timeout in seconds before attempts
     :return: True if node moves to the specified status, False otherwise
+
     :Examples:
+
     Retry(timeout=3, attempts=10).wait(function, result, param1, param2)
     Retry().wait_result(function, result, param1, param2)
     """