From eccdeebc18b87cfc5238b041eef7298fefa63017 Mon Sep 17 00:00:00 2001 From: Rafal Jankowski Date: Tue, 30 Jul 2024 15:52:43 +0200 Subject: [PATCH] Docstring --- src/neptune_scale/__init__.py | 16 +++++++++++++++- src/neptune_scale/core/message_builder.py | 3 +-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/neptune_scale/__init__.py b/src/neptune_scale/__init__.py index fef4eafa..b1ad62f8 100644 --- a/src/neptune_scale/__init__.py +++ b/src/neptune_scale/__init__.py @@ -109,7 +109,21 @@ def log( remove_tags: dict[str, list[str] | set[str]] | None = None, ) -> None: """ - TODO: Add description + Logs metadata to Neptune Run. + + Args: + step: Step number. + timestamp: Time of the metadata. + fields: Dictionary of metadata fields. + metrics: Dictionary of metrics. + add_tags: Dictionary of tags to add. + remove_tags: Dictionary of tags to remove. + + Examples: + >>> with Run(...) as run: + ... run.log(step=1, timestamp=datetime.now(), fields={"int": 1, "string": "test"}) + ... run.log(step=2, timestamp=datetime.now(), metrics={"metric": 1.0}) + """ verify_type("step", step, (float, int, type(None))) verify_type("timestamp", timestamp, (datetime, type(None))) diff --git a/src/neptune_scale/core/message_builder.py b/src/neptune_scale/core/message_builder.py index 267109f0..75f21751 100644 --- a/src/neptune_scale/core/message_builder.py +++ b/src/neptune_scale/core/message_builder.py @@ -29,8 +29,7 @@ def __init__( add_tags: dict[str, list[str] | set[str]], remove_tags: dict[str, list[str] | set[str]], ): - # TODO: Warning instead of raise on step precision loss - self._step = None if step is None else make_step(number=step, raise_on_step_precision_loss=True) + self._step = None if step is None else make_step(number=step) self._timestamp = datetime_to_proto(timestamp) self._fields = fields self._metrics = metrics