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


Python UrlUtil.ensureUrl方法代码示例

本文整理汇总了Python中arelle.UrlUtil.ensureUrl方法的典型用法代码示例。如果您正苦于以下问题:Python UrlUtil.ensureUrl方法的具体用法?Python UrlUtil.ensureUrl怎么用?Python UrlUtil.ensureUrl使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在arelle.UrlUtil的用法示例。


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

示例1: base_uri

# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import ensureUrl [as 别名]
def base_uri(xc, p, contextItem, args):
    item = anytypeArg(xc, args, 0, "node()?", missingArgFallback=contextItem)
    if item == (): 
        return ''
    if isinstance(item, (ModelObject, ModelDocument)):
        return UrlUtil.ensureUrl(item.modelDocument.uri)
    return ''
开发者ID:Arelle,项目名称:Arelle,代码行数:9,代码来源:FunctionFn.py

示例2: insertFiling

# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import ensureUrl [as 别名]
 def insertFiling(self, rssItem, g):
     self.showStatus("insert filing")
     # accession graph -> document vertices
     new_filing = {'documents': []}
     if self.modelXbrl.modelDocument.creationSoftwareComment:
         new_filing['creation_software'] = self.modelXbrl.modelDocument.creationSoftwareComment
     datetimeNow = datetime.datetime.now()
     datetimeNowStr = XmlUtil.dateunionValue(datetimeNow)
     entryUri = modelObjectDocumentUri(self.modelXbrl)
     if rssItem is not None:  # sec accession
         # set self.
         new_filing['filingType'] = "SEC filing"
         # for an RSS Feed entry from SEC, use rss item's accession information
         new_filing['filingNumber'] = filingNumber = rssItem.accessionNumber
         new_filing['acceptedTimestamp'] = XmlUtil.dateunionValue(rssItem.acceptanceDatetime)
         new_filing['filingDate'] = XmlUtil.dateunionValue(rssItem.filingDate)
         new_filing['entityId'] = rssItem.cikNumber
         new_filing['entityName'] = rssItem.companyName
         new_filing['SICCode'] = rssItem.assignedSic 
         new_filing['SECHtmlUrl'] = rssItem.htmlUrl 
         new_filing['entryUrl'] = rssItem.url
         self.filingURI = rssItem.htmlUrl
     else:
         # not an RSS Feed item, make up our own accession ID (the time in seconds of epoch)
         intNow = int(time.time())
         new_filing['filingNumber'] = filingNumber = str(intNow)
         self.filingId = int(time.time())    # only available if entered from an SEC filing
         new_filing['filingType'] = "independent filing"
         new_filing['acceptedTimestamp'] = datetimeNowStr
         new_filing['filingDate'] = datetimeNowStr
         new_filing['entryUrl'] = UrlUtil.ensureUrl(self.modelXbrl.fileSource.url)
         self.filingURI = filingNumber
         
     g[FILINGS][self.filingURI] = new_filing
     self.filing = new_filing
         
     # for now only one report per filing (but SEC may have multiple in future, such as form SD)
     self.reportURI = modelObjectDocumentUri(self.modelXbrl)
     self.report = {'filing': self.filingURI,
                    'aspectProxies': {},
                    'relationshipSets': {},
                    'dataPoints': {},
                    'messages': {}}
     new_filing['reports'] = {self.reportURI: self.report}
         
     # relationshipSets are a dts property
     self.relationshipSets = [(arcrole, ELR, linkqname, arcqname)
                              for arcrole, ELR, linkqname, arcqname in self.modelXbrl.baseSets.keys()
                              if ELR and (arcrole.startswith("XBRL-") or (linkqname and arcqname))]
开发者ID:Arelle,项目名称:Arelle,代码行数:51,代码来源:XbrlSemanticJsonDB.py

示例3: identifyPreexistingDocuments

# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import ensureUrl [as 别名]
 def identifyPreexistingDocuments(self):
     self.existingDocumentUris = set()
     if not self.isJsonFile:
         docFilters = []
         for modelDocument in self.modelXbrl.urlDocs.values():
             if modelDocument.type == Type.SCHEMA:
                 docFilters.append('STR(?doc) = "{}"'.format(UrlUtil.ensureUrl(modelDocument.uri)))
         results = self.execute(
             # TBD: fix up for Mongo DB query
             "select", 
             query="""
                 PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#>
                 PREFIX DTS: <http://xbrl.org/2013/rdf/DTS/>
                 SELECT distinct ?doc WHERE { ?doc rdf:type DTS:Document 
                 FILTER( """ + '\n|| '.join(docFilters) + ") .}")
         try:
             for result in results['results']['bindings']:
                 doc = result['doc']
                 if doc.get('type') == 'uri':
                     self.existingDocumentUris.add(doc['value'])                    
         except KeyError:
             pass # no existingDocumentUris
开发者ID:Arelle,项目名称:Arelle,代码行数:24,代码来源:XbrlSemanticJsonDB.py

示例4: modelObjectDocumentUri

# 需要导入模块: from arelle import UrlUtil [as 别名]
# 或者: from arelle.UrlUtil import ensureUrl [as 别名]
def modelObjectDocumentUri(modelObject):
    return UrlUtil.ensureUrl(modelObject.modelDocument.uri)
开发者ID:Arelle,项目名称:Arelle,代码行数:4,代码来源:XbrlSemanticJsonDB.py


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