How to use the ergo.misc.typecast function in ergo

To help you get started, we’ve selected a few ergo examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github supposedly / nutshell / nutshell / segment_types / table / table.py View on Github external
def _prep_macro(self, func):
        if func not in self._prepped_macros:
            kwargs = {i.name for i in signature(func).parameters.values() if i.kind is Parameter.KEYWORD_ONLY}
            special_params = {
              'directives': self.directives,
              'n_states': self.n_states,
              'variables': self.vars,
              'table': self
            }.items()
            self._prepped_macros[func] = partial(typecast(func), **{k: v for k, v in special_params if k in kwargs})
        return self._prepped_macros[func]