//python/private:builders_util.bzl

Utilities for builders.

is_label(obj)

Tell if an object is aLabel.

Args:
  • objundocumented

kwargs_getter(kwargs,key)

Create a function to getkey fromkwargs.

Args:
kwargs_getter_doc(kwargs)

Creates akwargs_getter for thedoc key.

Args:
kwargs_getter_mandatory(kwargs)

Creates akwargs_getter for themandatory key.

Args:
kwargs_set_default_dict(kwargs,key)

Normalizes None/missing to list.

Args:
kwargs_set_default_doc(kwargs)

Sets thedoc arg default.

Args:
kwargs_set_default_ignore_none(kwargs,key,default)

Normalize None/missing todefault.

Args:
kwargs_set_default_list(kwargs,key)

Normalizes None/missing to list.

Args:
kwargs_set_default_mandatory(kwargs)

SetsFalse as themandatory arg default.

Args:
kwargs_setter(kwargs,key)

Create a function to setkey inkwargs.

Args:
kwargs_setter_doc(kwargs)

Creates akwargs_setter for thedoc key.

Args:
kwargs_setter_mandatory(kwargs)

Creates akwargs_setter for themandatory key.

Args:
list_add_unique(add_to,others,convert=None)

Bulk add values to a list if not already present.

Args:
  • add_to(list[T])

    the list to add values to. It is modifiedin-place.

  • others(collection[collection[T]])

    collection of collections ofthe values to add.

  • convert(callable|None)(defaultNone)

    function to convert the values to add.

normalize_transition_in_out_value(arg_name,value)

Normalize a transition input/output value to a canonical label string.

Args:
  • arg_name(str)

    the transition arg name, “input” or “output”

  • value – A label-like value to normalize.

Returns:

str the canonical label string.

normalize_transition_in_out_values(arg_name,values)

Normalize transition inputs/outputs to canonical label strings.

Args:
to_label_maybe(value)

Convertsvalue to aLabel, maybe.

The “maybe” qualification is because invalid values forLabel()are returned as-is (e.g. None, or special values that might beused with e.g. thedefault attribute arg).

Args:
  • value(str|Label|None|object)

    the value to turn into a label,or return as-is.

Returns:

Label|input_value