當前位置: 首頁>>代碼示例>>Python>>正文


Python DCC.print_locations方法代碼示例

本文整理匯總了Python中DCC.print_locations方法的典型用法代碼示例。如果您正苦於以下問題:Python DCC.print_locations方法的具體用法?Python DCC.print_locations怎麽用?Python DCC.print_locations使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DCC的用法示例。


在下文中一共展示了DCC.print_locations方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: gen_ss_cid

# 需要導入模塊: import DCC [as 別名]
# 或者: from DCC import print_locations [as 別名]
def gen_ss_cid(s, dl):
    # Spreadsheet dataset will be a list of lists
    ss = []
    for d in dl:
        ssrow = []
        print("trying", d)
        if 'Document-' in d:
            # CID link is to a document Handle
            doc = DCC.prop_get(s,d,InfoSet = 'DocBasic')
            doc['Versions'] = DCC.prop_get(s,d,InfoSet = 'Versions')
            # Now read preferred version
            prefver = DCC.prop_get(s,doc['Versions']['prefver'],InfoSet = 'VerAll')
            # Check how many places the document is located
            doc['locations'] = DCC.prop_get(s,d,InfoSet = 'Parents')
            # Subject Document
            ssrow.append(doc['handle'])
            ssrow.append(doc['title'])
            ssrow.append(doc['tmtnum'])
            ssrow.append(doc['owner-username'])  
            # Evaluation of current reference
            ssrow.append('Doc Ref')             
            # Current reference
            ssrow.append(doc['handle'])
            ssrow.append(doc['title'])
            ssrow.append(doc['owner-username'])   
            ssrow.append(doc['date'])
            # Suggested reference
            ssrow.append(prefver['dccver'])
            ssrow.append(prefver['vercomment'])
            ssrow.append(prefver['owner-username'])
            ssrow.append(prefver['date'])            
            DCC.print_doc_basic(doc)
            DCC.print_ver(prefver)
            DCC.print_locations(doc)
            print(doc['handle'], doc['title'], doc['tmtnum'], doc['owner-username'])
            print("Doc Ref")
            print(prefver['dccver'], prefver['vercomment'], prefver['owner-username'], prefver['date'])
            print('Document has %d locations' % len(doc['locations']))

        elif 'Version-' in d:
            # CID link is to a version handle
            ver = DCC.prop_get(s,d,InfoSet = 'VerAll')
            doc = DCC.prop_get(s,ver['dccdoc'],InfoSet = 'DocBasic')
            # Subject Document
            ssrow.append(doc['handle'])
            ssrow.append(doc['title'])
            ssrow.append(doc['tmtnum'])
            ssrow.append(doc['owner-username'])  
            # find info on the preferred version
            prefver = DCC.prop_get(s,doc['prefver'],InfoSet = 'VerAll')
            # Evaluation of current reference          
            print("CID references Version")
            print(doc['handle'], doc['title'], doc['tmtnum'])
            print("Referenced Version")
            print(ver['dccver'], ver['vercomment'], ver['owner-username'], ver['date'])
            if prefver['dccver'] == ver['dccver']:
                print("Referenced Version IS the Preferred Version")
                # Evaluation of current reference
                ssrow.append('Pref. Ver.') 
                DCC.print_doc_all(doc)
                DCC.print_ver(prefver)
                # Current reference
                ssrow.append(prefver['dccver'])
                ssrow.append(prefver['vercomment'])
                ssrow.append(prefver['owner-username'])
                ssrow.append(prefver['date'])  
            else:
                print("Referenced Version IS NOT the Preferred Version") 
                # Evaluation of current reference
                ssrow.append('Non-Pref. Ver.') 
                print("Non-Preferred Version")
                print(prefver['dccver'], prefver['vercomment'], prefver['owner-username'], prefver['date'])    
                DCC.print_doc_all(doc)
                DCC.print_ver(ver)  
                DCC.print_ver(prefver) 
                # Current reference
                ssrow.append(ver['dccver'])
                ssrow.append(ver['vercomment'])
                ssrow.append(ver['owner-username'])
                ssrow.append(ver['date']) 
            # Suggested reference
            ssrow.append(prefver['dccver'])
            ssrow.append(prefver['vercomment'])
            ssrow.append(prefver['owner-username'])
            ssrow.append(prefver['date'])           
        else:
            print("Don't know how to handle", d)
            sys.exit()  
        ss.append(ssrow)
    return(ss)
開發者ID:gtrancho,項目名稱:Library,代碼行數:92,代碼來源:CID.py


注:本文中的DCC.print_locations方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。