Skip to content

Commit

Permalink
Made seq_nums optional
Browse files Browse the repository at this point in the history
  • Loading branch information
evalott100 committed Sep 11, 2023
1 parent 3856a88 commit 2d5d01e
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion event_model/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1996,6 +1996,11 @@ def compose_resource(
)


# A dict of Tuple[str, StreamRange] where the string is the StreamDatum uuid

_stream_datum_seq_nums: Dict[str, StreamRange] = {}


@dataclass
class ComposeStreamDatum:
stream_resource: StreamResource
Expand All @@ -2004,12 +2009,18 @@ class ComposeStreamDatum:
def __call__(
self,
data_keys: List[str],
seq_nums: StreamRange,
indices: StreamRange,
seq_nums: Optional[StreamRange] = None,
descriptor: Optional[EventDescriptor] = None,
validate: bool = True,
) -> StreamDatum:
resource_uid = self.stream_resource["uid"]

# If the seq_nums aren't passed in then the bluesky
# bundler will keep track of them
if not seq_nums:
seq_nums = StreamRange(start=0, stop=0)

doc = StreamDatum(
stream_resource=resource_uid,
uid=f"{resource_uid}/{next(self.counter)}",
Expand Down

0 comments on commit 2d5d01e

Please sign in to comment.