//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:

Bool

attrb.Int(**kwargs)

Creates a builder for attr.int.

Args:

Returns:

Int

attrb.IntList(**kwargs)

Creates a builder for attr.int_list.

Args:

Returns:

IntList

attrb.Label(**kwargs)

Creates a builder for attr.label.

Args:

Returns:

Label

attrb.LabelKeyedStringDict(**kwargs)

Creates a builder for attr.label_keyed_string_dict.

Args:

Returns:

LabelKeyedStringDict

attrb.LabelList(**kwargs)

Creates a builder for attr.label_list.

Args:

Returns:

LabelList

attrb.Output(**kwargs)

Creates a builder for attr.output.

Args:

Returns:

Output

attrb.OutputList(**kwargs)

Creates a builder for attr.output_list.

Args:

Returns:

OutputList

attrb.String(**kwargs)

Creates a builder for attr.string.

Args:

Returns:

String

attrb.StringDict(**kwargs)

Creates a builder for attr.string_dict.

Args:

Returns:

StringDict

attrb.StringKeyedLabelDict(**kwargs)

Creates a builder for attr.string_keyed_label_dict.

Args:

Returns:

StringKeyedLabelDict

attrb.StringList(**kwargs)

Creates a builder for attr.string_list.

Args:

Returns:

StringList

attrb.StringListDict(**kwargs)

Creates a builder for attr.string_list_dict.

Args:

Returns:

StringListDict

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:

Returns:

AttrCfg

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:

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:

Bool

typedef Int

Builder for attr.int.

Int.build() → attr.int

Int.default() → int

Int.doc() → str

Int.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.

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:

Int

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:

Returns:

IntList

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.cfg_: AttrCfg_

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:

Returns:

Label

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:

Returns:

LabelKeyedStringDict

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.cfg_: AttrCfg_

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:

Returns:

LabelList

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:

Returns:

Output

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:

Returns:

OutputList

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:

Returns:

String

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:

Returns:

StringDict

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:

Returns:

StringKeyedLabelDict

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:

Returns:

StringList

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:

Returns:

StringListDict