Example #1
0
def buildOpTestTable(dat: 'DAT', testTable: 'DAT'):
    dat.clear()
    dat.appendRow([
        'path',
        'testCount',
        'test1',
    ])
    testsByOpType = {}  # type: Dict[str, List[str]]
    for i in range(1, testTable.numRows):
        opType = str(testTable[i, 'opType'])
        name = str(testTable[i, 'filePath']).rsplit('/',
                                                    maxsplit=1)[1].replace(
                                                        '.tox', '')
        if not opType:
            continue
        elif opType not in testsByOpType:
            testsByOpType[opType] = [name]
        else:
            testsByOpType[opType].append(name)
    for rop in RaytkContext().allMasterOperators():
        opType = ROPInfo(rop).opType
        tests = testsByOpType.get(opType) or []
        tests.sort()
        dat.appendRow([
            rop.path,
            len(tests),
        ] + tests)
    for cell in dat.row(0)[2:]:
        cell.val = 'test' + str(cell.col - 1)
Example #2
0
def buildOpParamsTable(dat: 'DAT'):
    dat.clear()
    dat.appendRow(['path', 'kind'])
    for rop in RaytkContext().allMasterOperators():
        info = ROPInfo(rop)
        if not info:
            continue
        dat.appendRow([
            info.path,
            info.ropKind or '',
        ])
        for tuplet in info.rop.customTuplets:
            par = tuplet[0]
            if par.name in (
                    'Inspect', 'Help', 'Updateop') or par.name.startswith(
                        'Createref') or par.name.startswith('Creatersel'):
                continue
            cell = dat[info.path, par.tupletName]
            if cell is None:
                dat.appendCol([par.tupletName])
                cell = dat[info.path, par.tupletName]
            if par.isMenu:
                opts = ','.join(par.menuNames)
                cell.val = f'Menu: {opts}'
            else:
                cell.val = par.style
Example #3
0
 def buildInputTable(dat: 'DAT'):
     dat.clear()
     dat.appendRow(['name', 'label', 'handler', 'multi'])
     info = ROPInfo(ipar.inspectorCore.Targetcomp)
     if not info:
         return
     for handler in info.inputHandlers:
         inInfo = InputInfo(handler)
         dat.appendRow([
             inInfo.name,
             inInfo.label or '',
             handler.path,
             inInfo.multiHandler or '',
         ])
Example #4
0
def buildOpCurrentExpandedParamsTable(dat: 'DAT'):
    dat.clear()
    dat.appendRow(['path', 'expandedParams'])
    for rop in RaytkContext().allMasterOperators():
        info = ROPInfo(rop)
        if not info or not info.isROP:
            continue
        expanded = ' '.join([
            cell.val
            for cell in info.opDef.op('paramSpecTable').col('localName')[1:]
        ])
        dat.appendRow([
            info.path,
            expanded,
        ])
Example #5
0
def buildOpInfoTable(dat: 'DAT'):
    dat.clear()
    dat.appendRow([
        'path',
        'kind',
        'status',
        'hasHelp',
        'hasInputs',
        'hasSubRops',
        'Coordtype',
        'Returntype',
        'Contexttype',
    ] + _opDefParamNames + [
        'hasThumb',
        'paramPages',
    ])
    opThumbs = op('opThumbs')
    context = RaytkContext()
    for rop in context.allMasterOperators():
        info = ROPInfo(rop)
        if not info:
            continue
        helpDat = info.helpDAT
        if not helpDat:
            hasHelp = False
        elif '## Parameters' in helpDat.text or len(helpDat.text.split()) > 6:
            hasHelp = True
        else:
            hasHelp = False
        dat.appendRow([
            rop.path,
            info.ropKind or '',
            info.statusLabel or 'stable',
            hasHelp,
            info.hasROPInputs,
            bool(info.subROPs),
        ])
        typeSpec = info.typeSpec
        if typeSpec:
            types = typeSpec.op('supportedTypes')
            dat[rop.path, 'Coordtype'] = types['coordType', 'spec']
            dat[rop.path, 'Contexttype'] = types['contextType', 'spec']
            dat[rop.path, 'Returntype'] = types['returnType', 'spec']
        for pn in _opDefParamNames:
            dat[rop.path, pn] = _formatPar(info.opDefPar[pn])
        dat[rop.path, 'hasThumb'] = bool(opThumbs[rop.path, 'thumb'])
        dat[rop.path,
            'paramPages'] = ' '.join([page.name for page in rop.customPages])
Example #6
0
def buildOpInputsTable(dat: 'DAT'):
    dat.clear()
    parNames = [
        'Source',
        'Label',
        'Localalias',
        'Variables',
        'Variableinputs',
        'Help',
    ]
    dat.appendRow([
        'path',
        'index',
        'handler',
        'name',
        'label',
        'required',
        'multi',
        'coordTypes',
        'contextTypes',
        'returnTypes',
        'hasExprs',
    ] + parNames)
    for rop in RaytkContext().allMasterOperators():
        info = ROPInfo(rop)
        if not info:
            continue
        for i, handler in enumerate(info.inputHandlers):
            inInfo = InputInfo(handler)
            dat.appendRow([
                rop.path,
                i + 1,
                handler.name,
                inInfo.name or '',
                inInfo.label or '',
                _formatPar(inInfo.handlerPar.Required),
                bool(inInfo.multiHandler),
                ' '.join(inInfo.supportedCoordTypes),
                ' '.join(inInfo.supportedContextTypes),
                ' '.join(inInfo.supportedReturnTypes),
                any([p.mode != ParMode.CONSTANT for p in handler.customPars]),
            ] + [
                _formatPar(inInfo.handlerPar[parName]) for parName in parNames
            ])
Example #7
0
def buildOpVariablesTable(dat: 'DAT'):
    dat.clear()
    dat.appendRow(['path'])
    for rop in RaytkContext().allMasterOperators():
        info = ROPInfo(rop)
        if not info.isROP:
            continue
        varTable = info.opDefPar.Variabletable.eval()
        if varTable and isinstance(varTable, evaluateDAT):
            varTable = varTable.inputs[0]
        if not varTable:
            continue
        dat.appendRow([info.path])
        for i in range(1, varTable.numRows):
            name = varTable[i, 'name'] or varTable[i, 0]
            dataType = varTable[i, 'dataType'] or varTable[i, 2]
            cell = dat[info.path, name]
            if cell is None:
                dat.appendCol([name])
                cell = dat[info.path, name]
            cell.val = dataType
Example #8
0
 def ROPInfo(self):
     return ROPInfo(self.ROP)