# Path: oslo_utils/strutils.py
# UNIT_PREFIX_EXPONENT = {
#     'k': 1,
#     'K': 1,
#     'Ki': 1,
#     'M': 2,
#     'Mi': 2,
#     'G': 3,
#     'Gi': 3,
#     'T': 4,
#     'Ti': 4,
# }
# UNIT_SYSTEM_INFO = {
#     'IEC': (1024, re.compile(r'(^[-+]?\d*\.?\d+)([KMGT]i?)?(b|bit|B)$')),
#     'SI': (1000, re.compile(r'(^[-+]?\d*\.?\d+)([kMGT])?(b|bit|B)$')),
#     'mixed': (None, re.compile(r'(^[-+]?\d*\.?\d+)([kKMGT]i?)?(b|bit|B)$')),
# }
# TRUE_STRINGS = ('1', 't', 'true', 'on', 'y', 'yes')
# FALSE_STRINGS = ('0', 'f', 'false', 'off', 'n', 'no')
# SLUGIFY_STRIP_RE = re.compile(r"[^\w\s-]")
# SLUGIFY_HYPHENATE_RE = re.compile(r"[-\s]+")
# _SANITIZE_KEYS = ['adminpass', 'admin_pass', 'password', 'admin_password',
#                   'auth_token', 'new_pass', 'auth_password', 'secret_uuid',
#                   'secret', 'sys_pswd', 'token', 'configdrive',
#                   'chappassword', 'encrypted_key', 'private_key',
#                   'fernetkey', 'sslkey', 'passphrase',
#                   'cephclusterfsid', 'octaviaheartbeatkey', 'rabbitcookie',
#                   'cephmanilaclientkey', 'pacemakerremoteauthkey',
#                   'designaterndckey', 'cephadminkey', 'heatauthencryptionkey',
#                   'cephclientkey', 'keystonecredential',
#                   'barbicansimplecryptokek', 'cephrgwkey', 'swifthashsuffix',
#                   'migrationsshkey', 'cephmdskey', 'cephmonkey']
# _SANITIZE_PATTERNS_2 = {}
# _SANITIZE_PATTERNS_1 = {}
# _SANITIZE_PATTERNS_WILDCARD = {}
# _FORMAT_PATTERNS_1 = [r'(%(key)s[0-9]*\s*[=]\s*)[^\s^\'^\"]+']
# _FORMAT_PATTERNS_2 = [r'(%(key)s[0-9]*\s*[=]\s*[\"\'])[^\"\']*([\"\'])',
#                       r'(%(key)s[0-9]*\s+[\"\'])[^\"\']*([\"\'])',
#                       r'([-]{2}%(key)s[0-9]*\s+)[^\'^\"^=^\s]+([\s]*)',
#                       r'(<%(key)s[0-9]*>)[^<]*(</%(key)s[0-9]*>)',
#                       r'([\"\']%(key)s[0-9]*[\"\']\s*:\s*[\"\'])[^\"\']*'
#                       r'([\"\'])',
#                       r'([\'"][^"\']*%(key)s[0-9]*[\'"]\s*:\s*u?[\'"])[^\"\']*'
#                       r'([\'"])',
#                       r'([\'"][^\'"]*%(key)s[0-9]*[\'"]\s*,\s*\'--?[A-z]+'
#                       r'\'\s*,\s*u?[\'"])[^\"\']*([\'"])',
#                       r'(%(key)s[0-9]*\s*--?[A-z]+\s*)\S+(\s*)']
# _FORMAT_PATTERNS_WILDCARD = [r'([\'\"][^\"\']*%(key)s[0-9]*[\'\"]\s*:\s*u?[\'\"].*[\'\"])[^\"\']*([\'\"])']  # noqa: E501
# def int_from_bool_as_string(subject):
# def bool_from_string(subject, strict=False, default=False):
# def is_valid_boolstr(value):
# def string_to_bytes(text, unit_system='IEC', return_int=False):
# def to_slug(value, incoming=None, errors="strict"):
# def mask_password(message, secret="***"):  # nosec
# def mask_dict_password(dictionary, secret="***"):  # nosec
# def is_int_like(val):
# def check_string_length(value, name=None, min_length=0, max_length=None):
# def validate_integer(value, name, min_value=None, max_value=None):
# def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False):
# def split_by_commas(value):
# 
# Path: oslo_utils/units.py
# M = 1000 ** 2
# G = 1000 ** 3
# T = 1000 ** 4
# P = 1000 ** 5
# E = 1000 ** 6
# Z = 1000 ** 7
# Y = 1000 ** 8


import collections.abc
import copy
import math
import ddt
import testscenarios
from unittest import mock
from oslotest import base as test_base
from oslo_utils import strutils
from oslo_utils import units
        ('return_dec', dict(return_int=False)),
        ('return_int', dict(return_int=True)),
    ]

    @classmethod
    def generate_scenarios(cls):
        cls.scenarios = testscenarios.multiply_scenarios(cls._unit_system,
                                                         cls._sign,
                                                         cls._magnitude,
                                                         cls._unit_prefix,
                                                         cls._unit_suffix,
                                                         cls._return_int)

    def test_string_to_bytes(self):

        def _get_quantity(sign, magnitude, unit_suffix):
            res = float('%s%s' % (sign, magnitude))
            if unit_suffix in ['b', 'bit']:
                res /= 8
            return res

        def _get_constant(unit_prefix, unit_system):
            if not unit_prefix:
                return 1
            elif unit_system == 'SI':
                res = getattr(units, unit_prefix)
            elif unit_system == 'IEC':
                if unit_prefix.endswith('i'):
                    res = getattr(units, unit_prefix)
                else:

