Skip to content

Commit

Permalink
docs(codespaces): improve readability
Browse files Browse the repository at this point in the history
  • Loading branch information
Elijas committed Dec 22, 2023
1 parent bf4e90e commit dd9f9f8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
20 changes: 10 additions & 10 deletions .devcontainer/example.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import sec_downloader as sd
from sec_downloader import Downloader

import sec_parser as sp

# Initialize the downloader with your company name and email
dl = sd.Downloader("MyCompanyName", "email@example.com")
dl = Downloader("MyCompanyName", "email@example.com")

# Download the latest 10-Q filing for Apple
html = dl.get_filing_html(ticker="AAPL", form="10-Q")

# Now, we can parse the filing HTML into a list of semantic elements:

# 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")


elements: list = sp.Edgar10QParser().parse(html)

# Let's print the first 5 elements:
for element in elements[:5]:
element_type = element.__class__.__name__
element_text = element.text
print(f"Element Type: {element_type}")
print(f"Text Content: {element_text}")
print("-" * 40) # Separator for readability
demo_output: str = sp.render(elements)
print_first_n_lines(demo_output, n=7)
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,9 @@ This project, `sec-parser`, is an independent, open-source initiative and has no

This guide will walk you through the process of installing the `sec-parser` package and using it to extract the "Segment Operating Performance" section as a semantic tree from the latest Apple 10-Q filing.

> [!TIP]
> To run the example code in a ready-to-code environment, you can use GitHub Codespaces. Click the button below to open the example code below in a codespace and start experimenting with `sec-parser`:
[![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](https://codespaces.new/alphanome-ai/sec-parser?devcontainer_path=.devcontainer/devcontainer.json)

## Installation
Expand Down

0 comments on commit dd9f9f8

Please sign in to comment.