async def runCmdOpts(self, opts): ''' Perform the command actions. Must be implemented by Cmd implementers. Args: opts (dict): Options dictionary. ''' raise s_exc.NoSuchImpl(mesg='runCmdOpts must be implemented by subclasses.', name='runCmdOpts')
def iterdata(fd, close_fd=True, **opts): ''' Iterate through the data provided by a file like object. Optional parameters may be used to control how the data is deserialized. Examples: The following example show use of the iterdata function.:: with open('foo.csv','rb') as fd: for row in iterdata(fd, format='csv', encoding='utf8'): dostuff(row) Args: fd (file) : File like object to iterate over. close_fd (bool) : Default behavior is to close the fd object. If this is not true, the fd will not be closed. **opts (dict): Ingest open directive. Causes the data in the fd to be parsed according to the 'format' key and any additional arguments. Yields: An item to process. The type of the item is dependent on the format parameters. ''' fmt = opts.get('format', 'lines') fopts = fmtopts.get(fmt, {}) # set default options for format for opt, val in fopts.items(): opts.setdefault(opt, val) ncod = opts.get('encoding') if ncod is not None: fd = codecs.getreader(ncod)(fd) fmtr = fmtyielders.get(fmt) if fmtr is None: raise s_exc.NoSuchImpl(name=fmt, knowns=fmtyielders.keys()) for item in fmtr(fd, opts): yield item if close_fd: fd.close()
def indx(self, norm): # pragma: no cover ''' Return the property index bytes for the given *normalized* value. ''' name = self.__class__.__name__ raise s_exc.NoSuchImpl(name='%s.indx' % name)
async def _setRulrInfo(self, name, valu, gateiden=None): # pragma: no cover raise s_exc.NoSuchImpl(mesg='Subclass must implement _setRulrInfo')
async def _onRulesEdit(self, mesg): # pragma: no cover raise s_exc.NoSuchImpl(mesg='HiveIden subclasses must implement _onRulesEdit', name='_onRulesEdit')
async def execStormCmd(self, runt, genr): ''' Abstract base method ''' raise s_exc.NoSuchImpl('Subclass must implement execStormCmd') for item in genr: yield item
async def data_received(self, chunk): raise s_exc.NoSuchImpl( mesg='data_received must be implemented by subclasses.', name='data_received')
def _saveAuthData(self): # pragma: no cover raise s_exc.NoSuchImpl( name='_saveAuthData', mesg='_saveAuthData not implemented by AuthBase')
async def compute(self, path): raise s_exc.NoSuchImpl(name=f'{self.__class__.__name__}.compute()')
def getCondEval(self, runt): raise s_exc.NoSuchImpl(name=f'{self.__class__.__name__}.evaluate()')
def _flush(self): # pragma: no cover raise s_exc.NoSuchImpl(name='_flush')
def _resize(self, size): # pragma: no cover raise s_exc.NoSuchImpl(name='_resize')
def _writeoff(self, offs, byts): # pragma: no cover raise s_exc.NoSuchImpl(name='_writeoff')
def _readoff(self, offs, size): # pragma: no cover raise s_exc.NoSuchImpl(name='_readoff')
async def delete(self): # pragma: no cover raise s_exc.NoSuchImpl(mesg='GateRuler subclasses must implement delete')