Skip to content

Commit

Permalink
Type Command.sub_commands to avoid variance issues
Browse files Browse the repository at this point in the history
  • Loading branch information
Avasam committed Dec 26, 2024
1 parent a9f832b commit 0714711
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
import os
import re
import sys
from collections.abc import Callable
from typing import Any, ClassVar

from . import _modified, archive_util, dir_util, file_util, util
from ._log import log
Expand Down Expand Up @@ -44,7 +46,9 @@ class Command:
# 'sub_commands' is usually defined at the *end* of a class, because
# predicates can be unbound methods, so they must already have been
# defined. The canonical example is the "install" command.
sub_commands = []
sub_commands: ClassVar[ # Any to work around variance issues
list[tuple[str, Callable[[Any], bool] | None]]
] = []

# -- Creation/initialization methods -------------------------------

Expand Down

0 comments on commit 0714711

Please sign in to comment.