MCPcopy
hub / github.com/USArmyResearchLab/Dshell / _blob_handler

Method _blob_handler

dshell/core.py:734–754  ·  view source on GitHub ↗

Accepts a Connection and a Blob. It doesn't really do anything except call the blob_handler and is only here for consistency and possible future features.

(self, conn: "Connection", blob: "Blob")

Source from the content-addressed store, hash-verified

732
733 # TODO: Have blobs handled with consumer/producer model just like Packets and Connections?
734 def _blob_handler(self, conn: "Connection", blob: "Blob"):
735 """
736 Accepts a Connection and a Blob.
737
738 It doesn't really do anything except call the blob_handler and is only
739 here for consistency and possible future features.
740 """
741 try:
742 blob_handler_out = self.blob_handler(conn, blob)
743 except Exception as e:
744 print_handler_exception(e, self, 'blob_handler')
745 blob_handler_out = None
746 if blob_handler_out:
747 connection, blob = blob_handler_out
748 if not isinstance(connection, Connection) or not isinstance(blob, Blob):
749 logger.warning(
750 "The output from {} blob_handler must be of type (dshell.Connection, dshell.Blob)! Chaining plugins from here may not be possible.".format(
751 self.name))
752 blob_handler_out = None
753 if not blob_handler_out:
754 blob.hidden = True
755
756 def blob_handler(self, conn: "Connection", blob: "Blob"):
757 """

Callers 1

_connection_handlerMethod · 0.95

Calls 2

blob_handlerMethod · 0.95
print_handler_exceptionFunction · 0.85

Tested by

no test coverage detected