Repository navigation
feat!: remove the seven deprecated exception aliases (07lk.10) - #1573
Merged
Merged
Conversation
StatementNotFound, NoCompanyFactsFound, SECFilingNotFoundError, InvalidDateException, IdentityNotSetException, TooManyRequestsException and DataObjectException warned through every 5.x release since 5.48.0, where their canonical replacements in edgar.exceptions first shipped (checked against the v5.48.0 tag). This is the alias-removal half of the 07lk.10 window that PR #1557 left for a separate PR. - The module __getattr__ shims go from edgar.core, edgar.dates, edgar.entity, edgar.entity.core, edgar.entity.entity_facts, edgar.httprequests, edgar.sgml.sgml_parser and edgar.xbrl.exceptions, and the names leave every __all__ that listed them (three of those were already F822 undefined-name entries). DataObjectException, a subclass that took a Filing, leaves edgar/__init__.py and edgar.__all__. - edgar/_compat.py had no other user, and its message hard-codes "removed in v6.0", so it is deleted rather than left to mislabel a later deprecation. edgar.core's access-mode lookup becomes the module __getattr__ itself, one frame shallower, so its stacklevel returns to the settings default; the #1326 test that the warning blames the caller still passes. - MCP ERROR_SUGGESTIONS was keyed on three of the old names. classify_error indexed them by literal, but get_error_suggestions looks up type(e).__name__, which has been the canonical name since 5.48.0, so those three suggestion lists never matched there. Keys are now canonical. - The offerings eval matched transport failures by the old class names, which nothing has raised since 5.48.0; now the canonical names. - Docs: the error-handling guide and the upgrade guide say the names were removed and that importing one raises ImportError; the entity-facts reference, XBRL.md and the two package CLAUDE.md files use the new names. - Tests: the alias-resolves test becomes a removed-alias test (no attribute, not in __all__, `from m import X` raises ImportError, for every module that resolved it). The guide-names test now checks the "Names removed in 6.0" table the other way round: those seven must not resolve. hatch run test-fast: 42503 passed, 9 skipped, 1 xfailed. `from edgar import *` and every changed module import clean under -W error::DeprecationWarning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
6 of 8 tasks
1 of 6 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this changes
Removes the seven exception names that were deprecated throughout 5.x:
StatementNotFound,NoCompanyFactsFound,SECFilingNotFoundError,InvalidDateException,IdentityNotSetException,TooManyRequestsExceptionandDataObjectException. Importing one now raisesImportError. Their replacements inedgar.exceptionshave existed since 5.48.0. This finishes the alias-removal half of the 07lk.10 window, which #1557 left for a separate PR.__getattr__shims are removed fromedgar.core,edgar.dates,edgar.entity,edgar.entity.core,edgar.entity.entity_facts,edgar.httprequests,edgar.sgml.sgml_parserandedgar.xbrl.exceptions, and the names are taken out of every__all__that listed them. Three of those__all__entries were already flagged by ruff as undefined names (F822).DataObjectExceptionleavesedgar.__all__.edgar/_compat.pyis deleted. It had no other user, and its warning text hard-codes "removed in v6.0".edgar.core's access-mode lookup is now the module__getattr__itself, so its warning is one call level closer to the caller and itsstacklevelis the default again. The EDGAR_ACCESS_MODE is documented with a timeout/connection/retry table, but nothing in the package reads it #1326 test that the warning names the caller's code still passes.ERROR_SUGGESTIONSwas keyed on three of the old names.get_error_suggestions()looks errors up bytype(e).__name__, which hasn't matched those keys since 5.48.0, so those three suggestion lists were never returned there. The keys now use the canonical names.Part of #933 (the 6.0 exception hierarchy; that issue stays open for the CI job below).
Verification
docs/guides/error-handling.mdanddocs/upgrade/6.0.mdnow have a "Names removed in 6.0" table. The guide-names test checks that table in reverse: all seven must not resolve, and every other exception the guide names must. The entity-facts reference,edgar/xbrl/docs/XBRL.mdand the two packageCLAUDE.mdfiles use the new names.test_removed_alias_no_longer_resolvesasserts, for every module that used to resolve an old name, that it is no longer an attribute, no longer in__all__, and thatfrom module import NameraisesImportError.changelog.d/07lk10-aliases.removed.mdgit show v5.48.0:edgar/exceptions.py), which is what the guide's "switch before upgrading" advice relies on.hatch run test-fast: 42503 passed, 9 skipped, 1 xfailed.from edgar import *and every changed module import with no warnings under-W error::DeprecationWarning, and every remaining__all__entry resolves. Ruff finds no new pyflakes errors in the changed files and three fewer than main.6.0
docs/upgrade/6.0.mdsays what users see now (ImportError) and what to use instead.Not in this PR: removing the
test-strict-errorsjob from.github/workflows/python-hatch-workflow.yml. That edit needs a token with workflow scope, so the maintainer will make it.AI assistance
🤖 Generated with Claude Code