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 27, 2024
1 parent a9f832b commit 8992b7a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion distutils/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@
in the distutils.command package.
"""

from __future__ import annotations

import logging
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 +48,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 8992b7a

Please sign in to comment.