From 5dd639fe5e6bdbb2674222299e9dff8383c6b198 Mon Sep 17 00:00:00 2001 From: Wassilios Lytras Date: Mon, 18 Mar 2024 15:46:45 +0100 Subject: [PATCH] Formatting --- pyas2lib/as2.py | 17 +++++++++++------ pyas2lib/cms.py | 4 ++-- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/pyas2lib/as2.py b/pyas2lib/as2.py index 5f0c79c..4e580dd 100644 --- a/pyas2lib/as2.py +++ b/pyas2lib/as2.py @@ -1,7 +1,9 @@ """Define the core functions/classes of the pyas2 package.""" -import logging -import hashlib +import asyncio import binascii +import hashlib +import inspect +import logging import traceback from dataclasses import dataclass from email import encoders @@ -9,9 +11,8 @@ from email import message_from_bytes as parse_mime from email import utils as email_utils from email.mime.multipart import MIMEMultipart + from oscrypto import asymmetric -import asyncio -import inspect from pyas2lib.cms import ( compress_message, @@ -613,7 +614,9 @@ async def aparse( if find_org_partner_cb: if inspect.iscoroutinefunction(find_org_partner_cb): - self.receiver, self.sender = await find_org_partner_cb(org_id, partner_id) + self.receiver, self.sender = await find_org_partner_cb( + org_id, partner_id + ) else: self.receiver, self.sender = find_org_partner_cb(org_id, partner_id) @@ -772,7 +775,9 @@ def parse(self, *args, **kwargs): """ loop = asyncio.get_event_loop() if loop.is_running(): - raise RuntimeError("Cannot run synchronous parse within an already running event loop.") + raise RuntimeError( + "Cannot run synchronous parse within an already running event loop." + ) return loop.run_until_complete(self.aparse(*args, **kwargs)) diff --git a/pyas2lib/cms.py b/pyas2lib/cms.py index 8f95a11..db3d148 100644 --- a/pyas2lib/cms.py +++ b/pyas2lib/cms.py @@ -3,7 +3,7 @@ import zlib from datetime import datetime, timezone -from asn1crypto import cms, core, algos +from asn1crypto import algos, cms, core from asn1crypto.cms import SMIMECapabilityIdentifier from oscrypto import asymmetric, symmetric, util @@ -73,7 +73,7 @@ def encrypt_message( :param data_to_encrypt: A byte string of the data to be encrypted :param enc_alg: The algorithm to be used for encrypting the data :param encryption_cert: The certificate to be used for encrypting the data - :param key_enc_alg: The encryption scheme for the key encryption: rsaes_pkcs1v15 (default) or rsaes_oaep + :param key_enc_alg: The algo for the key encryption: rsaes_pkcs1v15 (default) or rsaes_oaep :return: A CMS ASN.1 byte string of the encrypted data. """