当前位置: 首页>>代码示例>>Python>>正文


Python GangaList.GangaList类代码示例

本文整理汇总了Python中Ganga.GPIDev.Lib.GangaList.GangaList.GangaList的典型用法代码示例。如果您正苦于以下问题:Python GangaList类的具体用法?Python GangaList怎么用?Python GangaList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了GangaList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: expandWildCards

def expandWildCards(filelist):
    """

    """
    l = GangaList()
    l.extend(iexpandWildCards(filelist))
    return l
开发者ID:mjmottram,项目名称:ganga,代码行数:7,代码来源:OutputFileManager.py

示例2: testPrintingGPIObjectList

    def testPrintingGPIObjectList(self):

        g = GangaList()
        for _ in range(10):
            g.append(self._makeRandomTFile())

        g_string = str(g)
        assert eval(g_string) == g, 'String should correctly eval'
开发者ID:VladimirRomanovsky,项目名称:ganga,代码行数:8,代码来源:TestMutableMethods.py

示例3: cloneVal

 def cloneVal(v):
     GangaList = _getGangaList()
     if isinstance(v, (list, tuple, GangaList)):
         new_v = GangaList()
         for elem in v:
             new_v.append(self.__cloneVal(elem, obj))
         return new_v
     else:
         return self.__cloneVal(v, obj)
开发者ID:rmatev,项目名称:ganga,代码行数:9,代码来源:Objects.py

示例4: testFullPrintingGPIObjectList

    def testFullPrintingGPIObjectList(self):

        g = GangaList()
        for _ in range(10):
            g.append(self._makeRandomTFile())
        g_string = str(g)

        import StringIO
        sio = StringIO.StringIO()
        full_print(g, sio)
        assert g_string == str(sio.getvalue()).rstrip(), 'Orphaned lists should full_print'
开发者ID:VladimirRomanovsky,项目名称:ganga,代码行数:11,代码来源:TestMutableMethods.py

示例5: getDiracFiles

def getDiracFiles():
    import os
    from GangaDirac.Lib.Files.DiracFile import DiracFile
    from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList
    filename = DiracFile.diracLFNBase().replace('/', '-') + '.lfns'
    logger.info('Creating list, this can take a while if you have a large number of SE files, please wait...')
    execute('dirac-dms-user-lfns &> /dev/null', shell=True, timeout=None)
    g = GangaList()
    with open(filename[1:], 'r') as lfnlist:
        lfnlist.seek(0)
        g.extend((DiracFile(lfn='%s' % lfn.strip()) for lfn in lfnlist.readlines()))
    return addProxy(g)
开发者ID:MannyMoo,项目名称:ganga,代码行数:12,代码来源:BOOT.py

示例6: setUp

    def setUp(self):
        self.ganga_list = GangaList()

        self.plain1 = [self._makeRandomTFile() for _ in range(15)]
        self.plain2 = [self._makeRandomTFile() for _ in range(10)]

        self.proxied1 = GangaList()
        self.proxied1.extend(self.plain1[:])
        self.proxied2 = GangaList()
        self.proxied2.extend(self.plain2[:])

        assert len(getProxyAttr(self.proxied1, '_list')) == len(self.plain1), 'Somthings wrong with construction 1'
        assert len(getProxyAttr(self.proxied2, '_list')) == len(self.plain2), 'Somthings wrong with construction 2'
开发者ID:rmatev,项目名称:ganga,代码行数:13,代码来源:TestGangaList.py

示例7: testPrintingPlainList

    def testPrintingPlainList(self):

        g = GangaList()
        l = []
        print('"'+str(g)+'"')
        print('"'+str(l)+'"')
        print(l == g)
        assert str(l) == str(g), 'Empty lists should print the same'

        for i in xrange(100):
            g.append(i)
            l.append(i)
        assert str(l) == str(g), 'Normal Python objects should print the same'
开发者ID:VladimirRomanovsky,项目名称:ganga,代码行数:13,代码来源:TestMutableMethods.py

