Fixit ExtraΒΆ

Additional Fixit-derived rules that can be enabled separately.

Enable with:

enable = ["fixit-extra"]

Rule

Message

Python

Autofix

collapse-isinstance-checks

Multiple isinstance calls with the same target but different types can be collapsed into a single call with a tuple of types.

Any

No

deprecated-unittest-asserts

{deprecated} is deprecated; use {replacement} instead.

Any

Yes

no-inherit-from-object

Remove the redundant object base class.

Any

Yes

no-or-in-except

Use except (ValueError, TypeError):; except ValueError or TypeError: catches only ValueError.

Any

No

no-redundant-arguments-super

Call super() without arguments.

Any

No

no-redundant-f-string

Remove the f prefix; this f-string has no replacement fields.

Any

Yes

no-redundant-lambda

The lambda that wraps {function} is redundant and can be replaced by the callable.

Any

No

no-redundant-list-comprehension

Unnecessary list comprehension inside {func}(). Use a generator expression instead.

Any

No

no-string-type-annotation

Remove the quotes from this annotation; postponed evaluation is already enabled.

Any

Yes

replace-union-with-optional

Optional[T] is preferred over Union[T, None] or Union[None, T].

Any

No

use-assert-equal

Use assertEqual() or assertNotEqual() instead of wrapping an equality comparison in assertTrue().

Any

Yes

use-assert-in

Use assertIn() or assertNotIn() for membership checks.

Any

Yes

use-assert-is-not-none

Use assertIsNone() or assertIsNotNone() for None checks.

Any

Yes

use-async-sleep-in-async-def

Do not call blocking time.sleep inside async functions; use asyncio.sleep or an async runtime sleep.

Any

No

use-cls-in-classmethod

When using @classmethod, the first argument must be cls.

Any

Yes

use-collections-abc

Import abstract base classes from collections.abc.

>= 3.3

Yes

use-comprehension

Replace this {func}() call with the equivalent comprehension.

Any

No

use-eq-for-primitives

Use == or != for numeric and string values; is tests object identity.

Any

Yes

use-f-string

Use an f-string instead of % formatting or str.format().

Any

Yes

use-is-for-singletons

Compare None, True, and False with is or is not.

Any

Yes

use-literal

Replace this {func}() call with the equivalent collection literal.

Any

Yes