def get_domain(self):
        if isinstance(self.model, BayesianModel):
            cpds = self.model.get_cpds()
            cpds.sort(key=lambda x: x.variable)
            domain = {}
            for cpd in cpds:
                domain[cpd.variable] = str(cpd.variable_card)
            return domain
        elif isinstance(self.model, MarkovModel):
            factors = self.model.get_factors()
            domain = {}
            for factor in factors:
                variables = factor.variables
                for var in variables:
                    if var not in domain:
                        domain[var] = str(factor.get_cardinality([var])[var])
            return domain
        else:
            raise TypeError("Model must be an instance of Markov or Bayesian model.")
Check that the tokens in the UnwrappedLines have the expected subtypes.
dataset/ETHPy150Open pgmpy/pgmpy/pgmpy/readwrite/UAI.py/UAIWriter.get_domain--crossover with--dataset/ETHPy150Open google/yapf/yapftests/subtype_assigner_test.py/SubtypeAssignerTest._CheckFormatTokenSubtypes