Coverage for control/cust/factory_record.py : 100%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1"""Factory to make derived Record classes."""
3from config import Names as N
4from control.utils import factory as baseFactory
6from control.record import Record
7from control.cust.assessment_record import AssessmentR
8from control.cust.criteria_record import CriteriaR
9from control.cust.criteriaentry_record import CriteriaEntryR
10from control.cust.review_record import ReviewR
11from control.cust.reviewentry_record import ReviewEntryR
12from control.cust.score_record import ScoreR
15DERIVEDS = (
16 (N.assessment, AssessmentR),
17 (N.criteria, CriteriaR),
18 (N.criteriaEntry, CriteriaEntryR),
19 (N.review, ReviewR),
20 (N.reviewEntry, ReviewEntryR),
21 (N.score, ScoreR),
22)
23"""Search space for classes derived from `control.record.Record`."""
26def factory(name):
27 """Look up a derived class by registered name.
29 See `DERIVEDS`.
31 Parameters
32 ----------
33 name: string
34 The name under which the derived class is registered.
36 Returns
37 -------
38 class
39 The derived class if it can be found, otherwise the base class.
40 """
42 return baseFactory(name, Record, DERIVEDS)