Пример #1
0
    def get_codec_progress() -> CodecProgress:
        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_get_size, subjects_encode, subjects_decode = listCP(oneCP(SubjectC))

        def get_size(x : 'BudgetaryConsistency') -> int:
            return subjects_get_size(x.subjects)

        def encode(worker : Worker, f : FileOut, x : 'BudgetaryConsistency') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)

        def decode(worker : Worker, f : FileIn) -> 'BudgetaryConsistency':
            name, alts = DatasetHeaderC_decode(f)
            subjects = subjects_decode(f)
            return BudgetaryConsistency(name, alts, subjects)

        return CodecProgress(get_size, encode, decode)
Пример #2
0
    def get_codec_progress() -> CodecProgress:
        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_size, subjects_encode, subjects_decode = listCP(oneCP(SubjectC))
        intC_encode, intC_decode = intC

        def get_size(x : 'TupleIntransMenus') -> int:
            return subjects_size(x.subjects)

        def encode(worker : Worker, f : FileOut, x : 'TupleIntransMenus') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)

        def decode(worker : Worker, f : FileIn) -> 'TupleIntransMenus':
            ds = TupleIntransMenus(*DatasetHeaderC_decode(f))
            ds.subjects = subjects_decode(worker, f)
            return ds

        return CodecProgress(get_size, encode, decode)
Пример #3
0
    def get_codec_progress() -> CodecProgress:
        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_get_size, subjects_encode, subjects_decode = listCP(oneCP(SubjectC))

        def get_size(x : 'Budgetary') -> int:
            return subjects_get_size(x.subjects)

        def encode(worker : Worker, f : FileOut, x : 'Budgetary') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)

        def decode(worker : Worker, f : FileIn) -> 'Budgetary':
            ds = Budgetary(*DatasetHeaderC_decode(f))
            ds.subjects = subjects_decode(worker, f)
            ds.update_nr_observations()
            return ds

        return CodecProgress(get_size, encode, decode)
Пример #4
0
    def get_codec_progress() -> CodecProgress:
        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_size, subjects_encode, subjects_decode = listCP(
            oneCP(PackedSubjectC))
        intC_encode, intC_decode = intC

        def get_size(x: 'ExperimentalData') -> int:
            return subjects_size(x.subjects)

        def encode(worker: Worker, f: FileOut, x: 'ExperimentalData') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)
            intC_encode(f, x.observ_count)

        def decode(worker: Worker, f: FileIn) -> 'ExperimentalData':
            ds = ExperimentalData(*DatasetHeaderC_decode(f))
            ds.subjects = subjects_decode(worker, f)
            ds.observ_count = intC_decode(f)
            return ds

        return CodecProgress(get_size, encode, decode)
Пример #5
0
    def get_codec_progress() -> CodecProgress:
        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_size, subjects_encode, subjects_decode = listCP(
            oneCP(SubjectC))
        intC_encode, intC_decode = intC

        def get_size(x: 'ConsistencyResult') -> int:
            return subjects_size(x.subjects)

        def encode(worker: Worker, f: FileOut, x: 'ConsistencyResult') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)
            intC_encode(f, x.max_cycle_length)

        def decode(worker: Worker, f: FileIn) -> 'ConsistencyResult':
            ds = ConsistencyResult(*DatasetHeaderC_decode(f))
            ds.subjects = subjects_decode(worker, f)
            ds.max_cycle_length = intC_decode(f)
            return ds

        return CodecProgress(get_size, encode, decode)
Пример #6
0
    def get_codec_progress() -> CodecProgress:
        subjects_encode: Callable[[Worker, FileOut, List[PackedResponse]],
                                  None]
        subjects_decode: Callable[[Worker, FileIn], List[PackedResponse]]

        DatasetHeaderC_encode, DatasetHeaderC_decode = DatasetHeaderC
        subjects_size, subjects_encode, subjects_decode = listCP(
            oneCP(PackedResponseC))
        intC_encode, intC_decode = intC

        def get_size(x: 'EstimationResult') -> int:
            return cast(int, subjects_size(x.subjects))

        def encode(worker: Worker, f: FileOut, x: 'EstimationResult') -> None:
            DatasetHeaderC_encode(f, (x.name, x.alternatives))
            subjects_encode(worker, f, x.subjects)

        def decode(worker: Worker, f: FileIn) -> 'EstimationResult':
            ds = EstimationResult(*DatasetHeaderC_decode(f))
            ds.subjects = subjects_decode(worker, f)
            return ds

        return CodecProgress(get_size, encode, decode)