Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 34k
Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement
Description
Argument name was replaced from package to anchor for Python 3.12.0a4 in PR #100598, and comment to remove this compatibility was added separately in PR #117054, both by @jaraco.
Looks like it was missed so I suggest to remove this compatibility.
Docs: https://docs.python.org/dev/library/importlib.resources.html#importlib.resources.files
Source:
cpython/Lib/importlib/resources/_common.py
Lines 19 to 56 in 5a7f5ea
| defpackage_to_anchor(func): | |
| """ | |
| Replace 'package' parameter as 'anchor' and warn about the change. | |
| Other errors should fall through. | |
| >>> files('a', 'b') | |
| Traceback (most recent call last): | |
| TypeError: files() takes from 0 to 1 positional arguments but 2 were given | |
| Remove this compatibility in Python 3.14. | |
| """ | |
| undefined=object() | |
| @functools.wraps(func) | |
| defwrapper(anchor=undefined, package=undefined): | |
| ifpackageisnotundefined: | |
| ifanchorisnotundefined: | |
| returnfunc(anchor, package) | |
| warnings.warn( | |
| "First parameter to files is renamed to 'anchor'", | |
| DeprecationWarning, | |
| stacklevel=2, | |
| ) | |
| returnfunc(package) | |
| elifanchorisundefined: | |
| returnfunc() | |
| returnfunc(anchor) | |
| returnwrapper | |
| @package_to_anchor | |
| deffiles(anchor: Optional[Anchor] =None) ->Traversable: | |
| """ | |
| Get a Traversable resource for an anchor. | |
| """ | |
| returnfrom_package(resolve(anchor)) |
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytopic-importlibtype-featureA feature request or enhancementA feature request or enhancement