Skip to main content

Parsing and navigating XBRL documents

Project description


  • [ ] (P0) Parse XBRL instance documents
  • [ ] (P0) Parse XBRL linkbases
    • [ ] (P2) Calculation linkbase
    • [ ] (P2) Definition linkbase
    • [ ] (P1) Label linkbase
    • [ ] (P0) Presentation linkbase
  • [ ] (P0) Parse XBRL schemas


XBRL Instance


class XBRL(list):
    """An XBRL instance document"""


class Fact(dict):
        """An XBRL fact: concept, context, value"""


class Concept(dict):
    """An XBRL concept"""


class Context(dict):
    """An XBRL context: company, segment, period"""
class Period(dict):
    """An XBRL period: start date, end date"""


class Value(dict):
    """An XBRL value: amount, unit"""
class Unit(dict):
        """An XBRL unit"""

XBRL Linkbase


class Linkbase(list):
    """An XBRL linkbase"""
class CalculationLinkbase(Linkbase):
    """An XBRL calculation linkbase"""
class DefinitionLinkbase(Linkbase):
    """An XBRL definition linkbase"""
class LabelLinkbase(Linkbase):
    """An XBRL label linkbase"""
class PresentationLinkbase(Linkbase):
    """An XBRL Presentation linkbase"""


XBRL Instance

brka = XBRL(file='brka-20151231.xml')
brka = XBRL('BRKA', 2015)
brka = XBRL('BRKA', 2015, 'FY')
brka = XBRL(file='brka-20160331.xml')
brka = XBRL('BRKA', 2016, 'Q1')
facts = list(brka)
contexts = list(brka.contexts)
units = list(brka.units)

XBRL Linkbase

brka_cal = CalculationLinkbase(file='brka-20151231_cal.xml')
brka_cal = CalculationLinkbase('BRKA', 2015)
brka_cal = CalculationLinkbase('BRKA', 2015, 'FY')
brka_def = DefinitionLinkbase(file='brka-20151231_def.xml')
brka_def = DefinitionLinkbase('BRKA', 2015)
brka_def = DefinitionLinkbase('BRKA', 2015, 'FY')
brka_lab = LabelLinkbase(file='brka-20151231_lab.xml')
brka_lab = LabelLinkbase('BRKA', 2015)
brka_lab = LabelLinkbase('BRKA', 2015, 'FY')
brka_pre = PresentationLinkbase(file='brka-20151231_pre.xml')
brka_pre = PresentationLinkbase('BRKA', 2015)
brka_pre = PresentationLinkbase('BRKA', 2015, 'FY')

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for xbrl, version 0.0.0
Filename, size File type Python version Upload date Hashes
Filename, size xbrl-0.0.0-py3-none-any.whl (2.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size xbrl-0.0.0.tar.gz (3.7 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page