示例#1
0
文件: cli.py 项目: rjammala/synapse
    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')
示例#2
0
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()
示例#3
0
文件: types.py 项目: neelsenc/synapse
 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)
示例#4
0
 async def _setRulrInfo(self,
                        name,
                        valu,
                        gateiden=None):  # pragma: no cover
     raise s_exc.NoSuchImpl(mesg='Subclass must implement _setRulrInfo')
示例#5
0
 async def _onRulesEdit(self, mesg):  # pragma: no cover
     raise s_exc.NoSuchImpl(mesg='HiveIden subclasses must implement _onRulesEdit',
                            name='_onRulesEdit')
示例#6
0
 async def execStormCmd(self, runt, genr):
     ''' Abstract base method '''
     raise s_exc.NoSuchImpl('Subclass must implement execStormCmd')
     for item in genr:
         yield item
示例#7
0
 async def data_received(self, chunk):
     raise s_exc.NoSuchImpl(
         mesg='data_received must be implemented by subclasses.',
         name='data_received')
示例#8
0
 def _saveAuthData(self):  # pragma: no cover
     raise s_exc.NoSuchImpl(
         name='_saveAuthData',
         mesg='_saveAuthData not implemented by AuthBase')
示例#9
0
文件: ast.py 项目: rjammala/synapse
 async def compute(self, path):
     raise s_exc.NoSuchImpl(name=f'{self.__class__.__name__}.compute()')
示例#10
0
文件: ast.py 项目: rjammala/synapse
 def getCondEval(self, runt):
     raise s_exc.NoSuchImpl(name=f'{self.__class__.__name__}.evaluate()')
示例#11
0
 def _flush(self):  # pragma: no cover
     raise s_exc.NoSuchImpl(name='_flush')
示例#12
0
 def _resize(self, size):  # pragma: no cover
     raise s_exc.NoSuchImpl(name='_resize')
示例#13
0
 def _writeoff(self, offs, byts):  # pragma: no cover
     raise s_exc.NoSuchImpl(name='_writeoff')
示例#14
0
 def _readoff(self, offs, size):  # pragma: no cover
     raise s_exc.NoSuchImpl(name='_readoff')
示例#15
0
 async def delete(self):  # pragma: no cover
     raise s_exc.NoSuchImpl(mesg='GateRuler subclasses must implement delete')