Skip to main content

A backport of recent additions to the 'collections.abc' module.

Project description

Usage:

import backports_abc
backports_abc.patch()

try:
    # ABCs live in "collections.abc" in Python >= 3.3
    from collections.abc import Coroutine, Generator
except ImportError:
    # fall back to import from "collections" in Python <= 3.2
    from collections import Coroutine, Generator

Currently provides the following names if missing:

  • collections.abc.Generator

  • collections.abc.Awaitable

  • collections.abc.Coroutine

  • inspect.isawaitable(obj)

In Python 2.x and Python 3.2, it patches the collections module instead of the collections.abc module. Any names that are already available when calling patch() will not be overwritten.

The names that were previously patched by patch() can be queried through the mapping in backports_abc.PATCHED.

Changelog

0.3 (2015-07-03)

  • removed patching of inspect.iscoroutine() as it is not ABC based

0.2 (2015-07-03)

  • require explicit backports_abc.patch() call to do the patching (avoids side-effects on import and allows future configuration)

  • provide access to patched names through global PATCHED dict

  • add ABC based implementations of inspect.iscoroutine() and inspect.isawaitable()

0.1 (2015-06-24)

  • initial public release

  • provided ABCs: Generator, Coroutine, Awaitable

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

backports_abc-0.3.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file backports_abc-0.3.tar.gz.

File metadata

  • Download URL: backports_abc-0.3.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for backports_abc-0.3.tar.gz
Algorithm Hash digest
SHA256 2ba6af05b05546c981c1dd00f648039c91972241580d1f4a05ee00559bd11b20
MD5 bbd286a88416d3eb7473aa070e95ce66
BLAKE2b-256 c35e09aefe42a2ef8126b2b5b27adefeb974bfae752bf5edc5c2c577129f148c

See more details on using hashes here.

Supported by

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