Merge "Replace a / b with a // b to use integer division where needed"
This commit is contained in:
commit
bddfc521d8
@ -370,10 +370,10 @@ class AccountReaper(Daemon):
|
|||||||
if self.logger.getEffectiveLevel() <= DEBUG:
|
if self.logger.getEffectiveLevel() <= DEBUG:
|
||||||
self.logger.exception(
|
self.logger.exception(
|
||||||
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
||||||
self.stats_return_codes[err.http_status / 100] = \
|
self.stats_return_codes[err.http_status // 100] = \
|
||||||
self.stats_return_codes.get(err.http_status / 100, 0) + 1
|
self.stats_return_codes.get(err.http_status // 100, 0) + 1
|
||||||
self.logger.increment(
|
self.logger.increment(
|
||||||
'return_codes.%d' % (err.http_status / 100,))
|
'return_codes.%d' % (err.http_status // 100,))
|
||||||
except (Timeout, socket.error) as err:
|
except (Timeout, socket.error) as err:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
|
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
|
||||||
@ -426,10 +426,10 @@ class AccountReaper(Daemon):
|
|||||||
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
||||||
failures += 1
|
failures += 1
|
||||||
self.logger.increment('containers_failures')
|
self.logger.increment('containers_failures')
|
||||||
self.stats_return_codes[err.http_status / 100] = \
|
self.stats_return_codes[err.http_status // 100] = \
|
||||||
self.stats_return_codes.get(err.http_status / 100, 0) + 1
|
self.stats_return_codes.get(err.http_status // 100, 0) + 1
|
||||||
self.logger.increment(
|
self.logger.increment(
|
||||||
'return_codes.%d' % (err.http_status / 100,))
|
'return_codes.%d' % (err.http_status // 100,))
|
||||||
except (Timeout, socket.error) as err:
|
except (Timeout, socket.error) as err:
|
||||||
self.logger.error(
|
self.logger.error(
|
||||||
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
|
_('Timeout Exception with %(ip)s:%(port)s/%(device)s'),
|
||||||
@ -502,10 +502,10 @@ class AccountReaper(Daemon):
|
|||||||
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
_('Exception with %(ip)s:%(port)s/%(device)s'), node)
|
||||||
failures += 1
|
failures += 1
|
||||||
self.logger.increment('objects_failures')
|
self.logger.increment('objects_failures')
|
||||||
self.stats_return_codes[err.http_status / 100] = \
|
self.stats_return_codes[err.http_status // 100] = \
|
||||||
self.stats_return_codes.get(err.http_status / 100, 0) + 1
|
self.stats_return_codes.get(err.http_status // 100, 0) + 1
|
||||||
self.logger.increment(
|
self.logger.increment(
|
||||||
'return_codes.%d' % (err.http_status / 100,))
|
'return_codes.%d' % (err.http_status // 100,))
|
||||||
except (Timeout, socket.error) as err:
|
except (Timeout, socket.error) as err:
|
||||||
failures += 1
|
failures += 1
|
||||||
self.logger.increment('objects_failures')
|
self.logger.increment('objects_failures')
|
||||||
|
@ -51,7 +51,7 @@ def size_suffix(size):
|
|||||||
for suffix in suffixes:
|
for suffix in suffixes:
|
||||||
if size < 1000:
|
if size < 1000:
|
||||||
return "%s %s" % (size, suffix)
|
return "%s %s" % (size, suffix)
|
||||||
size = size / 1000
|
size = size // 1000
|
||||||
return "%s %s" % (size, suffix)
|
return "%s %s" % (size, suffix)
|
||||||
|
|
||||||
|
|
||||||
|
@ -1415,7 +1415,7 @@ class SwiftLogFormatter(logging.Formatter):
|
|||||||
if self.max_line_length < 7:
|
if self.max_line_length < 7:
|
||||||
msg = msg[:self.max_line_length]
|
msg = msg[:self.max_line_length]
|
||||||
else:
|
else:
|
||||||
approxhalf = (self.max_line_length - 5) / 2
|
approxhalf = (self.max_line_length - 5) // 2
|
||||||
msg = msg[:approxhalf] + " ... " + msg[-approxhalf:]
|
msg = msg[:approxhalf] + " ... " + msg[-approxhalf:]
|
||||||
return msg
|
return msg
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user