当前位置: 首页>>代码示例>>Python>>正文


Python xbrl.XBRLParser类代码示例

本文整理汇总了Python中xbrl.XBRLParser的典型用法代码示例。如果您正苦于以下问题:Python XBRLParser类的具体用法?Python XBRLParser怎么用?Python XBRLParser使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了XBRLParser类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_parse_GAAP10Q_Ez_XBRL

def test_parse_GAAP10Q_Ez_XBRL():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/ggho-20140930.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "10-Q", "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 34273.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 127.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 0.0
    assert result.data['non_current_assets'] == -1078.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == -7593.0
    assert result.data['liabilities_and_equity'] == 79451.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 0.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 13026.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 30543.0
    assert result.data['net_income_loss'] == -8642.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 0.0
    assert result.data['equity_attributable_interest'] == 309.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 0.0
    assert result.data['income_before_equity_investments'] == -8531.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 1078.0
    assert result.data['gross_profit'] == 5433.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 0.0
    assert result.data['interest_and_debt_expense'] == 0.0
开发者ID:deberon,项目名称:python-xbrl,代码行数:60,代码来源:test_parse.py

示例2: test_open_file_handle

def test_open_file_handle():
    xbrl_parser = XBRLParser()
    file_to_parse = "tests/sam-20130629.xml"
    try:
        xbrl_parser.parse(file(file_to_parse))
    except NameError:
        pass
开发者ID:deberon,项目名称:python-xbrl,代码行数:7,代码来源:test_parse.py

示例3: test_parse_Custom10Q_RRDonnelley

def test_parse_Custom10Q_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20130629.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    custom_obj = xbrl_parser.parseCustom(xbrl)

    if six.PY3:

        result = len(custom_obj())

        assert result == 13

    if six.PY2 and not __pypy__:

        result = custom_obj()

        assert result[0] == ('conversionofclassbcommonstocktoclassacommonstockshares', '100000')
        assert result[1] == ('percentageofproductionvolumes', '0.90')
        assert result[2] == ('sharebasedcompensationarrangementbysharebasedpaymentawardoptionstovestineachtranche', '5000')
        assert result[3] == ('weightedaveragenumberofsharesoutstandingbasicincludingnonvestedparticipatingsecurities', '12866000')
        assert result[4] == ('incrementalcommonsharesattributabletoconversionofcommonstock', '4007000')
        assert result[5] == ('sharebasedcompensationarrangementbysharebasedpaymentawardinvestmentsharesweightedaveragegrantdat', '59.62')
        assert result[6] == ('incomeallocatedtoequityinstrumentsotherthanoptionnonvested', '7000')
        assert result[7] == ('netproceedsfromsaleofinvestmentshares', '531000')
        assert result[8] == ('weightedaveragenumberofbasicsharesoutstandingequityinstrumentsotherthanoptionnonvested', '94000')
        assert result[9] == ('sharebasedcompensationarrangementbysharebasedpaymentawardemployeeinvestmentsharespurchase', '12894')
        assert result[10] == ('provisionforreductionofdoubtfulaccounts', '-28000')
        assert result[11] == ('receiptofgovernmentgrantsforfacilitiesexpansion', '770000')
        assert result[12] == ('netincomelossallocatedtoequityinstrumentsotherthanoptionnonvested', '-143000')
开发者ID:greedo,项目名称:python-xbrl,代码行数:30,代码来源:test_parse.py

示例4: test_parse_DEI10Q_RRDonnelley

def test_parse_DEI10Q_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20130629.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    dei_obj = xbrl_parser.parseDEI(xbrl)

    serializer = DEISerializer()
    result = serializer.dump(dei_obj)

    assert result.data['trading_symbol'] == "SAM"
    assert result.data['company_name'] == "BOSTON BEER CO INC"
    assert result.data['shares_outstanding'] == 4007355.0
    assert result.data['public_float'] == 0.0
开发者ID:greedo,项目名称:python-xbrl,代码行数:14,代码来源:test_parse.py

