Remove Document argument "signatures" in __init__() and in all subclasses __init__()
When we instantiate a
Document instance, or a
Document subclass instance, we do not have the signatures of the document as it is not created yet.
So we can remove the
signatures argument in the
Document and all his subclass.
It will be a big backward compatibility break. But the code will be more logic and simple.
Deprecation need to be done in a previous release (say %0.60.0 for example).
It will be Deprecated gracefully with warnings, thanks to python deprecation system.
To ease the migration, perhaps start by set the argument as Optional with deprecationWarning.
Then remove it in a future version...
All documents classes inherit of the
Document class has a required
signatures parameter which type is
But most of the subclass does not have any signature when creating an instance.
None is passed, the subclass handle it differently.
Identity subclass handling (and the fact that you must provide a
def __init__( self, version: int, currency: str, pubkey: str, uid: str, ts: BlockUID, signature: Optional[str], ) -> None: ... if signature: super().__init__(version, currency, [signature]) else: super().__init__(version, currency, )
Membership subclass, consider it to be the best way to do it:
def __init__( self, version: int, currency: str, issuer: str, membership_ts: BlockUID, membership_type: str, uid: str, identity_ts: BlockUID, signature: Optional[str] = None, ) -> None: ... super().__init__(version, currency, [signature] if signature else )
signature parameter is not required, and we prepare a
signatures parameter for the parent
We should do it for all subclass of
Document, being careful as some are multi-signature.