Skip to main content

No project description provided

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

legacy_api_wrap-1.4.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

legacy_api_wrap-1.4.1-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file legacy_api_wrap-1.4.1.tar.gz.

File metadata

  • Download URL: legacy_api_wrap-1.4.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for legacy_api_wrap-1.4.1.tar.gz
Algorithm Hash digest
SHA256 9c40d67aa8312fec8763e87cbf28fea4b67710c79ca7a18137b573d150f3b2b4
MD5 022c86706d5edce95e0a46ecefe5ed43
BLAKE2b-256 a407fbc3cf8cf3759c5f234af9d94761f09f41e6d0aa912b2a9dfda19a48855a

See more details on using hashes here.

Provenance

The following attestation bundles were made for legacy_api_wrap-1.4.1.tar.gz:

Publisher: publish.yml on flying-sheep/legacy-api-wrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file legacy_api_wrap-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for legacy_api_wrap-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8ba214242e836cebfd3b64c1a1653fce955abb0f9e4c7dffb51f2ad014def0eb
MD5 a59fb115936676fef3e2bebd8e3c2d61
BLAKE2b-256 3c1d9324c70629dfe4395f9122ab331cf245d3cce6ded851aa8a0a8ae264c4e6

See more details on using hashes here.

Provenance

The following attestation bundles were made for legacy_api_wrap-1.4.1-py3-none-any.whl:

Publisher: publish.yml on flying-sheep/legacy-api-wrap

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page