Browse code

Style checker corrections

Lorenz Hüdepohl authored on 05/12/2017 21:46:55
Showing 1 changed files
... ...
@@ -2,9 +2,7 @@
2 2
 import os
3 3
 import sys
4 4
 import locale
5
-import socket
6 5
 import argparse
7
-from shutil import which
8 6
 from subprocess import Popen, PIPE, run
9 7
 from collections import namedtuple
10 8
 
... ...
@@ -62,6 +60,7 @@ if not args.cache_dir and args.min_cache_size is not None:
62 60
 elif args.cache_dir and args.min_cache_size is None:
63 61
     args.min_cache_size = "50M"
64 62
 
63
+
65 64
 def check_returncode(proc, verbose=True):
66 65
     if not proc.returncode == 0:
67 66
         if verbose:
... ...
@@ -104,6 +103,7 @@ def prefix_ssh(location):
104 103
         ssh = []
105 104
     return ssh, host, location
106 105
 
106
+
107 107
 ssh_dest, dest_host, destination = prefix_ssh(args.destination)
108 108
 ssh_orig, orig_host, origin = prefix_ssh(args.origin)
109 109
 
... ...
@@ -155,6 +155,7 @@ def rsync(orig_url, dest_url):
155 155
         rsync.wait()
156 156
         check_returncode(rsync)
157 157
 
158
+
158 159
 def command_on_url(*commands, abort=True, dry_run=False, echo=False):
159 160
     *commands, url = commands
160 161
     if ":" in url:
... ...
@@ -179,17 +180,22 @@ def command_on_url(*commands, abort=True, dry_run=False, echo=False):
179 180
 
180 181
     return True
181 182
 
183
+
182 184
 def exists(url):
183 185
     return command_on_url("test", "-f", url, abort=False, dry_run=False, echo=False)
184 186
 
187
+
185 188
 def touch(url):
186 189
     return command_on_url("touch", url, dry_run=args.dry_run, echo=args.dry_run or args.verbose)
187 190
 
191
+
188 192
 def rm(url):
189 193
     return command_on_url("rm", "-v", url, dry_run=args.dry_run, echo=args.dry_run or args.verbose)
190 194
 
195
+
191 196
 MockStdout = namedtuple("MockStdout", ["cmd_string"])
192 197
 
198
+
193 199
 class echoPopen(Popen):
194 200
     def __init__(self, commands, stdin=None, stdout=None, **kwargs):
195 201
         if stdin is not None:
... ...
@@ -222,6 +228,7 @@ class echoPopen(Popen):
222 228
         if not args.dry_run:
223 229
             return super().__exit__(type, value, traceback)
224 230
 
231
+
225 232
 for fs, snapname in origin_snapshots:
226 233
     if fs in destinations and snapname in destinations[fs]:
227 234
         continue
... ...
@@ -269,7 +276,7 @@ for fs, snapname in origin_snapshots:
269 276
             if estimated_size * 1.25 > free_space:
270 277
                 print("Cannot store intermediate stream at {0}, would consume "
271 278
                       "about {1} MB free space in {2}, but there is just {3} MB available".format(
272
-                    where, estimated_size // 1000000, cache_dir, free_space // 1000000), file=sys.stderr)
279
+                          where, estimated_size // 1000000, cache_dir, free_space // 1000000), file=sys.stderr)
273 280
                 raise SystemExit(1)
274 281
 
275 282
         if not args.dry_run: