formate.imports

Converts import statements.

Classes:

CollectionsABCRewriter(source)

Identify deprecated from collections import <abc> imports, and rewrite them as from collections.abc import <abc>.

Functions:

rewrite_collections_abc_imports(source)

Identify deprecated from collections import <abc> imports, and rewrite them as from collections.abc import <abc>.

class CollectionsABCRewriter(source)[source]

Bases: Rewriter

Identify deprecated from collections import <abc> imports, and rewrite them as from collections.abc import <abc>.

Parameters

source (str) – The source to reformat.

rewrite_collections_abc_imports(source)[source]

Identify deprecated from collections import <abc> imports, and rewrite them as from collections.abc import <abc>.

Parameters

source (str) – The source to reformat.

Return type

str

Returns

The reformatted source.