Coverage for src/wonka/__init__.py: 100%
13 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-10-30 22:54 +0000
« prev ^ index » next coverage.py v7.14.1, created at 2026-10-30 22:54 +0000
1"""Flexible, accessible, extensible Python factories
3Contents:
4 Assembler: assembly line constructor that calls stored constructors in
5 order.
6 AutoRegistrar: `Registrar` that automatically registers its subclasses.
7 Classer: producer that always returns a class.
8 Cluster: base class for collections of constructors.
9 Delegate: dispatcher that calls a creation method named after the type of
10 the item passed.
11 Factory: base class for `wonka` constructors.
12 Flexer: producer that returns an instance only when parameters are passed.
13 Instancer: producer that always returns an instance.
14 Manager: base class for iterable constructors.
15 Manufacturer: `dict`-like container of constructors.
16 Producer: base mixin for modifying created items.
17 Registrar: factory that builds items from a registry.
18 Scribe: factory that clones items.
19 Sourcerer: dispatcher that calls a creation method based on the types in
20 its `sources`.
21 Subclasser: factory that builds items from the subclasses of a class.
22 finalize: finalizes construction before returning a value.
23 inject_attributes: adds keys and values of a mapping to an item as
24 attributes.
25 is_constructor: returns whether an item is a `wonka`-compatible
26 constructor.
27 set_compatibility_rule: sets the global attribute compatibility rule.
28 set_keyer: sets the global default function used to name dict keys.
29 set_method_namer: sets the global default function used to name factory
30 creation methods.
31 set_overwrite_rule: sets the global attribute overwrite rule.
32 set_verbose_rule: sets the global attribute message verbosity rule.
34"""
36from __future__ import annotations
38__version__ = '0.3.0'
40__author__: str = 'Corey Rayburn Yung'
42__all__: list[str] = [
43 'Assembler',
44 'AutoRegistrar',
45 'Classer',
46 'Cluster',
47 'Delegate',
48 'Factory',
49 'Flexer',
50 'Instancer',
51 'Manager',
52 'Manufacturer',
53 'Producer',
54 'Registrar',
55 'Scribe',
56 'Sourcerer',
57 'Subclasser',
58 'finalize',
59 'inject_attributes',
60 'is_constructor',
61 'set_compatibility_rule',
62 'set_keyer',
63 'set_method_namer',
64 'set_overwrite_rule',
65 'set_verbose_rule']
68from .base import Cluster, Factory, Manager, Producer
69from .clusters import Manufacturer
70from .dispatchers import Delegate, Sourcerer
71from .managers import Assembler
72from .options import (
73 set_compatibility_rule,
74 set_keyer,
75 set_method_namer,
76 set_overwrite_rule,
77 set_verbose_rule,
78)
79from .producers import Classer, Flexer, Instancer
80from .prototypers import Scribe
81from .registries import AutoRegistrar, Registrar, Subclasser
82from .shared import finalize, inject_attributes, is_constructor