MCPcopy Create free account
hub / github.com/aboutcode-org/scancode-toolkit / attribute

Function attribute

src/commoncode/datautils.py:23–57  ·  view source on GitHub ↗

Return a generic attribute with help metadata and that is not included in the representation by default.

(
    default=attr.NOTHING,
    validator=None,
    repr=False,
    eq=True,
    order=True,  # NOQA
    init=True,
    type=None,
    converter=None,  # NOQA
    help=None,
    label=None,
    metadata=None,
)

Source from the content-addressed store, hash-verified

21
22
23def attribute(
24 default=attr.NOTHING,
25 validator=None,
26 repr=False,
27 eq=True,
28 order=True, # NOQA
29 init=True,
30 type=None,
31 converter=None, # NOQA
32 help=None,
33 label=None,
34 metadata=None,
35): # NOQA
36 """
37 Return a generic attribute with help metadata and that is not included in the
38 representation by default.
39 """
40 metadata = metadata or dict()
41 if help:
42 metadata[HELP_METADATA] = help
43
44 if label:
45 metadata[LABEL_METADATA] = label
46
47 return attr.attrib(
48 default=default,
49 validator=validator,
50 repr=repr,
51 eq=eq,
52 order=order,
53 init=init,
54 metadata=metadata,
55 type=type,
56 converter=converter,
57 )
58
59
60def Boolean(

Callers 7

BooleanFunction · 0.70
TriBooleanFunction · 0.70
StringFunction · 0.70
IntegerFunction · 0.70
FloatFunction · 0.70
ListFunction · 0.70
MappingFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected