gtirb.util module¶
General utilities usable by any other GTIRB submoudle.
- class gtirb.util.AddrRange(*args, **kwargs)[source]¶
Bases:
Protocol
An object spanning a range of addresses.
- __callable_proto_members_only__ = False¶
- __init__(*args, **kwargs)¶
- __protocol_attrs__ = {'address', 'size'}¶
- property address: int | None¶
- property size: int | None¶
- exception gtirb.util.DeserializationError[source]¶
Bases:
GtirbError
- gtirb.util.DictLike¶
Any value that can be passed to the constructor of
dict
; that is, a mapping or iterable yielding key-value tuples.alias of
Union
[Mapping
[K
,V
],Iterable
[Tuple
[K
,V
]]]
- class gtirb.util.IndexedContainer(*args, **kwargs)[source]¶
Bases:
Protocol
[T_contra
]Container wth an index that can be updated.
- __callable_proto_members_only__ = True¶
- __init__(*args, **kwargs)¶
- __protocol_attrs__ = {'_index_add', '_index_discard'}¶
- class gtirb.util.ListWrapper(*args)[source]¶
Bases:
MutableSequence
[T
]- __getitem__(i)[source]¶
- Return type:
typing.Union
[typing.TypeVar
(T
),typing.MutableSequence
[typing.TypeVar
(T
)]]
- class gtirb.util.OffsetRange(*args, **kwargs)[source]¶
Bases:
Protocol
An object spanning a range of offsets.
- __callable_proto_members_only__ = False¶
- __init__(*args, **kwargs)¶
- __protocol_attrs__ = {'offset', 'size'}¶
- property offset: int¶
- property size: int¶
- class gtirb.util.ParentGetter(*args, **kwargs)[source]¶
Bases:
Protocol
[T_contra
]Interface for getting an _IndexedContainer for an instance.
- __call__(instance)[source]¶
Call self as a function.
- Return type:
typing.Optional
[gtirb.util.IndexedContainer
[typing.TypeVar
(T_contra
, contravariant=True)]]
- __callable_proto_members_only__ = True¶
- __init__(*args, **kwargs)¶
- __protocol_attrs__ = {'__call__'}¶
- gtirb.util.nodes_at(nodes, addrs)[source]¶
- Return type:
typing.Iterable
[typing.TypeVar
(AddrRangeT
, bound=gtirb.util.AddrRange
)]
- gtirb.util.nodes_on(nodes, addrs)[source]¶
- Return type:
typing.Iterable
[typing.TypeVar
(AddrRangeT
, bound=gtirb.util.AddrRange
)]