示例5: parse_xbrl

    def parse_xbrl(self):
        # parse xbrl file
        with open(self.xbrl_filepath,'r',encoding='utf-8') as of:
            xbrl = XBRLParser.parse(of) # beautiful soup type object
        result_dicts = defaultdict(list)
        _idx = 0

        #print xbrl
        name_space = 'jp*'
        for node in xbrl.find_all(name=re.compile(name_space+':*')):
            if self.ignore_pattern(node):
                continue

            row_dict = defaultdict(list)
            #default tag
            row_dict['file_nm'] = self.xbrl_filepath.rsplit('\\' or '/', 1)[1]
            row_dict['element_id'] = node.name
            row_dict['amount'] = node.string

            #cutom tag
            for tag in custom_tag:
                row_dict[tag] = self.get_attrib_value(node,tag)

            result_dicts[_idx] = row_dict
            _idx += 1
        return result_dicts
开发者ID:NaoyaOura,项目名称:get-japan-ir-infomation,代码行数:26,代码来源:XMBLParser.py

示例6: get_facts_info

 def get_facts_info(self):
     """
     return(element_id, amount, context_ref, unit_ref, decimals)
     """
     # parse xbrl file
     xbrl = XBRLParser.parse(file(self.xbrl_filename)) # beautiful soup type object
     facts_dict = defaultdict(list)
     
     #print xbrl
     name_space = 'jp*'
     for node in xbrl.find_all(name=re.compile(name_space+':*')):
         if 'xsi:nil' in node.attrs:
             if node.attrs['xsi:nil']=='true':
                 continue
         
         facts_dict['element_id'].append( node.name.replace(':','_') )
         facts_dict['amount'].append( node.string )
         
         facts_dict['context_ref'].append(
                     self.get_attrib_value(node, 'contextref') )
         facts_dict['unit_ref'].append( 
                     self.get_attrib_value(node, 'unitref') )
         facts_dict['decimals'].append(
                     self.get_attrib_value(node, 'decimals') )
     return pd.DataFrame( facts_dict )
开发者ID:shimaXX,项目名称:workspace,代码行数:25,代码来源:operate_xbrl_file.py

示例7: XBRLParser

#! /usr/bin/env python
# encoding: utf-8

from xbrl import XBRLParser
from xbrl_middleware import ExcelDump, OpenPyxlAdapter

xbrl_parser = XBRLParser(precision=0)

# Parse an incoming XBRL file
xbrl = xbrl_parser.parse(file("sam-20130629.xml"))

# Parse just the GAAP data from the xbrl object
gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20130629",
                                 doc_type="10-Q",
                                 context="current",
                                 ignore_errors=0)

# Dump the GAAP data to XLSX (Excel)
xbrl_dump = ExcelDump(gaap_obj)
dumper = xbrl_middleware.OpenPyxlAdapter(xbrl_dump)
dumper.write('demo.xlsx')
dumper.dump()
开发者ID:spinbris,项目名称:python-xbrl-middleware,代码行数:23,代码来源:excel.py

示例8: XBRLParser

#! /usr/bin/env python
# encoding: utf-8

from __future__ import print_function

from xbrl import XBRLParser, GAAP, GAAPSerializer, DEISerializer

xbrl_parser = XBRLParser(precision=0)

# Parse an incoming XBRL file
xbrl = xbrl_parser.parse("../tests/sam-20130629.xml")

# Parse just the GAAP data from the xbrl object
gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20130629",
                                 context="current",
                                 ignore_errors=0)

# Serialize the GAAP data
serializer = GAAPSerializer()
result = serializer.dump(gaap_obj)

# Print out the serialized GAAP data
print(result)

# Parse just the DEI data from the xbrl object
dei_obj = xbrl_parser.parseDEI(xbrl)

# Serialize the DEI data
serializer = DEISerializer()
result = serializer.dump(dei_obj)
开发者ID:greedo,项目名称:python-xbrl,代码行数:31,代码来源:gaap.py

示例9: test_parse_GAAP10K_RRDonnelley

