How to use the ganga.GangaCore.GPIDev.Schema.Schema.SimpleItem function in ganga

To help you get started, we’ve selected a few ganga 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 ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
# end of emulating code
    # allSchemas.add(schema)

    assert(schema.name == 'Job')
    assert(schema.category == 'jobs')

    assert(schema.allItems() == list(dd.items()))

    cc = (schema.componentItems() + schema.simpleItems()).sort()
    cc2 = list(dd.items()).sort()
    assert(cc == cc2)

    for i in schema.allItems():
        assert(schema[i[0]] == schema.getItem(i[0]))

    assert(schema['id'].isA(SimpleItem))
    assert(schema['application'].isA(ComponentItem))
    assert(schema['inputbox'].isA(ComponentItem))
    assert(schema['inputbox'].isA(FileItem))

    assert(schema['id']['protected'])
    assert(not schema['id']['comparable'])
    assert(schema['id']['type'] == 'string')

    logger.info(schema['application']['category'] + ' ' + schema['application']['defvalue'])

    schema2 = copy.deepcopy(schema)

    assert(schema2 is not schema)
    assert(schema.datadict is not schema2.datadict)
    assert(schema._pluginclass is schema2._pluginclass)
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
def _describe(self):
        return "'gangafiles' object," + Item._describe(self)


if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
    schema._pluginclass = pclass
    # end of emulating code
    # allSchemas.add(schema)
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
super(GangaFileItem, self).__init__('gangafiles')
        self._update(kwds)

    def _describe(self):
        return "'gangafiles' object," + Item._describe(self)


if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
    schema._pluginclass = pclass
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
self._update(kwds)

    def _describe(self):
        return "'gangafiles' object," + Item._describe(self)


if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
    schema._pluginclass = pclass
    # end of emulating code
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
def __init__(self, **kwds):
        super(GangaFileItem, self).__init__('gangafiles')
        self._update(kwds)

    def _describe(self):
        return "'gangafiles' object," + Item._describe(self)


if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
def __init__(self, defvalue, typelist=defaultValue, **kwds):
        super(SimpleItem, self).__init__()
        if typelist == defaultValue:
            if type(defvalue) == dict:
                typelist = []
            else:
                typelist = [type(defvalue)]
        kwds['defvalue'] = defvalue
        kwds['typelist'] = typelist
        self._update(kwds)
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
    schema._pluginclass = pclass
    # end of emulating code
    # allSchemas.add(schema)

    assert(schema.name == 'Job')
    assert(schema.category == 'jobs')
github ganga-devs / ganga / ganga / GangaCore / GPIDev / Schema / Schema.py View on Github external
if __name__ == '__main__':

    # a simple test

    dd = {
        'application': ComponentItem(category='applications'),
        'backend':     ComponentItem(category='backends'),
        'name':        SimpleItem('', comparable=0),
        'workdir':     SimpleItem(defvalue=None, type='string', transient=1, protected=1, comparable=0),
        'status':      SimpleItem(defvalue='new', protected=1, comparable=0),
        'id':           SimpleItem(defvalue=None, type='string', protected=1, comparable=0),
        'inputbox':     FileItem(defvalue=[], sequence=1),
        'outputbox':    FileItem(defvalue=[], sequence=1),
        'overriden_copyable': SimpleItem(defvalue=None, protected=1, copyable=1),
        'plain_copyable': SimpleItem(defvalue=None, copyable=0)
    }

    schema = Schema(Version(1, 0), dd)

    # NOT a public interface: emulate the Ganga Plugin object for test purposes
    # Note that pclass MUST be a new-style class in order to support deepcopy
    class pclass(object):
        _category = 'jobs'
        _name = 'Job'
    schema._pluginclass = pclass
    # end of emulating code
    # allSchemas.add(schema)

    assert(schema.name == 'Job')
    assert(schema.category == 'jobs')