Skip to content

Commit

Permalink
Adding docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
adamcharnock committed Nov 24, 2019
1 parent b66e5db commit abcb8e4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions lightbus/config/structure.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
(smart config editing in the management UI?)
3. Plugins and transports can be assured of reasonable sane data
See Also: https://lightbus.org/reference/configuration/
"""
import logging
import os
Expand Down
7 changes: 4 additions & 3 deletions lightbus/serializers/blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,16 @@

class BlobMessageSerializer(MessageSerializer):
def __call__(self, message: "Message") -> str:
# self.encoder will typically be a json encoder, or something similar.
# Therefore here we just return a json encoded stricture including metadata & kwargs.
"""Takes a message object and returns a serialised string representation"""
return self.encoder({"metadata": message.get_metadata(), "kwargs": message.get_kwargs()})


class BlobMessageDeserializer(MessageDeserializer):
def __call__(self, serialized: Union[str, dict], *, native_id=None, **extra):
# Reverse of BlobMessageSerializer
""" Takes a serialised string representation and returns a Message object
Reverse of BlobMessageSerializer
"""
# Allow for receiving dicts on the assumption that this will be
# json which has already been decoded.
if isinstance(serialized, dict):
Expand Down

0 comments on commit abcb8e4

Please sign in to comment.