Skip to content

Commit

Permalink
Merge pull request WebOfTrust#760 from SmithSamuelM/main
Browse files Browse the repository at this point in the history
added streaming.py and test_streaming.py preliminary setup for annota…
  • Loading branch information
SmithSamuelM authored Apr 14, 2024
2 parents 7c65d7e + 74c2cec commit 6e30601
Show file tree
Hide file tree
Showing 4 changed files with 136 additions and 67 deletions.
67 changes: 0 additions & 67 deletions src/keri/core/coring.py
Original file line number Diff line number Diff line change
Expand Up @@ -4797,73 +4797,6 @@ def _satisfy_weighted(self, indices):



class Streamer:
"""
Streamer is CESR sniffable stream class
Has the following public properties:
Properties:
Methods:
Hidden:
"""

def __init__(self, stream):
"""Initialize instance
Parameters:
stream (bytes | bytearray): sniffable CESR stream
"""
self._stream = bytes(stream)


@property
def stream(self):
"""stream property getter
"""
return self._stream

@property
def text(self):
"""expanded stream as qb64 text
Returns:
stream (bytes): expanded text qb64 version of stream
"""
return self._stream

@property
def binary(self):
"""compacted stream as qb2 binary
Returns:
stream (bytes): compacted binary qb2 version of stream
"""
return self._stream

@property
def texter(self):
"""expanded stream as Texter instance
Returns:
texter (Texter): Texter primitive of stream suitable wrapping
"""
return self._stream




class Sadder:
"""
Sadder is self addressed data (SAD) serializer-deserializer class
Expand Down
97 changes: 97 additions & 0 deletions src/keri/core/streaming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
# -*- coding: utf-8 -*-
"""
keri.core.streaming module
Provides support for Streamer and Annotater
"""


from typing import NamedTuple
from collections import namedtuple

from .. import kering

from .. import help


from . import coring


def annot():
"""Annotate CESR stream"""



def denot():
"""De-annotate CESR stream"""



class Streamer:
"""
Streamer is CESR sniffable stream class
Has the following public properties:
Properties:
Methods:
Hidden:
"""

def __init__(self, stream):
"""Initialize instance
Parameters:
stream (bytes | bytearray): sniffable CESR stream
"""
self._stream = bytes(stream)


@property
def stream(self):
"""stream property getter
"""
return self._stream

@property
def text(self):
"""expanded stream as qb64 text
Returns:
stream (bytes): expanded text qb64 version of stream
"""
return self._stream

@property
def binary(self):
"""compacted stream as qb2 binary
Returns:
stream (bytes): compacted binary qb2 version of stream
"""
return self._stream

@property
def texter(self):
"""expanded stream as Texter instance
Returns:
texter (Texter): Texter primitive of stream suitable wrapping
"""
return self._stream





2 changes: 2 additions & 0 deletions tests/core/test_serdering.py
Original file line number Diff line number Diff line change
Expand Up @@ -3323,6 +3323,8 @@ def test_cesr_native_dumps():

"""End Test"""



def test_cesr_native_dumps_hby():
"""Test Serder._dumps with habery"""

Expand Down
37 changes: 37 additions & 0 deletions tests/core/test_streaming.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# -*- coding: utf-8 -*-
"""
tests.core.test_streaming module
"""


import pytest


from keri import kering

from keri.help import helping

from keri.core import (Matter, )


from keri.core import streaming
from keri.core.streaming import (annot, denot, Streamer)


def test_annot():
"""Test annot function Annotate"""

"""End Test"""

def test_streamer():
"""Test streamer instance"""

"""End Test"""

if __name__ == "__main__":
test_annot()
test_streamer()



0 comments on commit 6e30601

Please sign in to comment.