-
Notifications
You must be signed in to change notification settings - Fork 15
Add config entry and CLI flag for overwrite on extraction #14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add config entry and CLI flag for overwrite on extraction #14
Conversation
Co-authored-by: gaulinmp <789400+gaulinmp@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@copilot Add a change to pyedgar.utilities.edgarweb.download_feed to make default arg for overwrite=None, and take config value on None. Also move config file value to [Paths] section, under CACHE_FEED, and call it CACHE_FEED_OVERWRITE.
|
Add a change to |
pyedgar/pyedgar.conf
Outdated
|
|
||
| ; OVERWRITE_ON_EXTRACT controls whether to overwrite existing filings when extracting from feeds | ||
| ; Default is False to avoid re-extracting already downloaded filings | ||
| OVERWRITE_ON_EXTRACT=False |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move config file value to [Paths] section, under CACHE_FEED, and call it CACHE_FEED_OVERWRITE. @copilot
gaulinmp
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add a change to pyedgar.utilities.edgarweb.download_feed to make default arg overwrite=None, and take config value on None. In pyedgar.conf, move config file value to [Paths] section, under CACHE_FEED, and call it CACHE_FEED_OVERWRITE . @copilot
…s] section; update download_feed to use config default Co-authored-by: gaulinmp <789400+gaulinmp@users.noreply.github.com>
Done in commit e8cfba2. Updated download_feed to have overwrite=None as default and use config.CACHE_FEED_OVERWRITE when None. Also moved config setting to [Paths] section and renamed to CACHE_FEED_OVERWRITE.
Done in commit e8cfba2. Updated download_feed function signature to overwrite=None and added logic to use config.CACHE_FEED_OVERWRITE when overwrite is None. |
Summary
Adds a configuration file setting and command-line flag to control whether existing filings are overwritten when extracting from daily feeds, addressing issue #13.
Changes
Configuration Setting
CACHE_FEED_OVERWRITEboolean setting to the[Paths]section of config files (positioned underCACHE_FEED)Falseto preserve existing behavior (skip already-extracted filings)CLI Flag
-o/--overwritecommand-line flagImplementation Details
The overwrite parameter flows through the entire extraction chain:
The extraction logic checks
if not overwrite and os.path.exists(nc_out_path)before writing files, ensuring proper behavior.Additionally,
pyedgar.utilities.edgarweb.download_feed()now hasoverwrite=Noneas the default parameter, automatically using theCACHE_FEED_OVERWRITEconfig setting whenNoneis passed.Usage Examples
Using config file:
Using CLI flag:
Use Cases
--overwriteto force re-extraction of specific date ranges--overwriteto repeatedly test with the same date rangeBackward Compatibility
✅ Fully backward compatible - existing code continues to work without changes. The default behavior (no overwriting) is preserved, and the feature is entirely opt-in.
Files Modified
pyedgar/config.py: Added config setting and documentation in [Paths] sectionpyedgar/__main__.py: Added CLI flag and parameter passingpyedgar/pyedgar.conf: Updated example config with new setting in [Paths] sectionpyedgar/utilities/edgarweb.py: Updateddownload_feed()to useoverwrite=Nonedefault and fallback to config settingTotal: 4 files modified
Fixes #13
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.