def __call__(self, check=True):
        sls = Sls.get_render_stack()[-1]
        if self._id in sls.get_all_decls():
            last_func = sls.last_func()
            if last_func and self._mods[-1]._func is not last_func:
                raise PyDslError(
                    'Cannot run state({0}: {1}) that is required by a runtime '
                    'state({2}: {3}), at compile time.'.format(
                        self._mods[-1]._name, self._id,
                        last_func.mod, last_func.mod._state_id
                    )
                )
            sls.get_all_decls().pop(self._id)
            sls.decls.remove(self)
            self._mods[0]._func._remove_auto_require()
            for m in self._mods:
                try:
                    sls.funcs.remove(m._func)
                except __HOLE__:
                    pass

        result = HighState.get_active().state.functions['state.high'](
            {self._id: self._repr()}
        )

        if not isinstance(result, dict):
            # A list is an error
            raise PyDslError(
                'An error occurred while running highstate: {0}'.format(
                    '; '.join(result)
                )
            )

        result = sorted(six.iteritems(result), key=lambda t: t[1]['__run_num__'])
        if check:
            for k, v in result:
                if not v['result']:
                    import pprint
                    raise PyDslError(
                        'Failed executing low state at compile time:\n{0}'
                        .format(pprint.pformat({k: v}))
                    )
        return result
dataset/ETHPy150Open saltstack/salt/salt/utils/pydsl.py/StateDeclaration.__call__