bidsbuilder.util.hooks.test_containers

class MinimalDict

Bases: MutableMapping, DataMixin, hookedContainerABC

__init__(*args, **kwargs)
clear() None.  Remove all items from D.
forbidden_instance_names = {'__check_callback__', '__observable_container_init__'}
get(k[, d]) D[k] if k in D, else d.  d defaults to None.
items() a set-like object providing a view on D's items
keys() a set-like object providing a view on D's keys
pop(k[, d]) v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised.

popitem() (k, v), remove and return some (key, value) pair

as a 2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) D.get(k,d), also set D[k]=d if k not in D
update([E, ]**F) None.  Update D from mapping/iterable E and F.

If E present and has a .keys() method, does: for k in E.keys(): D[k] = E[k] If E present and lacks .keys() method, does: for (k, v) in E: D[k] = v In either case, this is followed by: for k, v in F.items(): D[k] = v

values() an object providing a view on D's values
class MinimalList

Bases: MutableSequence, DataMixin, hookedContainerABC

__init__(*args, **kwargs)
append(value)

S.append(value) – append value to the end of the sequence

clear() None -- remove all items from S
count(value) integer -- return number of occurrences of value
extend(values)

S.extend(iterable) – extend sequence by appending elements from the iterable

forbidden_instance_names = {'__check_callback__', '__observable_container_init__'}
index(value[, start[, stop]]) integer -- return first index of value.

Raises ValueError if the value is not present.

Supporting start and stop arguments is optional, but recommended.

insert(index, value)

S.insert(index, value) – insert value before index

pop([index]) item -- remove and return item at index (default last).

Raise IndexError if list is empty or index is out of range.

remove(value)

S.remove(value) – remove first occurrence of value. Raise ValueError if the value is not present.

reverse()

S.reverse() – reverse IN PLACE

class MinimalSet

Bases: MutableSet, DataMixin, hookedContainerABC

__init__(*args, **kwargs)
add(value)

Add an element.

clear()

This is slow (creates N new iterators!) but effective.

discard(value)

Remove an element. Do not raise an exception if absent.

forbidden_instance_names = {'__check_callback__', '__observable_container_init__'}
isdisjoint(other)

Return True if two sets have a null intersection.

pop()

Return the popped value. Raise KeyError if empty.

remove(value)

Remove an element. If not a member, raise a KeyError.

is_supported_type(tp)
Return type:

bool

Parameters:

tp (type | object)

wrap_container(container, validator_flag=False)
Return type:

Union[type[ObservableType], ObservableType]

Parameters:
  • container (type | object)

  • validator_flag (bool)

converts a container into an observable equivalent.
  • If container is a type, this will return an observable equivalent type

  • If container is an instance, this will return the upgraded observable instance