MCPcopy
hub / github.com/python-attrs/attrs / __init__

Method __init__

src/attr/_make.py:2498–2556  ·  view source on GitHub ↗
(
        self,
        name,
        default,
        validator,
        repr,
        cmp,  # XXX: unused, remove along with other cmp code.
        hash,
        init,
        inherited,
        metadata=None,
        type=None,
        converter=None,
        kw_only=False,
        eq=None,
        eq_key=None,
        order=None,
        order_key=None,
        on_setattr=None,
        alias=None,
        alias_is_default=None,
    )

Source from the content-addressed store, hash-verified

2496 )
2497
2498 def __init__(
2499 self,
2500 name,
2501 default,
2502 validator,
2503 repr,
2504 cmp, # XXX: unused, remove along with other cmp code.
2505 hash,
2506 init,
2507 inherited,
2508 metadata=None,
2509 type=None,
2510 converter=None,
2511 kw_only=False,
2512 eq=None,
2513 eq_key=None,
2514 order=None,
2515 order_key=None,
2516 on_setattr=None,
2517 alias=None,
2518 alias_is_default=None,
2519 ):
2520 eq, eq_key, order, order_key = _determine_attrib_eq_order(
2521 cmp, eq_key or eq, order_key or order, True
2522 )
2523
2524 # Cache this descriptor here to speed things up later.
2525 bound_setattr = _OBJ_SETATTR.__get__(self)
2526
2527 # Despite the big red warning, people *do* instantiate `Attribute`
2528 # themselves.
2529 bound_setattr("name", name)
2530 bound_setattr("default", default)
2531 bound_setattr("validator", validator)
2532 bound_setattr("repr", repr)
2533 bound_setattr("eq", eq)
2534 bound_setattr("eq_key", eq_key)
2535 bound_setattr("order", order)
2536 bound_setattr("order_key", order_key)
2537 bound_setattr("hash", hash)
2538 bound_setattr("init", init)
2539 bound_setattr("converter", converter)
2540 bound_setattr(
2541 "metadata",
2542 (
2543 types.MappingProxyType(dict(metadata)) # Shallow copy
2544 if metadata
2545 else _EMPTY_METADATA_SINGLETON
2546 ),
2547 )
2548 bound_setattr("type", type)
2549 bound_setattr("kw_only", kw_only)
2550 bound_setattr("inherited", inherited)
2551 bound_setattr("on_setattr", on_setattr)
2552 bound_setattr("alias", alias)
2553 bound_setattr(
2554 "alias_is_default",
2555 alias is None if alias_is_default is None else alias_is_default,

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected