def get_type(value): """Infer type from value.""" if isinstance(value, string_types): return Type.STRING elif isinstance(value, (int, float)): return Type.NUMBER elif isinstance(value, bool): return Type.BOOLEAN raise exceptions.Error(f'Value of unknown type: {value}')
def g(self, *args, **kwargs): if self._results is None: raise exceptions.Error('Called before `execute`') return f(self, *args, **kwargs)
def g(self, *args, **kwargs): if self.closed: raise exceptions.Error(f'{self.__class__.__name__} already closed') return f(self, *args, **kwargs)