Skip to content

Commit

Permalink
Remove obsolete checks
Browse files Browse the repository at this point in the history
  • Loading branch information
chadgates committed Mar 19, 2024
1 parent 625e479 commit e362211
Showing 1 changed file with 15 additions and 18 deletions.
33 changes: 15 additions & 18 deletions pyas2lib/as2.py
Original file line number Diff line number Diff line change
Expand Up @@ -620,18 +620,16 @@ async def aparse(
else:
self.receiver, self.sender = find_org_partner_cb(org_id, partner_id)

else:
if find_org_cb:
if inspect.iscoroutinefunction(find_org_cb):
self.receiver = await find_org_cb(org_id)
else:
self.receiver = find_org_cb(org_id)
elif find_org_cb and find_partner_cb:
if inspect.iscoroutinefunction(find_org_cb):
self.receiver = await find_org_cb(org_id)
else:
self.receiver = find_org_cb(org_id)

if find_partner_cb:
if inspect.iscoroutinefunction(find_partner_cb):
self.sender = await find_partner_cb(partner_id)
else:
self.sender = find_partner_cb(partner_id)
if inspect.iscoroutinefunction(find_partner_cb):
self.sender = await find_partner_cb(partner_id)
else:
self.sender = find_partner_cb(partner_id)

if not self.receiver:
raise PartnerNotFound(f"Unknown AS2 organization with id {org_id}")
Expand Down Expand Up @@ -980,13 +978,12 @@ async def aparse(self, raw_content, find_message_cb):
self.orig_message_id, orig_recipient = self.detect_mdn()

# Call the find message callback which should return a Message instance
if find_message_cb:
if inspect.iscoroutinefunction(find_message_cb):
orig_message = await find_message_cb(
self.orig_message_id, orig_recipient
)
else:
orig_message = find_message_cb(self.orig_message_id, orig_recipient)
if inspect.iscoroutinefunction(find_message_cb):
orig_message = await find_message_cb(
self.orig_message_id, orig_recipient
)
else:
orig_message = find_message_cb(self.orig_message_id, orig_recipient)

if not orig_message:
status = "failed/Failure"
Expand Down

0 comments on commit e362211

Please sign in to comment.