def test_parse_GAAP10K_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20131228.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "10-K", "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 104377.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 0.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 0.0
    assert result.data['non_current_assets'] == 9556.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == 29120.0
    assert result.data['liabilities_and_equity'] == 69900.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 0.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 0.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 302085.0
    assert result.data['net_income_loss'] == 18079.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 0.0
    assert result.data['equity_attributable_interest'] == 0.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 0.0
    assert result.data['income_before_equity_investments'] == 0.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 1050.0
    assert result.data['gross_profit'] == 104628.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 0.0
    assert result.data['interest_and_debt_expense'] == 0.0
    assert result.data['net_income_loss_noncontrolling'] == 0.0
    assert result.data['net_cash_flows_operating'] == 0.0
开发者ID:deberon,项目名称:python-xbrl,代码行数:62,代码来源:test_parse.py

示例10: test_parse_GAAP10Q_QXInteractive

def test_parse_GAAP10Q_QXInteractive():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/aaoi-20140630.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "10-Q", "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 5606.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 85.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 0.0
    assert result.data['non_current_assets'] == 978.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == 1730.0
    assert result.data['liabilities_and_equity'] == 153524.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 0.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 9458.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 111781.0
    assert result.data['net_income_loss'] == 1919.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 2058.0
    assert result.data['equity_attributable_interest'] == 0.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 2058.0
    assert result.data['income_before_equity_investments'] == 0.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 106114.0
    assert result.data['gross_profit'] == 11188.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 46431.0
    assert result.data['interest_and_debt_expense'] == 0.0
    assert result.data['net_income_loss_noncontrolling'] == 0.0
开发者ID:deberon,项目名称:python-xbrl,代码行数:61,代码来源:test_parse.py

示例11: test_parse_empty_file

def test_parse_empty_file():
    xbrl_parser = XBRLParser()
    file_to_parse = "tests/nothing.xml"
    with pytest.raises(XBRLParserException):
        xbrl_parser.parse(file_to_parse)
开发者ID:deberon,项目名称:python-xbrl,代码行数:5,代码来源:test_parse.py

示例12: test_parse_GAAP10K_Fujitsu

def test_parse_GAAP10K_Fujitsu():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/aaww-20131231.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 194292.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 0.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 0.0
    assert result.data['non_current_assets'] == 3124306.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == 0.0
    assert result.data['liabilities_and_equity'] == 3718259.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 4870.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 0.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 1317773.0
    assert result.data['net_income_loss'] == 0.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 0.0
    assert result.data['equity_attributable_interest'] == 4352.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 0.0
    assert result.data['income_before_equity_investments'] == 0.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 3718259.0
    assert result.data['gross_profit'] == 0.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 593953.0
    assert result.data['interest_and_debt_expense'] == 0.0
    assert result.data['net_income_loss_noncontrolling'] == 0.0
    assert result.data['net_cash_flows_operating'] == 0.0
    assert result.data['common_shares_outstanding'] == 0.0
    assert result.data['common_shares_issued'] == 0.0
    assert result.data['common_shares_authorized'] == 0.0
开发者ID:greedo,项目名称:python-xbrl,代码行数:65,代码来源:test_parse.py

示例13: test_parse_GAAP10Q_RRDonnelley

def test_parse_GAAP10Q_RRDonnelley():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/sam-20130629.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 98032.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 12107.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 0.0
    assert result.data['non_current_assets'] == 5417.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == 19715.0
    assert result.data['liabilities_and_equity'] == 60263.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 0.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 65084.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 253536.0
    assert result.data['net_income_loss'] == 19715.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 19715.0
    assert result.data['equity_attributable_interest'] == 0.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 19715.0
    assert result.data['income_before_equity_investments'] == 31822.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 376766.0
    assert result.data['gross_profit'] == 97132.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 138996.0
    assert result.data['interest_and_debt_expense'] == 0.0
    assert result.data['net_income_loss_noncontrolling'] == 0.0
    assert result.data['net_cash_flows_operating'] == 0.0
    assert result.data['common_shares_outstanding'] == 0.0
    assert result.data['common_shares_issued'] == 0.0
开发者ID:greedo,项目名称:python-xbrl,代码行数:64,代码来源:test_parse.py

示例14: test_parse_GAAP10Q_Webfilings

