From d8b850bc81284e2046136526f2229b9894655bf2 Mon Sep 17 00:00:00 2001 From: Mourits de Beer <31511766+ff137@users.noreply.github.com> Date: Fri, 25 Oct 2024 20:00:55 +0200 Subject: [PATCH] :art: Refactor string concatenation in model descriptions (#3313) * :art: Refactor string concatenation in model descriptions Signed-off-by: ff137 * :art: fix mediation typo Signed-off-by: ff137 * :art: Signed-off-by: ff137 --------- Signed-off-by: ff137 --- .../connections/v1_0/tests/test_manager.py | 6 +- .../models/tests/test_mediation_record.py | 4 +- acapy_agent/resolver/default/peer4.py | 4 +- .../vc/data_integrity/models/options.py | 59 +++++++++-------- acapy_agent/vc/data_integrity/models/proof.py | 64 +++++++++++-------- acapy_agent/wallet/keys/routes.py | 16 +++-- acapy_agent/wallet/routes.py | 2 +- 7 files changed, 87 insertions(+), 68 deletions(-) diff --git a/acapy_agent/protocols/connections/v1_0/tests/test_manager.py b/acapy_agent/protocols/connections/v1_0/tests/test_manager.py index 2f4fafff4d..5eee966524 100644 --- a/acapy_agent/protocols/connections/v1_0/tests/test_manager.py +++ b/acapy_agent/protocols/connections/v1_0/tests/test_manager.py @@ -446,7 +446,7 @@ async def test_create_request_multitenant(self): async def test_create_request_mediation_id(self): mediation_record = MediationRecord( - mediation_id="test_medation_id", + mediation_id="test_mediation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, @@ -856,7 +856,7 @@ async def test_create_response_multitenant(self): ) mediation_record = MediationRecord( - mediation_id="test_medation_id", + mediation_id="test_mediation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, @@ -916,7 +916,7 @@ async def test_create_response_bad_state(self): async def test_create_response_mediation(self): mediation_record = MediationRecord( - mediation_id="test_medation_id", + mediation_id="test_mediation_id", role=MediationRecord.ROLE_CLIENT, state=MediationRecord.STATE_GRANTED, connection_id=self.test_mediator_conn_id, diff --git a/acapy_agent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py b/acapy_agent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py index a1eab7e846..fb0eb8e2a9 100644 --- a/acapy_agent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py +++ b/acapy_agent/protocols/coordinate_mediation/v1_0/models/tests/test_mediation_record.py @@ -44,8 +44,8 @@ async def test_backwards_compat_terms(session: ProfileSession): @pytest.mark.asyncio async def test_mediation_record_eq(): - record_0 = MediationRecord(mediation_id="test_medation_id_0", endpoint="zero") - record_1 = MediationRecord(mediation_id="test_medation_id_1", endpoint="one") + record_0 = MediationRecord(mediation_id="test_mediation_id_0", endpoint="zero") + record_1 = MediationRecord(mediation_id="test_mediation_id_1", endpoint="one") assert record_0 != record_1 with pytest.raises(ValueError): diff --git a/acapy_agent/resolver/default/peer4.py b/acapy_agent/resolver/default/peer4.py index 523074ae13..6407bd4e5a 100644 --- a/acapy_agent/resolver/default/peer4.py +++ b/acapy_agent/resolver/default/peer4.py @@ -66,8 +66,8 @@ async def _resolve( record = await storage.get_record(self.RECORD_TYPE, did) except StorageNotFoundError: raise DIDNotFound( - f"short did:peer:4 does not correspond to a \ - known long did:peer:4 {did}" + "short did:peer:4 does not correspond to a known long did:peer:4" + f"{did}" ) document = resolve_short(record.value) else: diff --git a/acapy_agent/vc/data_integrity/models/options.py b/acapy_agent/vc/data_integrity/models/options.py index 551c38e89f..5d8915add7 100644 --- a/acapy_agent/vc/data_integrity/models/options.py +++ b/acapy_agent/vc/data_integrity/models/options.py @@ -70,8 +70,8 @@ class Meta: required=False, metadata={ "description": ( - "An optional identifier for the proof, which MUST be a URL [URL], \ - such as a UUID as a URN" + "An optional identifier for the proof, which MUST be a URL [URL], " + "such as a UUID as a URN" ), "example": "urn:uuid:6a1676b8-b51f-11ed-937b-d76685a20ff5", }, @@ -81,8 +81,8 @@ class Meta: required=True, metadata={ "description": ( - "The specific type of proof MUST be specified as a string that maps \ - to a URL [URL]." + "The specific type of proof MUST be specified as a string that maps " + "to a URL [URL]." ), "example": "DataIntegrityProof", }, @@ -92,9 +92,11 @@ class Meta: data_key="proofPurpose", required=True, metadata={ - "description": "The proof purpose acts as a safeguard to prevent the \ - proof from being misused by being applied to a purpose other than \ - the one that was intended.", + "description": ( + "The proof purpose acts as a safeguard to prevent the " + "proof from being misused by being applied to a purpose other than " + "the one that was intended." + ), "example": "assertionMethod", }, ) @@ -104,8 +106,10 @@ class Meta: required=True, validate=Uri(), metadata={ - "description": "A verification method is the means and information \ - needed to verify the proof. ", + "description": ( + "A verification method is the means and information " + "needed to verify the proof." + ), "example": ( "did:key:z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL#z6Mkgg34" "2Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL" @@ -117,8 +121,8 @@ class Meta: required=True, metadata={ "description": ( - "An identifier for the cryptographic suite that can be used to \ - verify the proof." + "An identifier for the cryptographic suite that can be used to " + "verify the proof." ), "example": "eddsa-jcs-2022", }, @@ -128,9 +132,9 @@ class Meta: required=False, metadata={ "description": ( - "The date and time the proof was created is OPTIONAL and, if \ - included, MUST be specified as an [XMLSCHEMA11-2] \ - dateTimeStamp string" + "The date and time the proof was created is OPTIONAL and, if " + "included, MUST be specified as an [XMLSCHEMA11-2] " + "dateTimeStamp string" ), "example": RFC3339_DATETIME_EXAMPLE, }, @@ -140,9 +144,9 @@ class Meta: required=False, metadata={ "description": ( - "The expires property is OPTIONAL and, if present, specifies when \ - the proof expires. If present, it MUST be an [XMLSCHEMA11-2] \ - dateTimeStamp string" + "The expires property is OPTIONAL and, if present, specifies when " + "the proof expires. If present, it MUST be an [XMLSCHEMA11-2] " + "dateTimeStamp string" ), "example": RFC3339_DATETIME_EXAMPLE, }, @@ -152,8 +156,8 @@ class Meta: required=False, metadata={ "description": ( - "It conveys one or more security domains in which the proof is \ - meant to be used." + "It conveys one or more security domains in which the proof is " + "meant to be used." ), "example": "example.com", }, @@ -163,8 +167,8 @@ class Meta: required=False, metadata={ "description": ( - "The value is used once for a particular domain and window of time. \ - This value is used to mitigate replay attacks." + "The value is used once for a particular domain and window of time. " + "This value is used to mitigate replay attacks." ), "example": UUID4_EXAMPLE, }, @@ -174,8 +178,10 @@ class Meta: required=False, data_key="previousProof", metadata={ - "description": "Each value identifies another data integrity proof that \ - MUST verify before the current proof is processed.", + "description": ( + "Each value identifies another data integrity proof that " + "MUST verify before the current proof is processed." + ), "example": ("urn:uuid:6a1676b8-b51f-11ed-937b-d76685a20ff5"), }, ) @@ -195,9 +201,10 @@ class Meta: nonce = fields.Str( required=False, metadata={ - "description": "One use of this field is to increase privacy by decreasing \ - linkability that is the result of deterministically \ - generated signatures.", + "description": ( + "One use of this field is to increase privacy by decreasing linkability " + "that is the result of deterministically generated signatures." + ), "example": ( "CF69iO3nfvqRsRBNElE8b4wO39SyJHPM7Gg1nExltW5vSfQA1lvDCR/zXX1To0/4NLo==" ), diff --git a/acapy_agent/vc/data_integrity/models/proof.py b/acapy_agent/vc/data_integrity/models/proof.py index f52c69c3ae..6ba869c354 100644 --- a/acapy_agent/vc/data_integrity/models/proof.py +++ b/acapy_agent/vc/data_integrity/models/proof.py @@ -70,8 +70,8 @@ class Meta: required=False, metadata={ "description": ( - "An optional identifier for the proof, which MUST be a URL [URL], \ - such as a UUID as a URN" + "An optional identifier for the proof, which MUST be a URL [URL], " + "such as a UUID as a URN" ), "example": "urn:uuid:6a1676b8-b51f-11ed-937b-d76685a20ff5", }, @@ -81,8 +81,8 @@ class Meta: required=True, metadata={ "description": ( - "The specific type of proof MUST be specified as a string that maps \ - to a URL [URL]." + "The specific type of proof MUST be specified as a string that maps " + "to a URL [URL]." ), "example": "DataIntegrityProof", }, @@ -92,9 +92,11 @@ class Meta: data_key="proofPurpose", required=True, metadata={ - "description": "The proof purpose acts as a safeguard to prevent the proof \ - from being misused by being applied to a purpose other than the one that \ - was intended.", + "description": ( + "The proof purpose acts as a safeguard to prevent the proof " + "from being misused by being applied to a purpose other than the one " + "that was intended." + ), "example": "assertionMethod", }, ) @@ -104,8 +106,10 @@ class Meta: required=True, validate=Uri(), metadata={ - "description": "A verification method is the means and information needed \ - to verify the proof. ", + "description": ( + "A verification method is the means and information needed " + "to verify the proof." + ), "example": ( "did:key:z6Mkgg342Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL#z6Mkgg34" "2Ycpuk263R9d8Aq6MUaxPn1DDeHyGo38EefXmgDL" @@ -117,8 +121,8 @@ class Meta: required=True, metadata={ "description": ( - "An identifier for the cryptographic suite that can be used to verify \ - the proof." + "An identifier for the cryptographic suite that can be used to verify " + "the proof." ), "example": "eddsa-jcs-2022", }, @@ -128,8 +132,8 @@ class Meta: required=False, metadata={ "description": ( - "The date and time the proof was created is OPTIONAL and, if included, \ - MUST be specified as an [XMLSCHEMA11-2] dateTimeStamp string" + "The date and time the proof was created is OPTIONAL and, if included, " + "MUST be specified as an [XMLSCHEMA11-2] dateTimeStamp string" ), "example": RFC3339_DATETIME_EXAMPLE, }, @@ -139,9 +143,9 @@ class Meta: required=False, metadata={ "description": ( - "The expires property is OPTIONAL and, if present, specifies when the \ - proof expires. If present, it MUST be an [XMLSCHEMA11-2] \ - dateTimeStamp string" + "The expires property is OPTIONAL and, if present, specifies when the " + "proof expires. If present, it MUST be an [XMLSCHEMA11-2] " + "dateTimeStamp string" ), "example": RFC3339_DATETIME_EXAMPLE, }, @@ -151,8 +155,8 @@ class Meta: required=False, metadata={ "description": ( - "It conveys one or more security domains in which the proof is \ - meant to be used." + "It conveys one or more security domains in which the proof is " + "meant to be used." ), "example": "example.com", }, @@ -162,8 +166,8 @@ class Meta: required=False, metadata={ "description": ( - "The value is used once for a particular domain and window of time. \ - This value is used to mitigate replay attacks." + "The value is used once for a particular domain and window of time. " + "This value is used to mitigate replay attacks." ), "example": UUID4_EXAMPLE, }, @@ -173,9 +177,10 @@ class Meta: required=False, data_key="proofValue", metadata={ - "description": "A string value that expresses base-encoded binary data \ - necessary to verify the digital proof using the verificationMethod \ - specified.", + "description": ( + "A string value that expresses base-encoded binary data necessary " + "to verify the digital proof using the verificationMethod specified." + ), "example": ( "zsy1AahqbzJQ63n9RtekmwzqZeVj494VppdAVJBnMYrTwft6cLJJGeTSSxCCJ6HKnR" "twE7jjDh6sB2z2AAiZY9BBnCD8wUVgwqH3qchGRCuC2RugA4eQ9fUrR4Yuycac3caiaaay" @@ -187,8 +192,10 @@ class Meta: required=False, data_key="previousProof", metadata={ - "description": "Each value identifies another data integrity proof that \ - MUST verify before the current proof is processed.", + "description": ( + "Each value identifies another data integrity proof that " + "MUST verify before the current proof is processed." + ), "example": ("urn:uuid:6a1676b8-b51f-11ed-937b-d76685a20ff5"), }, ) @@ -196,9 +203,10 @@ class Meta: nonce = fields.Str( required=False, metadata={ - "description": "One use of this field is to increase privacy by decreasing \ - linkability that is the result of deterministically generated \ - signatures.", + "description": ( + "One use of this field is to increase privacy by decreasing linkability " + "that is the result of deterministically generated signatures." + ), "example": ( "CF69iO3nfvqRsRBNElE8b4wO39SyJHPM7Gg1nExltW5vSfQA1lvDCR/zXX1To0/4NLo==" ), diff --git a/acapy_agent/wallet/keys/routes.py b/acapy_agent/wallet/keys/routes.py index dd6d097087..46647fc9b9 100644 --- a/acapy_agent/wallet/keys/routes.py +++ b/acapy_agent/wallet/keys/routes.py @@ -29,8 +29,10 @@ class CreateKeyRequestSchema(OpenAPISchema): seed = fields.Str( required=False, metadata={ - "description": "Optional seed to generate the key pair. \ - Must enable insecure wallet mode.", + "description": ( + "Optional seed to generate the key pair. " + "Must enable insecure wallet mode." + ), "example": "00000000000000000000000000000000", }, ) @@ -38,8 +40,9 @@ class CreateKeyRequestSchema(OpenAPISchema): kid = fields.Str( required=False, metadata={ - "description": "Optional kid to bind to the keypair, \ - such as a verificationMethod.", + "description": ( + "Optional kid to bind to the keypair, such as a verificationMethod." + ), "example": "did:web:example.com#key-01", }, ) @@ -77,8 +80,9 @@ class UpdateKeyRequestSchema(OpenAPISchema): kid = fields.Str( required=True, metadata={ - "description": "New kid to bind to the key pair, \ - such as a verificationMethod.", + "description": ( + "New kid to bind to the key pair, such as a verificationMethod." + ), "example": "did:web:example.com#key-02", }, ) diff --git a/acapy_agent/wallet/routes.py b/acapy_agent/wallet/routes.py index 594a44680a..00bc48cfb1 100644 --- a/acapy_agent/wallet/routes.py +++ b/acapy_agent/wallet/routes.py @@ -178,7 +178,7 @@ class DIDEndpointWithTypeSchema(OpenAPISchema): required=False, validate=UUID4_VALIDATE, metadata={ - "description": "Medation ID to use for endpoint information.", + "description": "Mediation ID to use for endpoint information.", "example": UUID4_EXAMPLE, }, )