# Path: oslo_utils/strutils.py
# UNIT_PREFIX_EXPONENT = {
#     'k': 1,
#     'K': 1,
#     'Ki': 1,
#     'M': 2,
#     'Mi': 2,
#     'G': 3,
#     'Gi': 3,
#     'T': 4,
#     'Ti': 4,
# }
# UNIT_SYSTEM_INFO = {
#     'IEC': (1024, re.compile(r'(^[-+]?\d*\.?\d+)([KMGT]i?)?(b|bit|B)$')),
#     'SI': (1000, re.compile(r'(^[-+]?\d*\.?\d+)([kMGT])?(b|bit|B)$')),
#     'mixed': (None, re.compile(r'(^[-+]?\d*\.?\d+)([kKMGT]i?)?(b|bit|B)$')),
# }
# TRUE_STRINGS = ('1', 't', 'true', 'on', 'y', 'yes')
# FALSE_STRINGS = ('0', 'f', 'false', 'off', 'n', 'no')
# SLUGIFY_STRIP_RE = re.compile(r"[^\w\s-]")
# SLUGIFY_HYPHENATE_RE = re.compile(r"[-\s]+")
# _SANITIZE_KEYS = ['adminpass', 'admin_pass', 'password', 'admin_password',
#                   'auth_token', 'new_pass', 'auth_password', 'secret_uuid',
#                   'secret', 'sys_pswd', 'token', 'configdrive',
#                   'chappassword', 'encrypted_key', 'private_key',
#                   'fernetkey', 'sslkey', 'passphrase',
#                   'cephclusterfsid', 'octaviaheartbeatkey', 'rabbitcookie',
#                   'cephmanilaclientkey', 'pacemakerremoteauthkey',
#                   'designaterndckey', 'cephadminkey', 'heatauthencryptionkey',
#                   'cephclientkey', 'keystonecredential',
#                   'barbicansimplecryptokek', 'cephrgwkey', 'swifthashsuffix',
#                   'migrationsshkey', 'cephmdskey', 'cephmonkey']
# _SANITIZE_PATTERNS_2 = {}
# _SANITIZE_PATTERNS_1 = {}
# _SANITIZE_PATTERNS_WILDCARD = {}
# _FORMAT_PATTERNS_1 = [r'(%(key)s[0-9]*\s*[=]\s*)[^\s^\'^\"]+']
# _FORMAT_PATTERNS_2 = [r'(%(key)s[0-9]*\s*[=]\s*[\"\'])[^\"\']*([\"\'])',
#                       r'(%(key)s[0-9]*\s+[\"\'])[^\"\']*([\"\'])',
#                       r'([-]{2}%(key)s[0-9]*\s+)[^\'^\"^=^\s]+([\s]*)',
#                       r'(<%(key)s[0-9]*>)[^<]*(</%(key)s[0-9]*>)',
#                       r'([\"\']%(key)s[0-9]*[\"\']\s*:\s*[\"\'])[^\"\']*'
#                       r'([\"\'])',
#                       r'([\'"][^"\']*%(key)s[0-9]*[\'"]\s*:\s*u?[\'"])[^\"\']*'
#                       r'([\'"])',
#                       r'([\'"][^\'"]*%(key)s[0-9]*[\'"]\s*,\s*\'--?[A-z]+'
#                       r'\'\s*,\s*u?[\'"])[^\"\']*([\'"])',
#                       r'(%(key)s[0-9]*\s*--?[A-z]+\s*)\S+(\s*)']
# _FORMAT_PATTERNS_WILDCARD = [r'([\'\"][^\"\']*%(key)s[0-9]*[\'\"]\s*:\s*u?[\'\"].*[\'\"])[^\"\']*([\'\"])']  # noqa: E501
# def int_from_bool_as_string(subject):
# def bool_from_string(subject, strict=False, default=False):
# def is_valid_boolstr(value):
# def string_to_bytes(text, unit_system='IEC', return_int=False):
# def to_slug(value, incoming=None, errors="strict"):
# def mask_password(message, secret="***"):  # nosec
# def mask_dict_password(dictionary, secret="***"):  # nosec
# def is_int_like(val):
# def check_string_length(value, name=None, min_length=0, max_length=None):
# def validate_integer(value, name, min_value=None, max_value=None):
# def split_path(path, minsegs=1, maxsegs=None, rest_with_last=False):
# def split_by_commas(value):
# 
# Path: oslo_utils/units.py
# M = 1000 ** 2
# G = 1000 ** 3
# T = 1000 ** 4
# P = 1000 ** 5
# E = 1000 ** 6
# Z = 1000 ** 7
# Y = 1000 ** 8


# Path: oslo_utils/tests/test_strutils.py
import collections.abc
import copy
import math
import ddt
import testscenarios
from unittest import mock
from oslotest import base as test_base
from oslo_utils import strutils
from oslo_utils import units

        ('return_dec', dict(return_int=False)),
        ('return_int', dict(return_int=True)),
    ]

    @classmethod
    def generate_scenarios(cls):
        cls.scenarios = testscenarios.multiply_scenarios(cls._unit_system,
                                                         cls._sign,
                                                         cls._magnitude,
                                                         cls._unit_prefix,
                                                         cls._unit_suffix,
                                                         cls._return_int)

    def test_string_to_bytes(self):

        def _get_quantity(sign, magnitude, unit_suffix):
            res = float('%s%s' % (sign, magnitude))
            if unit_suffix in ['b', 'bit']:
                res /= 8
            return res

        def _get_constant(unit_prefix, unit_system):
            if not unit_prefix:
                return 1
            elif unit_system == 'SI':
                res = getattr(units, unit_prefix)
            elif unit_system == 'IEC':
                if unit_prefix.endswith('i'):
                    res = getattr(units, unit_prefix)
                else:

                    res = getattr(units, '%si' % unit_prefix)