コード例 #1
0
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
コード例 #2
0
ファイル: label.py プロジェクト: zeebo/xbrltpl
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
コード例 #3
0
 def title(self):
     return uid()
コード例 #4
0
 def href(self):
     return uid()
コード例 #5
0
 def label_text(self):
     return uid()
コード例 #6
0
 def label(self):
     return uid()
コード例 #7
0
 def id(self):
     return uid()
コード例 #8
0
ファイル: fact.py プロジェクト: zeebo/xbrltpl
	def title(self):
		return uid()
コード例 #9
0
ファイル: fact.py プロジェクト: zeebo/xbrltpl
	def href(self):
		return uid()
コード例 #10
0
ファイル: fact.py プロジェクト: zeebo/xbrltpl
	def label_text(self):
		return uid()
コード例 #11
0
ファイル: fact.py プロジェクト: zeebo/xbrltpl
	def label(self):
		return uid()
コード例 #12
0
ファイル: fact.py プロジェクト: zeebo/xbrltpl
	def id(self):
		return uid()