//python/private:attr_builders.bzl — rules_python 0.0.0 documentation (original) (raw)
Builders for creating attributes et al.
Added in version 1.3.0.
attrb.Bool(**kwargs)
Creates a builder for attr.bool
.
Args:
Returns:
attrb.Int(**kwargs)
Creates a builder for attr.int
.
Args:
Returns:
attrb.IntList(**kwargs)
Creates a builder for attr.int_list
.
Args:
- kwargs – Same as attr.int_list.
Returns:
attrb.Label(**kwargs)
Creates a builder for attr.label
.
Args:
- kwargs – The same as
attr.label()
.
Returns:
attrb.LabelKeyedStringDict(**kwargs)
Creates a builder for attr.label_keyed_string_dict
.
Args:
- kwargs – Same as attr.label_keyed_string_dict.
Returns:
attrb.LabelList(**kwargs)
Creates a builder for attr.label_list
.
Args:
- kwargs – Same as attr.label_list.
Returns:
attrb.Output(**kwargs)
Creates a builder for attr.output
.
Args:
- kwargs – Same as attr.output.
Returns:
attrb.OutputList(**kwargs)
Creates a builder for attr.output_list
.
Args:
- kwargs – Same as attr.output_list.
Returns:
attrb.String(**kwargs)
Creates a builder for attr.string
.
Args:
- kwargs – Same as attr.string.
Returns:
attrb.StringDict(**kwargs)
Creates a builder for attr.string_dict
.
Args:
- kwargs – The same args as for
attr.string_dict
.
Returns:
attrb.StringKeyedLabelDict(**kwargs)
Creates a builder for attr.string_keyed_label_dict
.
Args:
- kwargs – Same as attr.string_keyed_label_dict.
Returns:
attrb.StringList(**kwargs)
Creates a builder for attr.string_list
.
Args:
- kwargs – Same as attr.string_list.
Returns:
attrb.StringListDict(**kwargs)
Creates a builder for attr.string_list_dict
.
Args:
- kwargs – Same as attr.string_list_dict.
Returns:
typedef attrb.WhichCfg
Values returned by AttrCfg.which_cfg
WhichCfg.TARGET
Indicates the target config is set.
WhichCfg.EXEC
Indicates the exec config is set.
WhichCfg.NONE
Indicates the “none” config is set (see config.none).
WhichCfg.IMPL
Indicates a custom transition is set.
typedef AttrCfg
Builder for cfg
arg of label attributes.
AttrCfg.inputs() → list[Label]
AttrCfg.outputs() → list[Label]
AttrCfg.which_cfg() → attrb.WhichCfg
Tells which of the cfg modes is set. Will be one of: target, exec, none, or implementation
AttrCfg.exec_group()
Tells the exec group to use if an exec transition is being used.
Returns:
str | None
the name of the exec group to use if any, or None
if which_cfg
isn’t exec
AttrCfg.implementation()
Tells the custom transition function, if any and applicable.
Returns:
callable | None
the custom transition function to use, if any, or None
if a different config mode is being used.
AttrCfg.new(inputs=None, outputs=None, **kwargs)
Creates a builder for the attr.cfg
attribute.
Args:
- inputs – (list[Label] |
None
) (default None)
inputs to use for a transition - outputs – (list[Label] |
None
) (default None)
outputs to use for a transition - kwargs – (dict)
Three different keyword args are supported. The presence of a keyword arg will mark the respective mode returned bywhich_cfg
.cfg
: string of either “target” or “exec”exec_group
: string of an exec group name to use. None means to use regular exec config (i.e.config.exec()
)implementation
: callable for a custom transition function.
Returns:
AttrCfg.none()
Tells if none cfg (config.none()
) is set.
Returns:
bool True if none cfg is set, False if not.
AttrCfg.set_exec(exec_group=None)
Sets to use an exec transition.
Args:
- exec_group – (str |
None
) (default None)
the exec group name to use, if any.
AttrCfg.set_implementation(impl)
Sets a custom transition function to use.
Args:
AttrCfg.set_none()
Sets to use the “none” transition.
AttrCfg.set_target()
Sets to use the target transition.
AttrCfg.target()
Tells if target cfg is set.
Returns:
bool True if target cfg is set, False if not.
typedef Bool
Builder for attr.bool.
Bool.build() → attr.bool
Bool.default() -> bool)
Bool.doc() → str
Bool.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
Bool.mandatory() → bool
Bool.set_default(v)
Bool.set_doc(v)
Bool.set_mandatory(v)
Bool.new(**kwargs)
Creates a builder for attr.bool
.
Args:
Returns:
typedef Int
Builder for attr.int.
Int.build() → attr.int
Int.default() → int
Int.doc() → str
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
Int.mandatory() → bool
Int.values() → list[int]
The returned value is a mutable reference to the underlying list.
Int.set_default(v)
Int.set_doc(v)
Int.set_mandatory(v)
Int.new(**kwargs)
Creates a builder for attr.int
.
Args:
Returns:
typedef IntList
Builder for attr.int_list.
IntList.allow_empty() → bool
IntList.build() → attr.int_list
IntList.default() → list[int]
IntList.doc() → str
IntList.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
IntList.mandatory() → bool
IntList.set_allow_empty(v)
IntList.set_doc(v)
IntList.set_mandatory(v)
IntList.new(**kwargs)
Creates a builder for attr.int_list
.
Args:
- kwargs – Same as attr.int_list.
Returns:
typedef Label
Builder for attr.label
objects.
Label.allow_files() → bool | list[str] | None
Note that allow_files
is mutually exclusive with allow_single_file
. Only one of the two can have a value set.
Label.allow_single_file() → bool | None
Note that allow_single_file
is mutually exclusive with allow_files
. Only one of the two can have a value set.
Label.aspects() → list[aspect]
The returned list is a mutable reference to the underlying list.
Label.build() → attr.label
Label.default() → str | label | configuration_field | None
Label.doc() → str
Label.executable() → bool
Label.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
Label.mandatory() → bool
Label.providers() → list[list[provider]]
The returned list is a mutable reference to the underlying list.
Label.set_default(v)
Label.set_doc(v)
Label.set_executable(v)
Label.set_mandatory(v)
Label.add_allow_files(*values)
Adds allowed file extensions
NOTE: Add an allowed file extension unsets allow_single_file
Args:
Label.new(**kwargs)
Creates a builder for attr.label
.
Args:
- kwargs – The same as
attr.label()
.
Returns:
Label.set_allow_files(v)
Set the allow_files arg
NOTE: Setting allow_files
unsets allow_single_file
Args:
Label.set_allow_single_file(v)
Sets the allow_single_file arg.
NOTE: Setting allow_single_file
unsets allow_file
Args:
typedef LabelKeyedStringDict
Builder for attr.label_keyed_string_dict.
LabelKeyedStringDict.aspects() → list[aspect]
The returned list is a mutable reference to the underlying list.
LabelKeyedStringDict.allow_files() → bool | list[str]
LabelKeyedStringDict.allow_empty() → bool
LabelKeyedStringDict.cfg_: AttrCfg_
LabelKeyedStringDict.default() → dict[str | Label, str] | callable
LabelKeyedStringDict.doc() → str
LabelKeyedStringDict.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
LabelKeyedStringDict.mandatory() → bool
LabelKeyedStringDict.providers() → list[provider | list[provider]]
Returns a mutable reference to the underlying list.
LabelKeyedStringDict.set_mandatory(v)
LabelKeyedStringDict.set_allow_empty(v)
LabelKeyedStringDict.set_default(v)
LabelKeyedStringDict.set_doc(v)
LabelKeyedStringDict.set_allow_files(v)
LabelKeyedStringDict.add_allow_files(*values)
Adds allowed file extensions
Args:
LabelKeyedStringDict.new(**kwargs)
Creates a builder for attr.label_keyed_string_dict
.
Args:
- kwargs – Same as attr.label_keyed_string_dict.
Returns:
typedef LabelList
Builder for attr.label_list
LabelList.aspects() → list[aspect]
LabelList.allow_files() → bool | list[str]
LabelList.allow_empty() → bool
LabelList.build() → attr.label_list
LabelList.default() → list[str | Label] | configuration_field | callable
LabelList.doc() → str
LabelList.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
LabelList.mandatory() → bool
LabelList.providers() → list[provider | list[provider]]
LabelList.set_allow_empty(v)
LabelList.set_allow_files(v)
LabelList.set_default(v)
LabelList.set_doc(v)
LabelList.set_mandatory(v)
LabelList.new(**kwargs)
Creates a builder for attr.label_list
.
Args:
- kwargs – Same as attr.label_list.
Returns:
typedef Output
Builder for attr.output
Output.build() → attr.output
Output.doc() → str
Output.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
Output.mandatory() → bool
Output.set_doc(v)
Output.set_mandatory(v)
Output.new(**kwargs)
Creates a builder for attr.output
.
Args:
- kwargs – Same as attr.output.
Returns:
typedef OutputList
Builder for attr.output_list
OutputList.allow_empty() → bool
OutputList.build() → attr.output
OutputList.doc() → str
OutputList.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
OutputList.mandatory() → bool
OutputList.set_allow_empty(v)
OutputList.set_doc(v)
OutputList.set_mandatory(v)
OutputList.new(**kwargs)
Creates a builder for attr.output_list
.
Args:
- kwargs – Same as attr.output_list.
Returns:
typedef String
Builder for attr.string
String.build() → attr.string
String.default() → str | configuration_field
String.doc() → str
String.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
String.mandatory() → bool
String.values() → list[str]
String.set_default(v)
String.set_doc(v)
String.set_mandatory(v)
String.new(**kwargs)
Creates a builder for attr.string
.
Args:
- kwargs – Same as attr.string.
Returns:
typedef StringDict
Builder for attr.string_dict
StringDict.default() → dict[str, str]
StringDict.doc() → str
StringDict.mandatory() → bool
StringDict.allow_empty() → bool
StringDict.build() → attr.string_dict
StringDict.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
StringDict.set_doc(v)
StringDict.set_mandatory(v)
StringDict.set_allow_empty(v)
StringDict.new(**kwargs)
Creates a builder for attr.string_dict
.
Args:
- kwargs – The same args as for
attr.string_dict
.
Returns:
typedef StringKeyedLabelDict
Builder for attr.string_keyed_label_dict.
StringKeyedLabelDict.allow_empty() → bool
StringKeyedLabelDict.allow_files() → bool | list[str]
StringKeyedLabelDict.aspects() → list[aspect]
StringKeyedLabelDict.build() → attr.string_list
StringKeyedLabelDict.cfg_: AttrCfg_
StringKeyedLabelDict.default() → dict[str, Label] | callable
StringKeyedLabelDict.doc() → str
StringKeyedLabelDict.mandatory() → bool
StringKeyedLabelDict.providers() → list[list[provider]]
StringKeyedLabelDict.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
StringKeyedLabelDict.set_allow_empty(v)
StringKeyedLabelDict.set_allow_files(v)
StringKeyedLabelDict.set_doc(v)
StringKeyedLabelDict.set_default(v)
StringKeyedLabelDict.set_mandatory(v)
StringKeyedLabelDict.new(**kwargs)
Creates a builder for attr.string_keyed_label_dict
.
Args:
- kwargs – Same as attr.string_keyed_label_dict.
Returns:
typedef StringList
Builder for attr.string_list
StringList.allow_empty() → bool
StringList.build() → attr.string_list
StringList.default_: Value[list[str] | configuration_field]_
StringList.doc() → str
StringList.mandatory() → bool
StringList.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
StringList.set_allow_empty(v)
StringList.set_doc(v)
StringList.set_mandatory(v)
StringList.new(**kwargs)
Creates a builder for attr.string_list
.
Args:
- kwargs – Same as attr.string_list.
Returns:
typedef StringListDict
Builder for attr.string_list_dict.
StringListDict.allow_empty() → bool
StringListDict.build() → attr.string_list
StringListDict.default() → dict[str, list[str]]
StringListDict.doc() → str
StringListDict.mandatory() → bool
StringListDict.kwargs_: dict[str, Any]_
Additional kwargs to use when building. This is to allow manipulations that aren’t directly supported by the builder’s API. The state of this dict may or may not reflect prior API calls, and subsequent API calls may modify this dict. The general contract is that modifications to this will be respected when build()
is called, assuming there were no API calls in between.
StringListDict.set_allow_empty(v)
StringListDict.set_doc(v)
StringListDict.set_mandatory(v)
StringListDict.new(**kwargs)
Creates a builder for attr.string_list_dict
.
Args:
- kwargs – Same as attr.string_list_dict.
Returns: