feat: add type hints to all public functions in trustgraph/base (#803)

feat: add type hints to all public functions in trustgraph/base

Add type annotations to 23 modules covering:
- Metrics classes (ConsumerMetrics, ProducerMetrics, etc.)
- Spec classes (ConsumerSpec, ProducerSpec, SubscriberSpec, etc.)
- Service classes with add_args() and run() methods
- Utility functions (logging, pubsub, clients)
- AsyncProcessor methods

All 93 public functions now fully typed.

Refs #785

* refactor: deduplicate imports and move __future__ after docstrings

Addresses review feedback on PR #803:
- Remove duplicate 'from argparse import ArgumentParser' across 12 files
- Move 'from __future__ import annotations' to line 1 in all files
- Clean up excessive blank lines
This commit is contained in:
RaccoonLabs 2026-04-16 05:59:04 -03:00 committed by Cyber MacGeddon
parent 22096e07e2
commit 706e62b7c2
23 changed files with 125 additions and 61 deletions

View file

@ -1,7 +1,9 @@
from __future__ import annotations
import uuid
import asyncio
import logging
from typing import Any
from . subscriber import Subscriber
from . producer import Producer
@ -115,7 +117,7 @@ class RequestResponseSpec(Spec):
self.response_schema = response_schema
self.impl = impl
def add(self, flow, processor, definition):
def add(self, flow: Any, processor: Any, definition: dict[str, Any]) -> None:
request_metrics = ProducerMetrics(
processor = flow.id, flow = flow.name, name = self.request_name