Skip to content

Commit

Permalink
Fixed small bug and docs for #143
Browse files Browse the repository at this point in the history
  • Loading branch information
manusimidt committed Aug 9, 2024
1 parent 5e18601 commit 6c04dbf
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions xbrl/instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@
"xbrldi": "http://xbrl.org/2006/xbrldi"
}

class AbstractMember:

class AbstractMember(abc.ABC):
def __init__(self, dimension: Concept) -> None:
self.dimension = dimension

Expand All @@ -53,10 +54,12 @@ def to_json(self):

class TypedMember(AbstractMember):
"""
Representation of an explicit member in xbrl.
Representation of a typed member in xbrl.
XML Example:
<xbrldi:explicitMember dimension="us-gaap:StatementBusinessSegmentsAxis">aapl:EuropeSegmentMember</xbrldi:explicitMember>
<xbrldi:typedMember dimension="us-gaap:RevenueRemainingPerformanceObligationExpectedTimingOfSatisfactionStartDateAxis">
<us-gaap:RevenueRemainingPerformanceObligationExpectedTimingOfSatisfactionStartDateAxis.domain>2024-06-30</us-gaap:RevenueRemainingPerformanceObligationExpectedTimingOfSatisfactionStartDateAxis.domain>
</xbrldi:typedMember>
"""
def __init__(self, dimension: Concept, domain: List[str]) -> None:
super().__init__(dimension)
Expand Down Expand Up @@ -251,7 +254,8 @@ def json(self, **kwargs) -> dict:
kwargs['dimensions']['contextId'] = self.context.xml_id
kwargs['dimensions']['period'] = period
for segment in self.context.segments:
kwargs['dimensions'][segment.dimension.name] = segment.member.name
if isinstance(segment, ExplicitMember):
kwargs['dimensions'][segment.dimension.name] = segment.member.name
return kwargs


Expand Down

0 comments on commit 6c04dbf

Please sign in to comment.