diff options
author | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-06-14 09:22:54 +0800 |
---|---|---|
committer | Zhongyue Luo <zhongyue.nah@intel.com> | 2013-06-14 09:35:00 +0800 |
commit | fc217a996a251d1c9e4f495f6d0fbf80b80700bc (patch) | |
tree | 84fdfb4d0bbc4f99c05b65b7a22f3e0426f65db6 /nova/utils.py | |
parent | ab1977af316eef5375c7aaefdf364548b4fb5289 (diff) | |
download | nova-fc217a996a251d1c9e4f495f6d0fbf80b80700bc.tar.gz nova-fc217a996a251d1c9e4f495f6d0fbf80b80700bc.tar.xz nova-fc217a996a251d1c9e4f495f6d0fbf80b80700bc.zip |
Replace utils.to_bytes() with strutils.to_bytes()
The to_bytes() function have moved to oslo.
Replaced/removed the to_bytes() function with the one in strutils
Change-Id: I14c33c6fb86db3088c11e02ce6e38ec022fad042
Diffstat (limited to 'nova/utils.py')
-rw-r--r-- | nova/utils.py | 28 |
1 files changed, 0 insertions, 28 deletions
diff --git a/nova/utils.py b/nova/utils.py index 41d18b3cb..b29ae0139 100644 --- a/nova/utils.py +++ b/nova/utils.py @@ -410,34 +410,6 @@ def utf8(value): return value -def to_bytes(text, default=0): - """Try to turn a string into a number of bytes. Looks at the last - characters of the text to determine what conversion is needed to - turn the input text into a byte number. - - Supports: B/b, K/k, M/m, G/g, T/t (or the same with b/B on the end) - - """ - # Take off everything not number 'like' (which should leave - # only the byte 'identifier' left) - mult_key_org = text.lstrip('-1234567890') - mult_key = mult_key_org.lower() - mult_key_len = len(mult_key) - if mult_key.endswith("b"): - mult_key = mult_key[0:-1] - try: - multiplier = BYTE_MULTIPLIERS[mult_key] - if mult_key_len: - # Empty cases shouldn't cause text[0:-0] - text = text[0:-mult_key_len] - return int(text) * multiplier - except KeyError: - msg = _('Unknown byte multiplier: %s') % mult_key_org - raise TypeError(msg) - except ValueError: - return default - - def get_from_path(items, path): """Returns a list of items matching the specified path. |