diff --git a/edgar/_filings.py b/edgar/_filings.py index bd482ba9..b758020e 100644 --- a/edgar/_filings.py +++ b/edgar/_filings.py @@ -33,8 +33,8 @@ from edgar._markdown import html_to_markdown, text_to_markdown from edgar._party import Address -from edgar._rich import df_to_rich_table, repr_rich -from edgar._xml import child_text +from edgar.richtools import df_to_rich_table, repr_rich +from edgar.xmltools import child_text from edgar.attachments import FilingHomepage, Attachment, Attachments, AttachmentServer from edgar.core import (log, display_size, sec_edgar, filter_by_date, diff --git a/edgar/_gaap.py b/edgar/_gaap.py deleted file mode 100644 index e876c32b..00000000 --- a/edgar/_gaap.py +++ /dev/null @@ -1,53 +0,0 @@ -from functools import lru_cache - -import pandas as pd - -from edgar.core import get_resource, Result - -data_dir = get_resource('data') - -__all__ = [ - 'Gaap', - 'get_gaap', - 'exists_in_gaap' -] - - -class Gaap: - """ - Contains information about GAAP - """ - - def __init__(self, - gaap_data: pd.DataFrame): - self.data = gaap_data - - @classmethod - def load(cls): - data = pd.read_csv(data_dir / 'GAAP_Taxonomy_2022.csv') - return Gaap(gaap_data=data) - - def __contains__(self, item: str): - parts = item.split(":") - if len(parts) == 2: - prefix, name = parts[0], parts[1] - return prefix in self.data.prefix.unique() and name in self.data.name.unique() - elif len(parts) == 1: - return item in self.data.prefix.unique() - - -def exists_in_gaap(prefix: str, name: str) -> bool: - """return True if the prefix and name exists in gaap""" - try: - gaap = Gaap.load() - gaap_item = f"{prefix}:{name}" - return Result.Ok(value=gaap_item in gaap) - except TypeError as err: - return Result.Fail(f"Cannot load the GAAP data .. error was {err}") - except FileNotFoundError as err: - return Result.Fail(f"Cannot load the GAAP data .. {err}") - - -@lru_cache(maxsize=2) -def get_gaap(): - return Gaap.load() diff --git a/edgar/_markdown.py b/edgar/_markdown.py index 28f0b65e..69af665c 100644 --- a/edgar/_markdown.py +++ b/edgar/_markdown.py @@ -6,7 +6,7 @@ from rich.panel import Panel from rich.table import Table -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.documents import HtmlDocument __all__ = [ diff --git a/edgar/_party.py b/edgar/_party.py index da06bd4b..4f8de57e 100644 --- a/edgar/_party.py +++ b/edgar/_party.py @@ -7,8 +7,8 @@ from rich.text import Text from rich.columns import Columns from pydantic import BaseModel -from edgar._rich import repr_rich -from edgar._xml import child_text, child_value +from edgar.richtools import repr_rich +from edgar.xmltools import child_text, child_value from edgar.core import IntString __all__ = [ diff --git a/edgar/attachments.py b/edgar/attachments.py index 207f3afd..28cbce19 100644 --- a/edgar/attachments.py +++ b/edgar/attachments.py @@ -22,7 +22,7 @@ from rich.table import Table, Column from rich.text import Text -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.core import sec_dot_gov, display_size, binary_extensions, text_extensions from edgar.httprequests import get_with_retry, download_file, download_file_async diff --git a/edgar/company_reports.py b/edgar/company_reports.py index 935bbe8b..e7488f6e 100644 --- a/edgar/company_reports.py +++ b/edgar/company_reports.py @@ -8,7 +8,7 @@ from edgar._filings import Attachments, Attachment from edgar._markdown import MarkdownContent -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.documents import HtmlDocument from edgar.financials import Financials from edgar.htmltools import ChunkedDocument, chunks2df, detect_decimal_items, adjust_for_empty_items diff --git a/edgar/documents.py b/edgar/documents.py index 96d40d22..a212e75d 100644 --- a/edgar/documents.py +++ b/edgar/documents.py @@ -8,7 +8,7 @@ from rich import box from rich.table import Table -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.datatools import table_html_to_dataframe, clean_column_text warnings.filterwarnings("ignore", category=XMLParsedAsHTMLWarning) diff --git a/edgar/effect.py b/edgar/effect.py index 9ca0aa5c..32c83d8f 100644 --- a/edgar/effect.py +++ b/edgar/effect.py @@ -6,8 +6,8 @@ from rich.console import Group, Text from edgar._party import Filer -from edgar._rich import repr_rich, df_to_rich_table -from edgar._xml import child_text +from edgar.richtools import repr_rich, df_to_rich_table +from edgar.xmltools import child_text __all__ = [ 'EffectiveData', diff --git a/edgar/entities.py b/edgar/entities.py index 20ecedfc..45968097 100644 --- a/edgar/entities.py +++ b/edgar/entities.py @@ -22,7 +22,7 @@ from rich.text import Text from edgar._filings import Filing, Filings, FilingsState -from edgar._rich import df_to_rich_table, repr_rich +from edgar.richtools import df_to_rich_table, repr_rich from edgar.core import (log, Result, display_size, filter_by_date, IntString, InvalidDateException, reverse_name, get_edgar_data_directory) from edgar.httprequests import download_json, download_text, download_bulk_data diff --git a/edgar/filingheader.py b/edgar/filingheader.py index 7494789b..869aad3f 100644 --- a/edgar/filingheader.py +++ b/edgar/filingheader.py @@ -8,7 +8,7 @@ from rich import box from rich.console import Group from edgar.reference import describe_form, states -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar._party import Address, get_addresses_as_columns from edgar.core import datefmt, reverse_name from datetime import datetime diff --git a/edgar/financials.py b/edgar/financials.py index a1b33361..95fedbb0 100644 --- a/edgar/financials.py +++ b/edgar/financials.py @@ -9,7 +9,7 @@ from rich.table import Table, Column from rich.text import Text -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.xbrl.presentation import FinancialStatementMapper, XBRLPresentation from edgar.xbrl.xbrldata import XBRLData, Statement diff --git a/edgar/form144.py b/edgar/form144.py index 6630b56c..d06ff5ca 100644 --- a/edgar/form144.py +++ b/edgar/form144.py @@ -12,8 +12,8 @@ from edgar.entities import Company from edgar._party import Address from edgar._party import Filer, Contact -from edgar._rich import repr_rich -from edgar._xml import child_text, child_texts +from edgar.richtools import repr_rich +from edgar.xmltools import child_text, child_texts __all__ = ['Form144', 'concat_securities_information', diff --git a/edgar/forms.py b/edgar/forms.py index 21661221..ada74f59 100644 --- a/edgar/forms.py +++ b/edgar/forms.py @@ -7,7 +7,7 @@ from rich.console import Group, Text from rich.markdown import Markdown -from edgar._rich import df_to_rich_table, repr_rich +from edgar.richtools import df_to_rich_table, repr_rich from edgar.core import sec_dot_gov from edgar.httprequests import download_file diff --git a/edgar/fundreports.py b/edgar/fundreports.py index ada17015..b46f591d 100644 --- a/edgar/fundreports.py +++ b/edgar/fundreports.py @@ -12,8 +12,8 @@ from rich.table import Table from edgar.reference import cusip_ticker_mapping -from edgar._rich import repr_rich, df_to_rich_table -from edgar._xml import find_element, child_text, optional_decimal +from edgar.richtools import repr_rich, df_to_rich_table +from edgar.xmltools import find_element, child_text, optional_decimal from edgar.core import moneyfmt, get_bool from edgar.funds import get_fund_information, FundSeriesAndContracts, Fund, get_fund diff --git a/edgar/funds.py b/edgar/funds.py index 92e31fc2..a7f96e4f 100644 --- a/edgar/funds.py +++ b/edgar/funds.py @@ -15,7 +15,7 @@ from edgar.entities import Company from edgar._filings import FilingHeader, Filings -from edgar._rich import repr_rich, df_to_rich_table +from edgar.richtools import repr_rich, df_to_rich_table from edgar.core import log from edgar.httprequests import download_text diff --git a/edgar/headers.py b/edgar/headers.py index f2678b3b..ec5a2134 100644 --- a/edgar/headers.py +++ b/edgar/headers.py @@ -12,7 +12,7 @@ from rich.text import Text from edgar._party import Address, get_addresses_as_columns -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.core import sec_dot_gov, display_size from edgar.httprequests import download_file from edgar.reference import describe_form diff --git a/edgar/htmltools.py b/edgar/htmltools.py index 2578ae9b..646ec4fb 100644 --- a/edgar/htmltools.py +++ b/edgar/htmltools.py @@ -11,7 +11,7 @@ from rich.panel import Panel from rich.table import Table -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.datatools import compress_dataframe from edgar.datatools import table_html_to_dataframe, dataframe_to_text from edgar.documents import HtmlDocument, Block, TableBlock diff --git a/edgar/legacy/_xbrl.py b/edgar/legacy/_xbrl.py index d24e6b01..05c334ed 100644 --- a/edgar/legacy/_xbrl.py +++ b/edgar/legacy/_xbrl.py @@ -10,8 +10,8 @@ from rich.panel import Panel from rich.text import Text -from edgar._rich import repr_rich, df_to_rich_table -from edgar._xml import child_text +from edgar.richtools import repr_rich, df_to_rich_table +from edgar.xmltools import child_text from edgar.core import log """ diff --git a/edgar/muniadvisors.py b/edgar/muniadvisors.py index f1ba3623..a9f48a7b 100644 --- a/edgar/muniadvisors.py +++ b/edgar/muniadvisors.py @@ -13,8 +13,8 @@ from edgar import Filing from edgar._party import Name, Address -from edgar._rich import repr_rich -from edgar._xml import child_text, child_texts, child_value +from edgar.richtools import repr_rich +from edgar.xmltools import child_text, child_texts, child_value __all__ = [ 'MunicipalAdvisorForm' diff --git a/edgar/offerings/formc.py b/edgar/offerings/formc.py index 54956f42..aa85f763 100644 --- a/edgar/offerings/formc.py +++ b/edgar/offerings/formc.py @@ -12,8 +12,8 @@ from rich.table import Table, Column from edgar._party import Address -from edgar._rich import repr_rich -from edgar._xml import child_text +from edgar.richtools import repr_rich +from edgar.xmltools import child_text from edgar.core import get_bool, yes_no from edgar.entities import Company from edgar.reference import states diff --git a/edgar/offerings/formd.py b/edgar/offerings/formd.py index b2f6ed92..3d083a09 100644 --- a/edgar/offerings/formd.py +++ b/edgar/offerings/formd.py @@ -10,8 +10,8 @@ from rich.table import Table from edgar._party import Issuer, Person, Address -from edgar._rich import repr_rich -from edgar._xml import child_text, child_value +from edgar.richtools import repr_rich +from edgar.xmltools import child_text, child_value __all__ = [ 'FormD', diff --git a/edgar/ownership/ownershipforms.py b/edgar/ownership/ownershipforms.py index 8e2379df..4ba244d3 100644 --- a/edgar/ownership/ownershipforms.py +++ b/edgar/ownership/ownershipforms.py @@ -22,8 +22,8 @@ from rich.table import Table, Column from edgar._party import Address -from edgar._rich import repr_rich, df_to_rich_table -from edgar._xml import (child_text, child_value) +from edgar.richtools import repr_rich, df_to_rich_table +from edgar.xmltools import (child_text, child_value) from edgar.core import IntString, get_bool, reverse_name, yes_no from edgar.datatools import convert_to_numeric from edgar.entities import Entity diff --git a/edgar/_rich.py b/edgar/richtools.py similarity index 100% rename from edgar/_rich.py rename to edgar/richtools.py diff --git a/edgar/search/textsearch.py b/edgar/search/textsearch.py index 5a59ef1e..0db4401c 100644 --- a/edgar/search/textsearch.py +++ b/edgar/search/textsearch.py @@ -8,7 +8,7 @@ from rich.panel import Panel from edgar._markdown import convert_table -from edgar._rich import repr_rich +from edgar.richtools import repr_rich PUNCTUATION = re.compile('[%s]' % re.escape(r"""!"#&'()*+,-/:;<=>?@[\]^`{|}~""")) diff --git a/edgar/thirteenf.py b/edgar/thirteenf.py index 19dde3de..eff54879 100644 --- a/edgar/thirteenf.py +++ b/edgar/thirteenf.py @@ -12,8 +12,8 @@ from rich.table import Table, Column from edgar._party import Address -from edgar._rich import repr_rich -from edgar._xml import find_element, child_text +from edgar.richtools import repr_rich +from edgar.xmltools import find_element, child_text from edgar.core import log from edgar.reference import cusip_ticker_mapping from edgar.sgml import stream_documents diff --git a/edgar/xbrl/dimensions.py b/edgar/xbrl/dimensions.py index 1f9e33db..3a05b8a0 100644 --- a/edgar/xbrl/dimensions.py +++ b/edgar/xbrl/dimensions.py @@ -5,7 +5,7 @@ import pandas as pd from rich.table import Table -from edgar._rich import repr_rich +from edgar.richtools import repr_rich __all__ = ['DimensionValue', 'Dimension', 'Dimensions', 'DimensionMetadata', 'DimensionAccessor'] diff --git a/edgar/xbrl/facts.py b/edgar/xbrl/facts.py index 896020dc..dfd47f46 100644 --- a/edgar/xbrl/facts.py +++ b/edgar/xbrl/facts.py @@ -9,7 +9,7 @@ from rich.table import Table, Column import hashlib -from edgar._rich import repr_rich +from edgar.richtools import repr_rich from edgar.xbrl.concepts import DEI_CONCEPTS from edgar.xbrl.dimensions import Dimensions from functools import lru_cache diff --git a/edgar/xbrl/presentation.py b/edgar/xbrl/presentation.py index a8f4cec7..b7602010 100644 --- a/edgar/xbrl/presentation.py +++ b/edgar/xbrl/presentation.py @@ -7,7 +7,7 @@ from rich import print as rprint from rich.tree import Tree -from edgar._rich import repr_rich +from edgar.richtools import repr_rich __all__ = ['XBRLPresentation', 'PresentationElement'] diff --git a/edgar/xbrl/xbrldata.py b/edgar/xbrl/xbrldata.py index 7bd8346d..76e43223 100644 --- a/edgar/xbrl/xbrldata.py +++ b/edgar/xbrl/xbrldata.py @@ -17,7 +17,7 @@ from rich.text import Text from rich.tree import Tree -from edgar._rich import repr_rich, colorize_words +from edgar.richtools import repr_rich, colorize_words from edgar.attachments import Attachments from edgar.core import log, split_camel_case, run_async_or_sync from edgar.httprequests import download_file_async diff --git a/edgar/_xml.py b/edgar/xmltools.py similarity index 100% rename from edgar/_xml.py rename to edgar/xmltools.py diff --git a/tests/test_core.py b/tests/test_core.py index c1404e44..46c53397 100644 --- a/tests/test_core.py +++ b/tests/test_core.py @@ -8,7 +8,7 @@ from rich.table import Table import edgar -from edgar._rich import * +from edgar.richtools import * from edgar.core import (decode_content, get_identity, set_identity, diff --git a/tests/test_xml.py b/tests/test_xml.py index b52d4490..56219c8b 100644 --- a/tests/test_xml.py +++ b/tests/test_xml.py @@ -1,6 +1,6 @@ from bs4 import BeautifulSoup from pathlib import Path -from edgar._xml import child_value, child_text, value_or_footnote, get_footnote_ids, value_with_footnotes, find_element, \ +from edgar.xmltools import child_value, child_text, value_or_footnote, get_footnote_ids, value_with_footnotes, find_element, \ optional_decimal from decimal import Decimal