Hyperiso 1.0.3
Modular flavour-physics calculations, Wilson coefficients and statistical inference
Loading...
Searching...
No Matches
pyhyperiso.core.Common.BlockName.BlockName Class Reference

Public Member Functions

 __init__ (self, Union[str, List[str], Set[str], common.BlockName] names)
 
str to_string (self)
 
Set[str] get_alias (self)
 
bool has_alias (self, str alias)
 
 add_alias (self, str alias)
 
 to_upper (self)
 
 __eq__ (self, other)
 
 __ne__ (self, other)
 
 __lt__ (self, other)
 
 __hash__ (self)
 
 __str__ (self)
 
 __repr__ (self)
 

Protected Attributes

 _cpp_obj
 

Detailed Description

Python wrapper around the C++ ``BlockName`` with alias semantics.

A ``BlockName`` is not just one string: it is a *set of aliases* that all
refer to the same logical block (useful for legacy naming conventions or
capitalization differences).

Important semantic detail (from C++):
    Two block names can be considered equal if they **share at least one**
    alias (depending on the C++ operator== implementation).

Notes:
    - ``to_string()`` returns a representative string for the block. If
      multiple aliases exist, which one is returned may be unspecified.
      Prefer ``get_alias()`` when you need all aliases.
    - ``add_alias()`` and ``to_upper()`` are chainable and return ``self``.

Definition at line 7 of file BlockName.py.

Constructor & Destructor Documentation

◆ __init__()

pyhyperiso.core.Common.BlockName.BlockName.__init__ (   self,
Union[str, List[str], Set[str], common.BlockName]  names 
)
Create a ``PyBlockName`` from common Python representations.

Args:
    names: One of:
        - ``common.BlockName``: an existing bound C++ instance.
        - ``str``: a single alias (some C++ implementations may also
          parse slash-separated aliases like ``"A/B/C"``).
        - ``list[str]`` or ``set[str]``: multiple aliases.

Raises:
    TypeError: If ``names`` has an unsupported type.

Definition at line 25 of file BlockName.py.

Member Function Documentation

◆ __eq__()

pyhyperiso.core.Common.BlockName.BlockName.__eq__ (   self,
  other 
)
Equality comparison.

Args:
    other (Union[PyBlockName, str]): Another block name wrapper or a string.

Returns:
    bool: Result of the underlying C++ equality semantics. When comparing
    to a string, the binding typically checks against the alias set.

Definition at line 97 of file BlockName.py.

◆ __hash__()

pyhyperiso.core.Common.BlockName.BlockName.__hash__ (   self)
Hash for set/dict usage.

Definition at line 133 of file BlockName.py.

◆ __lt__()

pyhyperiso.core.Common.BlockName.BlockName.__lt__ (   self,
  other 
)
Strict ordering.

Args:
    other (PyBlockName): Another block name wrapper.

Returns:
    bool: Result of the underlying C++ ordering (if provided).

Raises:
    TypeError: If ``other`` is not a ``PyBlockName``.

Definition at line 117 of file BlockName.py.

◆ __ne__()

pyhyperiso.core.Common.BlockName.BlockName.__ne__ (   self,
  other 
)
Negated equality.

Definition at line 113 of file BlockName.py.

◆ __repr__()

pyhyperiso.core.Common.BlockName.BlockName.__repr__ (   self)
Debug representation.

Definition at line 141 of file BlockName.py.

◆ __str__()

pyhyperiso.core.Common.BlockName.BlockName.__str__ (   self)
String conversion.

Definition at line 137 of file BlockName.py.

◆ add_alias()

pyhyperiso.core.Common.BlockName.BlockName.add_alias (   self,
str  alias 
)
Add a new alias to this block name.

Args:
    alias (str): Alias to add.

Returns:
    PyBlockName: ``self`` (chainable).

Definition at line 76 of file BlockName.py.

◆ get_alias()

Set[str] pyhyperiso.core.Common.BlockName.BlockName.get_alias (   self)
Return the full alias set.

Returns:
    Set[str]: All aliases associated with this block name.

Definition at line 57 of file BlockName.py.

◆ has_alias()

bool pyhyperiso.core.Common.BlockName.BlockName.has_alias (   self,
str  alias 
)
Check whether an alias is registered.

Args:
    alias (str): Alias string to test.

Returns:
    bool: ``True`` if ``alias`` is present in the alias set.

Definition at line 65 of file BlockName.py.

◆ to_string()

str pyhyperiso.core.Common.BlockName.BlockName.to_string (   self)
Return a representative string for this block.

Returns:
    str: A string alias for this block. If several aliases are present,
    the chosen alias may be unspecified (mirrors C++).

Definition at line 48 of file BlockName.py.

◆ to_upper()

pyhyperiso.core.Common.BlockName.BlockName.to_upper (   self)
Normalize aliases to upper case.

Returns:
    PyBlockName: ``self`` (chainable).

Definition at line 88 of file BlockName.py.

Member Data Documentation

◆ _cpp_obj

pyhyperiso.core.Common.BlockName.BlockName._cpp_obj
protected

Definition at line 39 of file BlockName.py.


The documentation for this class was generated from the following file: