backports — Python Backports#

This module contains backports to support older Python versions.

class backports.nullcontext(result=None)[source]#

Bases: object

Dummy context manager for Python 3.5/3.6 that does nothing.

Parameters:

result (Any) –

backports.pairwise(iterable)[source]#

Return successive overlapping pairs taken from the input iterable.

New in version 7.6.

backports.removeprefix(string, prefix)[source]#

Remove prefix from a string or return a copy otherwise.

New in version 5.4.

Parameters:
  • string (str) –

  • prefix (str) –

Return type:

str

backports.removesuffix(string, suffix)[source]#

Remove prefix from a string or return a copy otherwise.

New in version 5.4.

Parameters:
  • string (str) –

  • suffix (str) –

Return type:

str