diff --git a/versions/unreleased/api-ref/prefect/blocks/core/index.html b/versions/unreleased/api-ref/prefect/blocks/core/index.html index 167a2c9f0d..7b93229dcd 100644 --- a/versions/unreleased/api-ref/prefect/blocks/core/index.html +++ b/versions/unreleased/api-ref/prefect/blocks/core/index.html @@ -9959,7 +9959,13 @@
@register_base_type
+1083
+1084
+1085
+1086
+1087
+1088
+1089
@register_base_type
@instrument_method_calls_on_class_instances
class Block(BaseModel, ABC):
"""
@@ -10718,11 +10724,14 @@
`is_anonymous` is `True`.
"""
if name is None and not is_anonymous:
- raise ValueError(
- "You're attempting to save a block document without a name. "
- "Please either save a block document with a name or set "
- "is_anonymous to True."
- )
+ if self._block_document_name is None:
+ raise ValueError(
+ "You're attempting to save a block document without a name."
+ " Please either call `save` with a `name` or pass"
+ " `is_anonymous=True` to save an anonymous block."
+ )
+ else:
+ name = self._block_document_name
self._is_anonymous = is_anonymous
@@ -10763,7 +10772,10 @@
@sync_compatible
@instrument_instance_method_call()
async def save(
- self, name: str, overwrite: bool = False, client: "PrefectClient" = None
+ self,
+ name: Optional[str] = None,
+ overwrite: bool = False,
+ client: "PrefectClient" = None,
):
"""
Saves the values of a block as a block document.
@@ -11324,13 +11336,7 @@
Source code in prefect/blocks/core.py
-