otupy.core.target.TargetRegister

class TargetRegister

Bases: Register

Target registration

This class registers all available Target`s, both provided by the otupy and by Profiles. The extension of the base class `Register is necessary to add the nsid prefix in front of the Target name.

Methods

add

Add a new Target

clear

D.clear() -> None.

copy

D.copy() -> a shallow copy of D

fromkeys

Create a new dictionary with keys from iterable and values set to value.

get

Get element by name

getName

Get the name of a element

items

D.items() -> a set-like object providing a view on D's items

keys

D.keys() -> a set-like object providing a view on D's keys

pop

D.pop(k[,d]) -> v, remove specified key and return the corresponding value.

popitem

Remove and return a (key, value) pair as a 2-tuple.

setdefault

Insert key with a value of default if key is not in the dictionary.

update

D.update([E, ]**F) -> None.

values

D.values() -> an object providing a view on D's values

__init__(*args, **kwargs)
add(name: str, target, identifier=None, nsid=None)

Add a new Target

Register a new Target and make it available within the system. This method is expected to be called by any Profile that defines additional Target`s. Additionally, the name is added to the Target enumeration `TargetEnum.

This method throw an Exception if the Target is already registered.

Parameters:
  • name – The name used for the Target.

  • target – The class that defines the Target.

  • identifier – A numeric value associated to the standard by the Specification.

  • nsid – The Namespace Identifier where the Target is defined. It is prepended to the target name.

Returns:

None

clear() None.  Remove all items from D.
copy() a shallow copy of D
classmethod fromkeys(iterable, value=None, /)

Create a new dictionary with keys from iterable and values set to value.

get(name: str)

Get element by name

Throws an exception if the given name does not correspond to any registered element.

Parameters:

name – The name of the element to return.

Returns:

The class corresponding to the given name.

getName(register)

Get the name of a element

Given a class element, this method returns its name (the name it was registered with. Note that the returned name include the namespace prefix.

Throws an exception if the given element is not registered.

Parameters:

register – The class element to look for.

Returns:

A string with the name of the element.

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 the key is not found, return the default if given; otherwise, raise a KeyError.

popitem()

Remove and return a (key, value) pair as a 2-tuple.

Pairs are returned in LIFO (last-in, first-out) order. Raises KeyError if the dict is empty.

setdefault(key, default=None, /)

Insert key with a value of default if key is not in the dictionary.

Return the value for key if key is in the dictionary, else default.

update([E, ]**F) None.  Update D from dict/iterable E and F.

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

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