import uic.view_dataset import util.tree_model from util.codec import Codec, FileIn, FileOut, namedtupleC, strC, intC, \ frozensetC, listC, bytesC, tupleC, maybe from util.codec_progress import CodecProgress, listCP, oneCP log = logging.getLogger(__name__) class ChoiceRow_str(NamedTuple): menu: FrozenSet[str] default: Optional[str] choice: FrozenSet[str] ChoiceRow_strC = namedtupleC(ChoiceRow_str, frozensetC(strC), maybe(strC), frozensetC(strC)) class ChoiceRowNode(util.tree_model.Node): def __init__(self, parent_node, row: int, cr: ChoiceRow) -> None: subject = parent_node.subject util.tree_model.Node.__init__( self, parent_node, row, fields=(subject.name, subject.csv_set(cr.menu), subject.csv_alt(cr.default), subject.csv_set(cr.choice)), )
import uic.view_dataset import util.tree_model from gui.progress import Worker from dataset import Dataset, DatasetHeaderC, Analysis, ExportVariant from util.codec import Codec, FileIn, FileOut, listC, strC, intC, \ tupleC, namedtupleC, setC, frozensetC from util.codec_progress import CodecProgress, listCP, oneCP log = logging.getLogger(__name__) class Row(NamedTuple): tuple_size : int garp_menu_tuples : Set[FrozenSet[FrozenSet[int]]] # set of tuples of menus (= alt sets) RowC = namedtupleC(Row, intC, setC(frozensetC(frozensetC(intC)))) class Subject(NamedTuple): name : str rows : List[Row] SubjectC = namedtupleC(Subject, strC, listC(RowC)) class MenuRowNode(util.tree_model.Node): def __init__(self, parent_node, row: int, alternatives : List[str], xs : FrozenSet[FrozenSet[int]]) -> None: util.tree_model.Node.__init__( self, parent_node, row, fields=( '', '', '{' + ','.join(
column_names: Sequence[str] size: int get_rows: Callable[[], Iterator[Optional[tuple]]] # None -> bump progress class Analysis(NamedTuple): name: str config: Optional[Callable[ [], Optional[Any]]] # display config dialog, return config | can be None run: Callable[[Worker, Any], 'Dataset'] # (worker, config) -> result is_hidden: bool = False AltSet = FrozenSet[int] AltSetC = frozensetC(intC) Menu = AltSet MenuC = AltSetC class ChoiceRow(NamedTuple): menu: Menu default: Optional[int] choice: AltSet ChoiceRowC = namedtupleC(ChoiceRow, MenuC, maybe(intC), AltSetC) PackedSubject = NewType('PackedSubject', bytes) PackedSubjectC = bytesC