Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions synpath/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,10 +477,14 @@ def _clean(params: Any) -> Any:


def complete_capabilities(cls: type) -> None:
"""Fill `cls.has` from `CAPABILITIES`, refusing typos and illegal values.
"""Build a complete `cls.has` map for every name in `CAPABILITIES`.

Shared by the read adapters and the trading adapters, so both answer
every question the same way. See `Exchange.__init_subclass__`.
Validate the class's own declarations, rejecting unknown capability names
and illegal values. Inherit from the nearest ancestor in method resolution
order with a non-empty `has` dictionary, then apply the class's overrides.
Capabilities declared by neither default to `False`.

Shared by read, trading and WebSocket adapters during subclass creation.
"""
declared = cls.__dict__.get("has", {})
if not isinstance(declared, dict):
Expand Down
Loading