def test_parse_GAAP10Q_Webfilings():

    xbrl_parser = XBRLParser(0)
    file_to_parse = "tests/goog-20140630.xml"
    xbrl = xbrl_parser.parse(file_to_parse)
    gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                     str(file_to_parse
                                         .split("-")[1].split(".")[0][:4] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][4:6] +
                                         file_to_parse.split("-")[1]
                                         .split(".")[0][6:8]),
                                     "current")

    serializer = GAAPSerializer()
    result = serializer.dump(gaap_obj)

    assert result.data['liabilities'] == 3683.0
    assert result.data['net_cash_flows_financing_continuing'] == 0.0
    assert result.data['revenue'] == 0.0
    assert result.data['income_tax_expense_benefit'] == 913.0
    assert result.data['income_from_equity_investments'] == 0.0
    assert result.data['preferred_stock_dividends'] == 0.0
    assert result.data['redeemable_noncontrolling_interest'] == 0.0
    assert result.data['extraordary_items_gain_loss'] == 0.0
    assert result.data['temporary_equity'] == 0.0
    assert result.data['costs_and_expenses'] == 11697.0
    assert result.data['non_current_assets'] == 43703.0
    assert result.data['net_cash_flows_discontinued'] == 0.0
    assert result.data['income_loss'] == 3490.0
    assert result.data['liabilities_and_equity'] == 121608.0
    assert result.data['other_operating_income'] == 0.0
    assert result.data['operating_income_loss'] == 0.0
    assert result.data['net_income_parent'] == 0.0
    assert result.data['equity'] == 0.0
    assert result.data['net_cash_flows_operating_discontinued'] == 0.0
    assert result.data['cost_of_revenue'] == 0.0
    assert result.data['operating_expenses'] == 0.0
    assert result.data['noncurrent_liabilities'] == 0.0
    assert result.data['current_liabilities'] == 0.0
    assert result.data['net_cash_flows_investing'] == 0.0
    assert result.data['stockholders_equity'] == 95749.0
    assert result.data['net_income_loss'] == 3422.0
    assert result.data['net_cash_flows_investing_continuing'] == 0.0
    assert result.data['nonoperating_income_loss'] == 0.0
    assert result.data['net_cash_flows_financing'] == 0.0
    assert result.data['net_income_shareholders'] == 0.0
    assert result.data['comprehensive_income'] == 3579.0
    assert result.data['equity_attributable_interest'] == 0.0
    assert result.data['commitments_and_contingencies'] == 0.0
    assert result.data['comprehensive_income_parent'] == 3579.0
    assert result.data['income_before_equity_investments'] == 4403.0
    assert result.data['comprehensive_income_interest'] == 0.0
    assert result.data['other_comprehensive_income'] == 0.0
    assert result.data['equity_attributable_parent'] == 0.0
    assert result.data['assets'] == 121608.0
    assert result.data['gross_profit'] == 0.0
    assert result.data['net_cash_flows_operating_continuing'] == 0.0
    assert result.data['current_assets'] == 77905.0
    assert result.data['interest_and_debt_expense'] == 0.0
    assert result.data['net_income_loss_noncontrolling'] == 0.0
    assert result.data['net_cash_flows_operating'] == 0.0
    assert result.data['common_shares_outstanding'] == 0.0
    assert result.data['common_shares_issued'] == 0.0
    assert result.data['common_shares_authorized'] == 0.0
开发者ID:greedo,项目名称:python-xbrl,代码行数:65,代码来源:test_parse.py

示例15: XBRLParser

#! /usr/bin/env python
# encoding: utf-8

from __future__ import print_function

from xbrl import XBRLParser, GAAP, GAAPSerializer

xbrl_parser = XBRLParser(0)

# Parse an incoming XBRL file
xbrl = xbrl_parser.parse(file("tests/sam-20131228.xml"))

# Parse just the GAAP data from the xbrl object
gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20131228",
                                 doc_type="10-K",
                                 context="current",
                                 ignore_errors=0)

# Serialize the GAAP data
serializer = GAAPSerializer()
result = serializer.dump(gaap_obj)

# Print out the serialized GAAP data
print(result.data)
开发者ID:deberon,项目名称:python-xbrl,代码行数:25,代码来源:gaap.py


注:本文中的xbrl.XBRLParser类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。