Skip to content

Commit

Permalink
Use Set from typing and improve var name
Browse files Browse the repository at this point in the history
  • Loading branch information
spolcyn committed Jun 20, 2024
1 parent 96ffc70 commit dee72ad
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions sec_edgar_downloader/_Downloader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from pathlib import Path
from typing import ClassVar, List, Optional
from typing import ClassVar, List, Optional, Set

from ._constants import DEFAULT_AFTER_DATE, DEFAULT_BEFORE_DATE
from ._constants import SUPPORTED_FORMS as _SUPPORTED_FORMS
Expand Down Expand Up @@ -67,7 +67,7 @@ def get(
before: Optional[Date] = None,
include_amends: bool = False,
download_details: bool = False,
skip_accession_numbers: Optional[set[str]] = None,
accession_numbers_to_skip: Optional[Set[str]] = None,
) -> int:
"""Download filings and save them to disk.
Expand All @@ -85,7 +85,7 @@ def get(
Defaults to False.
:param download_details: denotes whether to download human-readable and easily
parseable filing detail documents (e.g. form 4 XML, 8-K HTML). Defaults to False.
:param skip_accession_numbers: Set of accession numbers to skip when downloading.
:param accession_numbers_to_skip: Set of accession numbers to skip when downloading.
:return: number of filings downloaded.
Usage::
Expand Down Expand Up @@ -175,7 +175,7 @@ def get(
download_details,
# Save ticker if passed in to form file system path for saving filings
ticker=ticker_or_cik if not is_cik(ticker_or_cik) else None,
skip_accession_numbers=skip_accession_numbers,
accession_numbers_to_skip=accession_numbers_to_skip,
),
self.user_agent,
)
Expand Down
4 changes: 2 additions & 2 deletions sec_edgar_downloader/_orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ def get_to_download(cik: str, acc_num: str, doc: str) -> ToDownload:
def fetch_and_save_filings(download_metadata: DownloadMetadata, user_agent: str) -> int:
successfully_downloaded = 0
to_download = aggregate_filings_to_download(download_metadata, user_agent)
if download_metadata.skip_accession_numbers is not None:
to_download = [td for td in to_download if td.accession_number not in download_metadata.skip_accession_numbers]
if download_metadata.accession_numbers_to_skip is not None:
to_download = [td for td in to_download if td.accession_number not in download_metadata.accession_numbers_to_skip]

for td in to_download:
try:
Expand Down
2 changes: 1 addition & 1 deletion sec_edgar_downloader/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DownloadMetadata:
include_amends: bool = False
download_details: bool = False
ticker: Optional[str] = None
skip_accession_numbers: Optional[set[str]] = None
accession_numbers_to_skip: Optional[set[str]] = None


@dataclass
Expand Down

0 comments on commit dee72ad

Please sign in to comment.