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


Python XBRLParser.parseGAAP方法代码示例

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


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

示例1: test_parse_GAAP10Q_Ez_XBRL

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:62,代码来源:test_parse.py

示例2: XBRLParser

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
#! /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,代码行数:25,代码来源:excel.py

示例3: test_parse_GAAP10K_RRDonnelley

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:64,代码来源:test_parse.py

示例4: test_parse_GAAP10Q_QXInteractive

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:63,代码来源:test_parse.py

示例5: test_parse_GAAP10K_Fujitsu

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:67,代码来源:test_parse.py

示例6: test_parse_GAAP10Q_RRDonnelley

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:66,代码来源:test_parse.py

示例7: test_parse_GAAP10Q_Webfilings

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
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,代码行数:67,代码来源:test_parse.py

示例8: XBRLParser

# 需要导入模块: from xbrl import XBRLParser [as 别名]
# 或者: from xbrl.XBRLParser import parseGAAP [as 别名]
# encoding: utf-8

from __future__ import print_function

from xbrl import XBRLParser, GAAP, GAAPSerializer, DEISerializer

xbrl_parser = XBRLParser(0)

# Parse an incoming XBRL file
file_to_parse = "../tests/sam-20130629.xml"

xbrl = xbrl_parser.parse(file_to_parse)

# Parse just the GAAP data from the xbrl object
gaap_obj = xbrl_parser.parseGAAP(xbrl,
                                 doc_date="20131228",
                                 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)


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

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


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