diff options
author | Tim Burke <tim.burke@gmail.com> | 2016-07-07 18:00:05 +0000 |
---|---|---|
committer | Tim Burke <tim.burke@gmail.com> | 2016-07-08 16:19:52 +0000 |
commit | 9890184ea9378fbba1cb76e861f5a20bdd36b7c9 (patch) | |
tree | f478f20ec3e9110fc8f099f3d7247f53ba4c2f4c /bin/swift-orphans | |
parent | ae2b7a0ce8fe23f3ce40b3fc0a08cbef6a70c994 (diff) | |
download | swift-9890184ea9378fbba1cb76e861f5a20bdd36b7c9.tar.gz |
Turn on H233 and start using print function
As much as anything, I'm just tired of seeing a bunch or piecemeal
fixes.
Note that we *need* to include
from __future__ import print_function
in order to support things like
print() # Would print "()" (the repr of an empty tuple) otherwise
print(foo, end='') # Would SyntaxError
print(bar, file=sys.stderr) # Would SyntaxError
Change-Id: I8fdf0740e292eb1ee785512d02e8c552781dcae1
Diffstat (limited to 'bin/swift-orphans')
-rwxr-xr-x | bin/swift-orphans | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/swift-orphans b/bin/swift-orphans index 90311c981..d2a3889ad 100755 --- a/bin/swift-orphans +++ b/bin/swift-orphans @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from __future__ import print_function import optparse import os import signal @@ -104,11 +105,11 @@ Example (sends SIGTERM to all orphaned Swift processes older than two hours): args_len = max(args_len, len(args)) args_len = min(args_len, 78 - hours_len - pid_len) - print ('%%%ds %%%ds %%s' % (hours_len, pid_len)) % \ - ('Hours', 'PID', 'Command') + print(('%%%ds %%%ds %%s' % (hours_len, pid_len)) % + ('Hours', 'PID', 'Command')) for hours, pid, args in listing: - print ('%%%ds %%%ds %%s' % (hours_len, pid_len)) % \ - (hours, pid, args[:args_len]) + print(('%%%ds %%%ds %%s' % (hours_len, pid_len)) % + (hours, pid, args[:args_len])) if options.signal: try: @@ -120,7 +121,8 @@ Example (sends SIGTERM to all orphaned Swift processes older than two hours): if not signum: sys.exit('Could not translate %r to a signal number.' % options.signal) - print 'Sending processes %s (%d) signal...' % (options.signal, signum), + print('Sending processes %s (%d) signal...' % (options.signal, signum), + end='') for hours, pid, args in listing: os.kill(int(pid), signum) - print 'Done.' + print('Done.') |