Skip to content

Commit

Permalink
Change storage_all return value to a dictionary
Browse files Browse the repository at this point in the history
Have storage property storage_all return a dictionary instead of a tuple.

Fix flake8 errors.
  • Loading branch information
pnbruckner committed Apr 10, 2019
1 parent 5fd27c7 commit 27e9bb3
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/amcrest/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import re

from .exceptions import AmcrestError
from .utils import to_unit, percent, pretty
from .utils import to_unit, percent

_USED = '.UsedBytes'
_TOTAL = '.TotalBytes'
Expand All @@ -25,6 +25,7 @@ def _express_as(value, unit):
except (TypeError, ValueError):
return 'unknown', unit


class Storage(object):

@property
Expand Down Expand Up @@ -82,4 +83,7 @@ def storage_all(self):
used_percent = percent(used, total)
except (TypeError, ValueError, ZeroDivisionError):
used_percent = 'unknown'
return used_percent, _express_as(used, 'GB'), _express_as(total, 'GB')
return {
'used_percent': used_percent,
'used': _express_as(used, 'GB'),
'total': _express_as(total, 'GB')}

0 comments on commit 27e9bb3

Please sign in to comment.