Skip to content

Commit 12c254e

Browse files
committed
cleanup
1 parent 4189af4 commit 12c254e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

python/private/builders.bzl

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,20 @@ def _is_runfiles(value):
185185
return type(value) == "runfiles"
186186

187187
def _Optional(*initial):
188+
"""A wrapper for a re-assignable value that may or may not be set.
189+
190+
This allows structs to have attributes that aren't inherently mutable
191+
and must be re-assigned to have their value updated.
192+
193+
Args:
194+
*initial: A single vararg to be the initial value, or no args
195+
to leave it unset.
196+
197+
Returns:
198+
{type}`Optional`
199+
"""
188200
if len(initial) > 1:
189-
fail("only one positional arg allowed")
201+
fail("Only zero or one positional arg allowed")
190202

191203
# buildifier: disable=uninitialized
192204
self = struct(

0 commit comments

Comments
 (0)