# Stubtest allowlist for the `thetadatadx` Python wheel (Gate 6 / #549).
#
# `__init__.pyi` covers the public surface: clients, credentials, the
# fluent `Contract` / `Subscription` / `SecType` types, the string enums,
# streaming context managers and the typed exception hierarchy by hand,
# and the streaming event classes, the `Config` properties, the tick rows
# and their `<Tick>List` wrappers, `StringList`, the market-data methods
# and their builders generated from the tables the runtime is built from.
# The `<Tick>ListIter` iterators are left undeclared.
#
# The CI gate runs::
#
#     python -m mypy.stubtest thetadatadx \
#         --allowlist thetadatadx-py/stubtest_allowlist.txt \
#         --ignore-missing-stub \
#         --ignore-disjoint-bases \
#         --ignore-positional-only
#
# `--ignore-missing-stub` covers what the stub deliberately does not
# declare: the `<Tick>ListIter` iterators and the private test and bench
# hooks.
# `--ignore-disjoint-bases` is a PEP 800 marker stubtest emits on
# every pyo3 class; pyclasses are always disjoint by construction.
# `--ignore-positional-only` covers the asymmetry between pyo3's
# `def (self, value, /)` and the human-readable `def __eq__(self,
# other)` we write in stubs.
#
# Remaining false positives below — all stem from pyo3 routing
# constructor parameters through `__new__` while the user-facing
# documentation talks about `__init__` (the practical user-visible
# signature is identical; mypy.stubtest reports both halves of the
# swap as drift).

# pyo3 routes every pyclass constructor through `__new__`. The
# stub documents the equivalent `__init__` signature because that
# is what the user sees in `help()`, in IDE autocomplete, and in
# the rendered Sphinx docs. Allow both halves of the
# `__init__ / __new__` swap on every pyclass that has a non-trivial
# constructor.
thetadatadx\.Credentials\.__init__
thetadatadx\.Credentials\.__new__
# `Client.__new__` is intentionally NOT allowlisted — the .pyi carries a
# precise `__new__` stub mirroring the runtime `#[pyo3(signature = ...)]`,
# so stubtest validates the constructor parameter list and a renamed /
# removed `api_key` / `email` / `password` / `market_data_type` kwarg is caught.
# Only the documented-`__init__`-vs-real-`__new__` swap is suppressed.
thetadatadx\.Client\.__init__
thetadatadx\.AsyncClient\.__init__
thetadatadx\.AsyncClient\.__new__
# `AsyncClient.__getattr__` forwards `streaming` to `Client.streaming`, so
# the method the stub declares is not an attribute of the class.
thetadatadx\.AsyncClient\.streaming
thetadatadx\.StreamingClient\.__init__
thetadatadx\.StreamingClient\.__new__
thetadatadx\.MarketDataClient\.__init__
thetadatadx\.MarketDataClient\.__new__
thetadatadx\.MarketDataClient\.__getattr__
thetadatadx\.StreamingSession\.__getattr__

# `__exit__` / `__aexit__` on pyo3 context managers carry default
# values for the three positional args at runtime (matching
# `Optional[...] = None` semantics). The hand-written stub elides the
# defaults because the user is never going to call them directly, only
# through `with` / `async with`. Allow the swap.
thetadatadx\..*\.__exit__
thetadatadx\..*\.__aexit__

# `EventCallback` is a `Callable[..., None]` alias declared in the
# stub for documentation purposes — it never appears at runtime
# (there is no runtime use that needs it as a value).
thetadatadx\.EventCallback

# `StreamEvent` is a type alias declared in the stub for
# documentation purposes — it never appears at runtime (there is
# no runtime use that needs it as a value).
thetadatadx\.StreamEvent
