本文整理汇总了Python中arelle.XbrlUtil.sEqual方法的典型用法代码示例。如果您正苦于以下问题:Python XbrlUtil.sEqual方法的具体用法?Python XbrlUtil.sEqual怎么用?Python XbrlUtil.sEqual使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类arelle.XbrlUtil
的用法示例。
在下文中一共展示了XbrlUtil.sEqual方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: isEqualTo_
# 需要导入模块: from arelle import XbrlUtil [as 别名]
# 或者: from arelle.XbrlUtil import sEqual [as 别名]
def isEqualTo_(self, cntx2, dimensionalAspectModel):
"""(bool) -- If dimensionalAspectModel is absent, True is assumed.
False means comparing based on s-equality of segment, scenario, while
True means based on dimensional values and nonDimensional values separately."""
if cntx2 is None:
return False
if cntx2 == self: # same context
return True
if (self.periodHash != cntx2.periodHash or
self.entityIdentifierHash != cntx2.entityIdentifierHash):
return False
if dimensionalAspectModel:
if (self.dimsHash != cntx2.dimsHash or
self.nonDimHash != cntx2.nonDimHash):
return False
else:
if (self.segmentHash != cntx2.segmentHash or
self.scenarioHash != cntx2.scenarioHash):
return False
if self.periodHash != cntx2.periodHash or not self.isPeriodEqualTo(cntx2) or not self.isEntityIdentifierEqualTo(cntx2):
return False
if dimensionalAspectModel:
if _DICT_SET(self.qnameDims.keys()) != _DICT_SET(cntx2.qnameDims.keys()):
return False
for dimQname, ctx1Dim in self.qnameDims.items():
if not ctx1Dim.isEqualTo(cntx2.qnameDims[dimQname]):
return False
for nonDimVals1, nonDimVals2 in ((self.segNonDimValues,cntx2.segNonDimValues),
(self.scenNonDimValues,cntx2.scenNonDimValues)):
if len(nonDimVals1) != len(nonDimVals2):
return False
for i, nonDimVal1 in enumerate(nonDimVals1):
if not XbrlUtil.sEqual(self.modelXbrl, nonDimVal1, nonDimVals2[i]):
return False
else:
if self.hasSegment:
if not cntx2.hasSegment:
return False
if not XbrlUtil.sEqual(self.modelXbrl, self.segment, cntx2.segment):
return False
elif cntx2.hasSegment:
return False
if self.hasScenario:
if not cntx2.hasScenario:
return False
if not XbrlUtil.sEqual(self.modelXbrl, self.scenario, cntx2.scenario):
return False
elif cntx2.hasScenario:
return False
return True
示例2: isEqualTo_
# 需要导入模块: from arelle import XbrlUtil [as 别名]
# 或者: from arelle.XbrlUtil import sEqual [as 别名]
def isEqualTo_(self, cntx2, dimensionalAspectModel):
if cntx2 is None:
return False
if cntx2 == self: # same context
return True
if (self.periodHash != cntx2.periodHash or
self.entityIdentifierHash != cntx2.entityIdentifierHash):
return False
if dimensionalAspectModel:
if (self.dimsHash != cntx2.dimsHash or
self.nonDimHash != cntx2.nonDimHash):
return False
else:
if (self.segmentHash != cntx2.segmentHash or
self.scenarioHash != cntx2.scenarioHash):
return False
if self.periodHash != cntx2.periodHash or not self.isPeriodEqualTo(cntx2) or not self.isEntityIdentifierEqualTo(cntx2):
return False
if dimensionalAspectModel:
if self.qnameDims.keys() != cntx2.qnameDims.keys():
return False
for dimQname, ctx1Dim in self.qnameDims.items():
if not ctx1Dim.isEqualTo(cntx2.qnameDims[dimQname]):
return False
for nonDimVals1, nonDimVals2 in ((self.segNonDimValues,cntx2.segNonDimValues),
(self.scenNonDimValues,cntx2.scenNonDimValues)):
if len(nonDimVals1) != len(nonDimVals2):
return False
for i, nonDimVal1 in enumerate(nonDimVals1):
if not XbrlUtil.sEqual(self.modelXbrl, nonDimVal1, nonDimVals2[i]):
return False
else:
if self.hasSegment:
if not cntx2.hasSegment:
return False
if not XbrlUtil.sEqual(self.modelXbrl, self.segment, cntx2.segment):
return False
elif cntx2.hasSegment:
return False
if self.hasScenario:
if not cntx2.hasScenario:
return False
if not XbrlUtil.sEqual(self.modelXbrl, self.scenario, cntx2.scenario):
return False
elif cntx2.hasScenario:
return False
return True
示例3: s_equal_test
# 需要导入模块: from arelle import XbrlUtil [as 别名]
# 或者: from arelle.XbrlUtil import sEqual [as 别名]
def s_equal_test(node1, node2):
if (isinstance(node1, (ModelFact, ModelInlineFact)) and node1.isItem and
isinstance(node2, (ModelFact, ModelInlineFact)) and node2.isItem):
return (c_equal_test(node1, node2) and u_equal_test(node1, node2) and
XbrlUtil.xEqual(node1, node2) and
# must be validated (by xEqual) before precision tests to assure xAttributes is set
node1.xAttributes.get("precision") == node2.xAttributes.get("precision") and
node1.xAttributes.get("decimals") == node2.xAttributes.get("decimals"))
elif isinstance(node1, ModelObject):
if isinstance(node2, ModelObject):
return XbrlUtil.sEqual(node1.modelXbrl, node1, node2, excludeIDs=XbrlUtil.TOP_IDs_EXCLUDED, dts2=node2.modelXbrl)
else:
return False
elif isinstance(node1, ModelAttribute):
if isinstance(node2, ModelAttribute):
return node1.text == node2.text
return False