Replaces LICENSE (GPLv3 -> AGPLv3) and prepends `SPDX-License-Identifier: AGPL-3.0-or-later` to every source file across decnet/, decnet_web/, tests/, scripts/, and tools/. Rationale: closes the GPLv3 ASP loophole so any party operating a modified DECNET as a network service must offer their modified source. Personal copyright (Samuel Paschuan) + inbound=outbound contributions make a future unilateral relicense infeasible. - LICENSE: full AGPL-3.0 text (gnu.org/licenses/agpl-3.0.txt) - COPYRIGHT: project copyright notice - tools/add_spdx_headers.py: idempotent header injector (shebang- and PEP 263-aware) Touches 1565 source files (.py, .ts, .tsx, .js, .jsx, .css, .sh). No behavior change; comments only.
53 lines
1.6 KiB
Python
53 lines
1.6 KiB
Python
# SPDX-License-Identifier: AGPL-3.0-or-later
|
|
"""Public extraction entry point.
|
|
|
|
``extract_session`` is the only function workers call. It builds a
|
|
:class:`SessionContext` once and fans the registered feature functions
|
|
across it. Pure library: no I/O, no bus, no DB. The worker
|
|
(``BEHAVE-INTEGRATION.md`` Phase 4) is responsible for those.
|
|
"""
|
|
from __future__ import annotations
|
|
|
|
from typing import Iterable, Iterator
|
|
|
|
from behave_core.spec.envelope import Observation
|
|
|
|
from decnet.profiler.behave_shell._ctx import SessionContext, build_session_context
|
|
from decnet.profiler.behave_shell._features import FEATURES
|
|
from decnet.profiler.behave_shell._parse import AsciinemaEvent
|
|
|
|
DEFAULT_SOURCE = "decnet/profiler/behave_shell/extract.py"
|
|
|
|
|
|
def extract_session(
|
|
events: Iterable[AsciinemaEvent],
|
|
*,
|
|
sid: str,
|
|
source: str = DEFAULT_SOURCE,
|
|
evidence_ref: str | None = None,
|
|
) -> Iterator[Observation]:
|
|
"""Yield BEHAVE-SHELL observations for a single session.
|
|
|
|
``events`` is an iterable of ``(t, kind, data)`` tuples — see
|
|
``_parse.AsciinemaEvent``. ``sid`` identifies the session for
|
|
evidence pointers and downstream joins.
|
|
"""
|
|
ctx = build_session_context(
|
|
events, sid=sid, source=source, evidence_ref=evidence_ref
|
|
)
|
|
for feature_fn in FEATURES:
|
|
yield from feature_fn(ctx)
|
|
|
|
|
|
def build_context(
|
|
events: Iterable[AsciinemaEvent],
|
|
*,
|
|
sid: str,
|
|
source: str = DEFAULT_SOURCE,
|
|
evidence_ref: str | None = None,
|
|
) -> SessionContext:
|
|
"""Expose the SessionContext build for tests + future debug tools."""
|
|
return build_session_context(
|
|
events, sid=sid, source=source, evidence_ref=evidence_ref
|
|
)
|