Legacy API wrapper.
Project description
This module defines a decorator to wrap legacy APIs. The primary use case is APIs defined before keyword-only parameters existed.
>>> from legacy_api_wrap import legacy_api
We have a function with many positional parameters lying around:
>>> def fn(a, b=None, d=1, c=2): ... return c, d, e
We want to convert the positional parameters d and c to keyword-only, change their order and add a parameter. For this we only need to specify name and order of the old positional parameters in the decorator.
>>> @legacy_api('d', 'c')
... def fn(a, b=None, *, c=2, d=1, e=3):
... return c, d, e
After adding the decorator, users can keep calling the old API and get a DeprecationWarning:
>>> fn(12, 13, 14) == (2, 14, 3) True
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file legacy_api_wrap-1.5.tar.gz.
File metadata
- Download URL: legacy_api_wrap-1.5.tar.gz
- Upload date:
- Size: 11.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b41ba6532f3ebfe3a897a35a7f97dec3be04b92a450f6c2bcf89f1b91c9cadf2
|
|
| MD5 |
d23c5565b6c3f82fb25007d9fd231d38
|
|
| BLAKE2b-256 |
5849f06f94048c8974205730d40beca879e43b6eee08efb0101cfb8623e60f41
|
Provenance
The following attestation bundles were made for legacy_api_wrap-1.5.tar.gz:
Publisher:
publish.yml on flying-sheep/legacy-api-wrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
legacy_api_wrap-1.5.tar.gz -
Subject digest:
b41ba6532f3ebfe3a897a35a7f97dec3be04b92a450f6c2bcf89f1b91c9cadf2 - Sigstore transparency entry: 662485035
- Sigstore integration time:
-
Permalink:
flying-sheep/legacy-api-wrap@98e97018045635db5bbff502bf6b1a689d2801d7 -
Branch / Tag:
refs/tags/v1.5 - Owner: https://github.com/flying-sheep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98e97018045635db5bbff502bf6b1a689d2801d7 -
Trigger Event:
release
-
Statement type:
File details
Details for the file legacy_api_wrap-1.5-py3-none-any.whl.
File metadata
- Download URL: legacy_api_wrap-1.5-py3-none-any.whl
- Upload date:
- Size: 10.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a8ea50e3e3bcbcdec3447b77034fd0d32cb2cf4089db799238708e4d7e0098d
|
|
| MD5 |
d7368bbe14a958a6bbd9a30f119b96a2
|
|
| BLAKE2b-256 |
415b058db09c45ba58a7321bdf2294cae651b37d6fec68117265af90cde043b0
|
Provenance
The following attestation bundles were made for legacy_api_wrap-1.5-py3-none-any.whl:
Publisher:
publish.yml on flying-sheep/legacy-api-wrap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
legacy_api_wrap-1.5-py3-none-any.whl -
Subject digest:
5a8ea50e3e3bcbcdec3447b77034fd0d32cb2cf4089db799238708e4d7e0098d - Sigstore transparency entry: 662485054
- Sigstore integration time:
-
Permalink:
flying-sheep/legacy-api-wrap@98e97018045635db5bbff502bf6b1a689d2801d7 -
Branch / Tag:
refs/tags/v1.5 - Owner: https://github.com/flying-sheep
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@98e97018045635db5bbff502bf6b1a689d2801d7 -
Trigger Event:
release
-
Statement type: