Skip to content

Commit

Permalink
Fix Git_Cmd typing
Browse files Browse the repository at this point in the history
Git_Cmd is defined as List[Optional[str]] as to allow for lists
of str with potentially None values. However as lists are invariant,
mypy complains when a variable of type List[str] is passed with
the message `has incompatible type "list[str]";
expected "list[Optional[str]]"`. So Git_Cmd should also be defined
as List[str]
  • Loading branch information
adanaja committed Aug 13, 2024
1 parent 5d7f4e2 commit e572b27
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/e3/vcs/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,11 @@
from e3.vcs import VCSError

if TYPE_CHECKING:
from typing import (
Any,
Final,
IO,
Literal,
List,
Optional,
TextIO,
)
from typing import Any, Final, IO, Literal, Optional, TextIO, Union
from collections.abc import Iterator
from e3.os.process import Run, DEVNULL_VALUE, PIPE_VALUE

Git_Cmd = List[Optional[str]]
Git_Cmd = Union[list[str], list[Optional[str]]]
GIT_LOG_STREAM_VALUE = Literal[-4]

# Special value to direct outputs to the git log stream
Expand Down

0 comments on commit e572b27

Please sign in to comment.