# Path: src/stratis_cli/_errors.py
# class StratisCliGenerationError(StratisCliError):
#     """
#     Exception that occurs during generation of classes.
#     """
# 
# Path: src/stratis_cli/_actions/_constants.py
# BLOCKDEV_INTERFACE = "org.storage.stratis3.blockdev.%s" % REVISION
# 
# FILESYSTEM_INTERFACE = "org.storage.stratis3.filesystem.%s" % REVISION
# 
# MANAGER_INTERFACE = "org.storage.stratis3.Manager.%s" % REVISION
# 
# POOL_INTERFACE = "org.storage.stratis3.pool.%s" % REVISION
# 
# REPORT_INTERFACE = "org.storage.stratis3.Report.%s" % REVISION
# 
# Path: src/stratis_cli/_actions/_environment.py
# def get_timeout(value):
#     """
#     Turn an input str or int into a float timeout value.
# 
#     :param value: the input str or int
#     :type value: str or int
#     :raises StratisCliEnvironmentError:
#     :returns: float
#     """
# 
#     maximum_dbus_timeout_ms = 1073741823
# 
#     # Ensure the input str is not a float
#     if isinstance(value, float):
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is a float; it should be an integer."
#         )
# 
#     try:
#         timeout_int = int(value)
# 
#     except ValueError as err:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is not an integer."
#         ) from err
# 
#     # Ensure the integer is not too small
#     if timeout_int < -1:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is smaller than the smallest acceptable value, -1."
#         )
# 
#     # Ensure the integer is not too large
#     if timeout_int > maximum_dbus_timeout_ms:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided exceeds the largest acceptable value, %s."
#             % maximum_dbus_timeout_ms
#         )
# 
#     # Convert from milliseconds to seconds
#     return timeout_int / 1000


import os
import sys
import xml.etree.ElementTree as ET
from dbus_client_gen import (
    DbusClientGenerationError,
    managed_object_class,
    mo_query_builder,
)
from dbus_python_client_gen import DPClientGenerationError, make_class
from .._errors import StratisCliGenerationError
from ._constants import (
    BLOCKDEV_INTERFACE,
    FILESYSTEM_INTERFACE,
    MANAGER_INTERFACE,
    POOL_INTERFACE,
    REPORT_INTERFACE,
)
from ._environment import get_timeout
from ._introspect import SPECS

    Manager = make_class("Manager", ET.fromstring(SPECS[MANAGER_INTERFACE]), timeout)

    ObjectManager = make_class(
        "ObjectManager",
        ET.fromstring(SPECS["org.freedesktop.DBus.ObjectManager"]),
        timeout,
    )

    # Specification for the lowest manager interface supported by the major
    # version of stratisd on which this version of the CLI depends.
    # This minimal specification includes only the specification for the
    # Version property.
    manager_spec = """
    <interface name="org.storage.stratis3.Manager.r0">
        <property access="read" name="Version" type="s">
            <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const" />
        </property>
    </interface>
    """
    Manager0 = make_class("Manager0", ET.fromstring(manager_spec), timeout)

# Do not expect to get coverage on Generation errors.
# These can only occurs if the XML data in _SPECS is ill-formed; we have
# complete control over that data and can expect it to be valid.
except DPClientGenerationError as err:  # pragma: no cover
    raise StratisCliGenerationError(
        "Failed to generate some class needed for invoking dbus-python methods"
    ) from err
except DbusClientGenerationError as err:  # pragma: no cover

# Path: src/stratis_cli/_errors.py
# class StratisCliGenerationError(StratisCliError):
#     """
#     Exception that occurs during generation of classes.
#     """
# 
# Path: src/stratis_cli/_actions/_constants.py
# BLOCKDEV_INTERFACE = "org.storage.stratis3.blockdev.%s" % REVISION
# 
# FILESYSTEM_INTERFACE = "org.storage.stratis3.filesystem.%s" % REVISION
# 
# MANAGER_INTERFACE = "org.storage.stratis3.Manager.%s" % REVISION
# 
# POOL_INTERFACE = "org.storage.stratis3.pool.%s" % REVISION
# 
# REPORT_INTERFACE = "org.storage.stratis3.Report.%s" % REVISION
# 
# Path: src/stratis_cli/_actions/_environment.py
# def get_timeout(value):
#     """
#     Turn an input str or int into a float timeout value.
# 
#     :param value: the input str or int
#     :type value: str or int
#     :raises StratisCliEnvironmentError:
#     :returns: float
#     """
# 
#     maximum_dbus_timeout_ms = 1073741823
# 
#     # Ensure the input str is not a float
#     if isinstance(value, float):
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is a float; it should be an integer."
#         )
# 
#     try:
#         timeout_int = int(value)
# 
#     except ValueError as err:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is not an integer."
#         ) from err
# 
#     # Ensure the integer is not too small
#     if timeout_int < -1:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided is smaller than the smallest acceptable value, -1."
#         )
# 
#     # Ensure the integer is not too large
#     if timeout_int > maximum_dbus_timeout_ms:
#         raise StratisCliEnvironmentError(
#             "The timeout value provided exceeds the largest acceptable value, %s."
#             % maximum_dbus_timeout_ms
#         )
# 
#     # Convert from milliseconds to seconds
#     return timeout_int / 1000


# Path: src/stratis_cli/_actions/_data.py
import os
import sys
import xml.etree.ElementTree as ET
from dbus_client_gen import (
    DbusClientGenerationError,
    managed_object_class,
    mo_query_builder,
)
from dbus_python_client_gen import DPClientGenerationError, make_class
from .._errors import StratisCliGenerationError
from ._constants import (
    BLOCKDEV_INTERFACE,
    FILESYSTEM_INTERFACE,
    MANAGER_INTERFACE,
    POOL_INTERFACE,
    REPORT_INTERFACE,
)
from ._environment import get_timeout
from ._introspect import SPECS


    Manager = make_class("Manager", ET.fromstring(SPECS[MANAGER_INTERFACE]), timeout)

    ObjectManager = make_class(
        "ObjectManager",
        ET.fromstring(SPECS["org.freedesktop.DBus.ObjectManager"]),
        timeout,
    )

    # Specification for the lowest manager interface supported by the major
    # version of stratisd on which this version of the CLI depends.
    # This minimal specification includes only the specification for the
    # Version property.
    manager_spec = """
    <interface name="org.storage.stratis3.Manager.r0">
        <property access="read" name="Version" type="s">
            <annotation name="org.freedesktop.DBus.Property.EmitsChangedSignal" value="const" />
        </property>
    </interface>
    """
    Manager0 = make_class("Manager0", ET.fromstring(manager_spec), timeout)

# Do not expect to get coverage on Generation errors.
# These can only occurs if the XML data in _SPECS is ill-formed; we have
# complete control over that data and can expect it to be valid.
except DPClientGenerationError as err:  # pragma: no cover
    raise StratisCliGenerationError(
        "Failed to generate some class needed for invoking dbus-python methods"
    ) from err
except DbusClientGenerationError as err:  # pragma: no cover

    raise StratisCliGenerationError(