oc_ocdm.decorators module
- oc_ocdm.decorators.accepts_only(param_type)[source]
A decorator that can be applied to the entity methods such as setters and removers when they accept a parameter. It enforces the right parameter type by raising a
TypeErrorwhen the parameter is not None but its type is not the expected one.The expected type can be expressed through a short string:
‘literal’ for the
strtype;‘thing’ for the
URIReftype (fromrdflib);‘_dataset_’ for the
Datasetentities;the OCDM short name in case of any other entity (e.g. ‘br’ for
BibliographicResource).
- Parameters
param_type (str) – A short string representing the expected type