示例8: _stripAttribute

 def _stripAttribute(obj, v, name):
     # just warn
     # print '**** checking',v,v.__class__,
     # isinstance(val,GPIProxyObject)
     if isinstance(v, list):
         from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList
         v_new = GangaList()
         for elem in v:
             v_new.append(elem)
         v = v_new
     if isinstance(v, GPIProxyObject) or hasattr(v, implRef):
         v = stripProxy(v)
         logger.debug('%s property: assigned a component object (%s used)' % (name, implRef))
     return stripProxy(obj)._attribute_filter__set__(name, v)
开发者ID:alexpearce,项目名称:ganga,代码行数:14,代码来源:Proxy.py

示例9: testCopy

    def testCopy(self):

        gl = GangaList()

        numberOfFiles = 100

        for _ in range(numberOfFiles):
            # add something which is generally not allowed by GangaList
            gl.append([self._makeRandomTFile()])

        assert len(gl) == numberOfFiles, 'Right number of files must be made'

        gl2 = copy.copy(gl)
        assert gl2 == gl, 'lists must be equal'
        assert gl2 is not gl, 'list must be copies'
开发者ID:mjmottram,项目名称:ganga,代码行数:15,代码来源:TestCopy.py

示例10: testDeepCopy

    def testDeepCopy(self):

        gl = GangaList()

        numberOfFiles = 100

        for _ in range(numberOfFiles):
            # add something which is generally not allowed by GangaList
            gl.append([self._makeRandomTFile()])

        assert len(gl) == numberOfFiles, "Right number of files must be made"

        gl2 = copy.deepcopy(gl)
        assert gl2 == gl, "lists must be equal"
        assert gl2 is not gl, "list must be copies"
        assert gl[0] is not gl2[0], "the references must be copied"
开发者ID:chrisburr,项目名称:ganga,代码行数:16,代码来源:TestCopy.py

示例11: __cloneVal

    def __cloneVal(self, v, obj):

        item = obj._schema[getName(self)]

        if v is None:
            if item.hasProperty('category'):
                assertion = item['optional'] and (item['category'] != 'internal')
            else:
                assertion = item['optional']
            #assert(assertion)
            if assertion is False:
                logger.warning("Item: '%s'. of class type: '%s'. Has a Default value of 'None' but is NOT optional!!!" % (getName(self), type(obj)))
                logger.warning("Please contact the developers and make sure this is updated!")
            return None
        elif isinstance(v, str):
            return str(v)
        elif isinstance(v, int):
            return int(v)
        elif isinstance(v, dict):
            new_dict = {}
            for key, item in new_dict.iteritems():
                new_dict[key] = self.__cloneVal(v, obj)
            return new_dict
        else:
            if not isinstance(v, Node) and isinstance(v, (list, tuple)):
                try:
                    GangaList = _getGangaList()
                    new_v = GangaList()
                except ImportError:
                    new_v = []
                for elem in v:
                    new_v.append(self.__cloneVal(elem, obj))
                #return new_v
            elif not isinstance(v, Node):
                if inspect.isclass(v):
                    new_v = v()
                else:
                    new_v = v
                if not isinstance(new_v, Node):
                    logger.error("v: %s" % str(v))
                    raise GangaException("Error: found Object: %s of type: %s expected an object inheriting from Node!" % (str(v), str(type(v))))
                else:
                    new_v = self.__copyNodeObject(new_v, obj)
            else:
                new_v = self.__copyNodeObject(v, obj)

            return new_v
开发者ID:rmatev,项目名称:ganga,代码行数:47,代码来源:Objects.py

示例12: testDeepCopy

    def testDeepCopy(self):

        from Ganga.GPIDev.Lib.GangaList.GangaList import GangaList
        gl = GangaList()

        numberOfFiles = 100

        for _ in range(numberOfFiles):
            # add something which is generally not allowed by GangaList
            gl.append([self._makeRandomTFile()])

        assert len(gl) == numberOfFiles, 'Right number of files must be made'

        gl2 = copy.deepcopy(gl)
        assert len(gl2) == len(gl), 'lists must be equal'
        assert gl2 is not gl, 'list must be copies'
        assert gl[0] is not gl2[0], 'the references must not be copied'
开发者ID:Erni1619,项目名称:ganga,代码行数:17,代码来源:TestCopy.py

