Coverage for src / ezxl / utils / _pywintypes_compat.py: 0.00%
8 statements
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 15:53 +0000
« prev ^ index » next coverage.py v7.13.5, created at 2026-04-29 15:53 +0000
1# ///////////////////////////////////////////////////////////////
2# _pywintypes_compat - Typed pywintypes runtime aliases
3# Project: EzXl
4# ///////////////////////////////////////////////////////////////
6"""Typed compatibility aliases for ``pywintypes`` runtime members.
8The ``pywintypes`` module exposes several runtime-only attributes whose
9type information is incomplete in static analysis tools. This module
10centralises the required casts so callers can use named aliases instead
11of sprinkling local workarounds across the codebase.
12"""
14from __future__ import annotations
16# ///////////////////////////////////////////////////////////////
17# IMPORTS
18# ///////////////////////////////////////////////////////////////
19# Standard library imports
20from typing import Any, cast
22# Third-party imports
23import pywintypes
25# ///////////////////////////////////////////////////////////////
26# CONSTANTS
27# ///////////////////////////////////////////////////////////////
29_PYWINTYPES_ANY = cast(Any, pywintypes)
31COM_TIME_TYPE: type = cast(type, _PYWINTYPES_ANY.TimeType)
32COM_ERROR_TYPE: type[BaseException] = cast(type[BaseException], _PYWINTYPES_ANY.error)
33COM_EXCEPTION_TYPE: type[BaseException] = cast(
34 type[BaseException], _PYWINTYPES_ANY.com_error
35)
37__all__ = ["COM_ERROR_TYPE", "COM_EXCEPTION_TYPE", "COM_TIME_TYPE"]