def label_serializer(serializer): filing = serializer.filing date = filing.date company = filing.company nsmap = gen_nsmap(filing, 'Label') maker = ElementMaker(nsmap=nsmap) with xml_namespace(maker, 'link', auto_convert=True) as maker: linkbase = maker.linkbase( **{ #find out about this 'xsi:schemaLocation': 'http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd' }) labellink = maker.labelLink( **{ 'xlink:type': 'extended', 'xlink:role': 'http://www.xbrl.org/2003/role/link', }) locs = set([]) for (fact, unit), context, data in filing.data_stream: if fact.href not in locs: labellink.append(make_loc(fact, maker, namespace='link')) locs.add(fact.href) facts = set([]) for (fact, unit), context, data in filing.data_stream: if (fact, unit) in facts: continue facts.add((fact, unit)) utitle = 'label_{0}_{1}'.format(fact.title, uid()) labellink.append(make_label(fact, maker, utitle, namespace='link')) labellink.append( make_labelArc(fact, maker, utitle, namespace='link')) linkbase.append(labellink) return linkbase
def label_serializer(serializer): filing = serializer.filing date = filing.date company = filing.company nsmap = gen_nsmap(filing, 'Label') maker = ElementMaker(nsmap=nsmap) with xml_namespace(maker, 'link', auto_convert=True) as maker: linkbase = maker.linkbase(**{ #find out about this 'xsi:schemaLocation': 'http://www.xbrl.org/2003/linkbase http://www.xbrl.org/2003/xbrl-linkbase-2003-12-31.xsd' }) labellink = maker.labelLink(**{ 'xlink:type': 'extended', 'xlink:role': 'http://www.xbrl.org/2003/role/link', }) locs = set([]) for (fact, unit), context, data in filing.data_stream: if fact.href not in locs: labellink.append(make_loc(fact, maker, namespace='link')) locs.add(fact.href) facts = set([]) for (fact, unit), context, data in filing.data_stream: if (fact, unit) in facts: continue facts.add((fact, unit)) utitle = 'label_{0}_{1}'.format(fact.title, uid()) labellink.append(make_label(fact, maker, utitle, namespace='link')) labellink.append(make_labelArc(fact, maker, utitle, namespace='link')) linkbase.append(labellink) return linkbase
def title(self): return uid()
def href(self): return uid()
def label_text(self): return uid()
def label(self): return uid()
def id(self): return uid()