From f09abd343f4d66d6659066c232bea93fbc6b2457 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elijas=20Dap=C5=A1auskas?= <4084885+Elijas@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:37:49 +0200 Subject: [PATCH 1/4] feat(example.py): refactor for clarity --- .devcontainer/example.py | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/.devcontainer/example.py b/.devcontainer/example.py index 14c2090..e1f1cf3 100644 --- a/.devcontainer/example.py +++ b/.devcontainer/example.py @@ -8,19 +8,23 @@ import sec_parser as sp +# Utility function to make the example code a bit more compact +def print_first_n_lines(text: str, *, n: int): + print("\n".join(text.split("\n")[:n]), "...", sep="\n") + + # Initialize the downloader with your company name and email dl = Downloader("MyCompanyName", "email@example.com") # Download the latest 10-Q filing for Apple html = dl.get_filing_html(ticker="AAPL", form="10-Q") - -# Utility function to make the example code a bit more compact -def print_first_n_lines(text: str, *, n: int): - print("\n".join(text.split("\n")[:n]), "...", sep="\n") - - +# Now, we can parse the filing HTML into a list of semantic elements: elements: list = sp.Edgar10QParser().parse(html) - demo_output: str = sp.render(elements) print_first_n_lines(demo_output, n=7) + +# We can also construct a semantic tree to allow for easy filtering by parent sections: +tree = sp.TreeBuilder().build(elements) +demo_output: str = sp.render(tree) +print_first_n_lines(demo_output, n=7) From 04384b206c6afc50775664aabc6eae4d8ccf3ec7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elijas=20Dap=C5=A1auskas?= <4084885+Elijas@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:38:54 +0200 Subject: [PATCH 2/4] docs(example.py): fix link formatting --- .devcontainer/example.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.devcontainer/example.py b/.devcontainer/example.py index e1f1cf3..073ae2c 100644 --- a/.devcontainer/example.py +++ b/.devcontainer/example.py @@ -1,8 +1,8 @@ # NOTE: # For more examples and advanced usage of `sec-parser`, refer to the following resources: -# - [User Guide](https://sec-parser.readthedocs.io/en/latest/notebooks/user_guide.html) -# - [Developer Guide](https://sec-parser.readthedocs.io/en/latest/notebooks/developer_guide.html) -# - [Documentation](https://sec-parser.rtfd.io) +# - User Guide: https://sec-parser.readthedocs.io/en/latest/notebooks/user_guide.html +# - Developer Guide: https://sec-parser.readthedocs.io/en/latest/notebooks/developer_guide.html +# - Documentation: https://sec-parser.rtfd.io from sec_downloader import Downloader From adcfa54257904e02272bad067328cf6c8d5b04d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elijas=20Dap=C5=A1auskas?= <4084885+Elijas@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:39:51 +0200 Subject: [PATCH 3/4] docs(example.py): improve link formatting with whitespace --- .devcontainer/example.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.devcontainer/example.py b/.devcontainer/example.py index 073ae2c..4efc1b7 100644 --- a/.devcontainer/example.py +++ b/.devcontainer/example.py @@ -1,8 +1,11 @@ # NOTE: # For more examples and advanced usage of `sec-parser`, refer to the following resources: -# - User Guide: https://sec-parser.readthedocs.io/en/latest/notebooks/user_guide.html -# - Developer Guide: https://sec-parser.readthedocs.io/en/latest/notebooks/developer_guide.html -# - Documentation: https://sec-parser.rtfd.io +# - User Guide: +# https://sec-parser.readthedocs.io/en/latest/notebooks/user_guide.html +# - Developer Guide +# https://sec-parser.readthedocs.io/en/latest/notebooks/developer_guide.html +# - Documentation: +# https://sec-parser.rtfd.io from sec_downloader import Downloader From 3502bb400d02a5d7f722406e19fa038fcc7df5ff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elijas=20Dap=C5=A1auskas?= <4084885+Elijas@users.noreply.github.com> Date: Fri, 22 Dec 2023 14:40:15 +0200 Subject: [PATCH 4/4] Update example.py --- .devcontainer/example.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.devcontainer/example.py b/.devcontainer/example.py index 4efc1b7..7074368 100644 --- a/.devcontainer/example.py +++ b/.devcontainer/example.py @@ -5,7 +5,7 @@ # - Developer Guide # https://sec-parser.readthedocs.io/en/latest/notebooks/developer_guide.html # - Documentation: -# https://sec-parser.rtfd.io +# https://sec-parser.readthedocs.io/en/latest/ from sec_downloader import Downloader