示例13: setUp

    def setUp(self):
        super(TestGangaList, self).setUp()

        self.plain1 = [self._makeRandomTFile() for _ in range(15)]
        self.plain2 = [self._makeRandomTFile() for _ in range(10)]

        self.proxied1 = GangaList()
        self.proxied1.extend(self.plain1[:])
        self.proxied2 = GangaList()
        self.proxied2.extend(self.plain2[:])

        t = TFile()
        real_t = stripProxy(t)
        new_proxy_t = addProxy(real_t)
        #hopefully_t = stripProxy(new_proxy_t)
        #assert real_t is hopefully_t
        assert t is new_proxy_t

        self.assertEqual(len(getProxyAttr(self.proxied1, '_list')), len(self.plain1), "Something's wrong with construction")
        self.assertEqual(len(getProxyAttr(self.proxied2, '_list')), len(self.plain2), "Something's wrong with construction")
开发者ID:Erni1619,项目名称:ganga,代码行数:20,代码来源:TestGangaList.py

示例14: __init__

    def __init__(self, files=None, persistency=None, depth=0, fromRef=False):
        super(LHCbDataset, self).__init__()
        if files is None:
            files = []
        self.files = GangaList()
        process_files = True
        if fromRef:
            self.files._list.extend(files)
            process_files = False
        elif isinstance(files, GangaList):
            def isFileTest(_file):
                return isinstance(_file, IGangaFile)
            areFiles = all([isFileTest(f) for f in files._list])
            if areFiles:
                self.files._list.extend(files._list)
                process_files = False
        elif isinstance(files, LHCbDataset):
            self.files._list.extend(files.files._list)
            process_files = False

        if process_files:
            if isType(files, LHCbDataset):
                for this_file in files:
                    self.files.append(deepcopy(this_file))
            elif isType(files, IGangaFile):
                self.files.append(deepcopy(this_file))
            elif isType(files, (list, tuple, GangaList)):
                new_list = []
                for this_file in files:
                    if type(this_file) is str:
                        new_file = string_datafile_shortcut_lhcb(this_file, None)
                    elif isType(this_file, IGangaFile):
                        new_file = stripProxy(this_file)
                    else:
                        new_file = strToDataFile(this_file)
                    new_list.append(new_file)
                self.files.extend(new_list)
            elif type(files) is str:
                self.files.append(string_datafile_shortcut_lhcb(this_file, None), False)
            else:
                raise GangaException("Unknown object passed to LHCbDataset constructor!")

        self.files._setParent(self)

        logger.debug("Processed inputs, assigning files")

        # Feel free to turn this on again for debugging but it's potentially quite expensive
        #logger.debug( "Creating dataset with:\n%s" % self.files )
        
        logger.debug("Assigned files")

        self.persistency = persistency
        self.depth = depth
        logger.debug("Dataset Created")
开发者ID:ganga-devs,项目名称:ganga,代码行数:54,代码来源:LHCbDataset.py

示例15: __init__

    def __init__(self, files=None, persistency=None, depth=0):
        super(LHCbDataset, self).__init__()
        if files is None:
            files = []
        new_files = GangaList()
        if isType(files, LHCbDataset):
            for this_file in files:
                new_files.append(deepcopy(this_file))
        elif isType(files, IGangaFile):
            new_files.append(deepcopy(this_file))
        elif isType(files, (list, tuple, GangaList)):
            new_list = []
            for this_file in files:
                if type(this_file) is str:
                    new_file = string_datafile_shortcut_lhcb(this_file, None)
                elif isType(this_file, IGangaFile):
                    new_file = this_file
                else:
                    new_file = strToDataFile(this_file)
                new_list.append(stripProxy(new_file))
            stripProxy(new_files)._list = new_list
        elif type(files) is str:
            new_files.append(string_datafile_shortcut_lhcb(this_file, None), False)
        else:
            raise GangaException("Unknown object passed to LHCbDataset constructor!")
        new_files._setParent(self)

        logger.debug("Processed inputs, assigning files")

        # Feel free to turn this on again for debugging but it's potentially quite expensive
        #logger.debug( "Creating dataset with:\n%s" % files )
        self.files = new_files
        
        logger.debug("Assigned files")

        self.persistency = persistency
        self.depth = depth
        logger.debug("Dataset Created")
开发者ID:VladimirRomanovsky,项目名称:ganga,代码行数:38,代码来源:LHCbDataset.py


注:本文中的Ganga.GPIDev.Lib.GangaList.GangaList.GangaList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。