1"""Python wrapper for dependent-block graph introspection.
3This module exposes a high-level Python facade over the C++
4``DependantBlockInfoProvider``. It lets Python workflows inspect whether a
5block is dependent, which blocks it depends on, and which blocks depend on it.
7The Hyperiso core must be initialized before calling these methods, typically
8through ``HyperisoMaster.init(...)``.
11from typing
import List, Optional
13from pyhyperiso.phyperiso.pyhyperiso.core
import (
14 DependantBlockInfoProvider
as _CppDependantBlockInfoProvider,
20 """Inspect block-level dependencies from Python.
23 cpp_obj: Optional already-bound C++ provider. When omitted, a new C++
24 ``DependantBlockInfoProvider`` is created.
27 >>> provider = DependantBlockInfoProvider()
28 >>> provider.is_dependent_block(ParameterType.SM, "EW")
30 >>> provider.get_source_blocks(ParameterType.SM, "EW")
34 def __init__(self, cpp_obj: Optional[_CppDependantBlockInfoProvider] =
None):
35 """Create the Python wrapper around the C++ provider."""
36 self.
_cpp_obj = cpp_obj
or _CppDependantBlockInfoProvider()
39 """Return whether ``block_name`` is a dependent block.
42 parameter_type: Parameter namespace containing the block.
43 block_name: Name or alias of the block to inspect.
46 bool: ``True`` when the underlying C++ block is a dependent block.
51 """Return the direct upstream blocks used by ``block_name``.
53 This answers: "which blocks does this block depend on directly?"
56 parameter_type: Parameter namespace containing the block.
57 block_name: Name or alias of the block to inspect.
60 list[str]: Sorted direct source block names.
65 """Return the direct blocks depending on ``block_name``.
67 This answers: "which blocks directly depend on this block?"
70 parameter_type: Parameter namespace containing the block.
71 block_name: Name or alias of the block to inspect.
74 list[str]: Sorted direct dependent/downstream block names.
79 """Return all transitive upstream blocks used by ``block_name``.
82 parameter_type: Parameter namespace containing the block.
83 block_name: Name or alias of the block to inspect.
86 list[str]: Sorted deduplicated source block names.
91 """Return all transitive blocks depending on ``block_name``.
94 parameter_type: Parameter namespace containing the block.
95 block_name: Name or alias of the block to inspect.
98 list[str]: Sorted deduplicated dependent/downstream block names.
103__all__ = [
"DependantBlockInfoProvider"]
bool is_dependent_block(self, ParameterType parameter_type, str block_name)
List[str] get_all_dependent_blocks(self, ParameterType parameter_type, str block_name)
List[str] get_all_source_blocks(self, ParameterType parameter_type, str block_name)
__init__(self, Optional[_CppDependantBlockInfoProvider] cpp_obj=None)
List[str] get_dependent_blocks(self, ParameterType parameter_type, str block_name)
List[str] get_source_blocks(self, ParameterType parameter_type, str block_name)