Skip to content

Commit c0e1e00

Browse files
Fix compatibility issues with typing in python versions < 3.11
Signed-off-by: Jacob Stopak <[email protected]>
1 parent d090f6b commit c0e1e00

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

git_sim/add.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
import sys
2-
32
import git
43
import manim as m
54
import typer
65

6+
from typing import List
7+
78
from git_sim.animations import handle_animations
89
from git_sim.git_sim_base_command import GitSimBaseCommand
910
from git_sim.settings import settings
1011

1112

1213
class Add(GitSimBaseCommand):
13-
def __init__(self, files: list[str]):
14+
def __init__(self, files: List[str]):
1415
super().__init__()
1516
self.hide_first_tag = True
1617
self.allow_no_commits = True
@@ -82,7 +83,7 @@ def populate_zones(
8283

8384

8485
def add(
85-
files: list[str] = typer.Argument(
86+
files: List[str] = typer.Argument(
8687
default=None,
8788
help="The names of one or more files to add to Git's staging area",
8889
)

git_sim/restore.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import sys
2-
32
import manim as m
43
import typer
54

5+
from typing import List
6+
67
from git_sim.animations import handle_animations
78
from git_sim.git_sim_base_command import GitSimBaseCommand
89
from git_sim.settings import settings
910

1011

1112
class Restore(GitSimBaseCommand):
12-
def __init__(self, files: list[str]):
13+
def __init__(self, files: List[str]):
1314
super().__init__()
1415
self.hide_first_tag = True
1516
self.files = files
@@ -72,7 +73,7 @@ def populate_zones(
7273

7374

7475
def restore(
75-
files: list[str] = typer.Argument(
76+
files: List[str] = typer.Argument(
7677
default=None,
7778
help="The names of one or more files to restore",
7879
)

git_sim/settings.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import pathlib
2-
from enum import Enum
32

3+
from enum import Enum
4+
from typing import List, Union
45
from pydantic import BaseSettings
56

67

@@ -19,7 +20,7 @@ class Settings(BaseSettings):
1920
animate = False
2021
auto_open = True
2122
commits = 5
22-
files: list[pathlib.Path] | None = None
23+
files: Union[List[pathlib.Path], None] = None
2324
hide_first_tag = False
2425
img_format: ImgFormat = ImgFormat.jpg
2526
INFO_STRING = "Simulating: git"

git_sim/stash.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
import sys
2-
32
import manim as m
43
import typer
54

5+
from typing import List
6+
67
from git_sim.animations import handle_animations
78
from git_sim.git_sim_base_command import GitSimBaseCommand
89
from git_sim.settings import settings
910

1011

1112
class Stash(GitSimBaseCommand):
12-
def __init__(self, files: list[str]):
13+
def __init__(self, files: List[str]):
1314
super().__init__()
1415
self.hide_first_tag = True
1516
self.files = files
@@ -80,7 +81,7 @@ def populate_zones(
8081

8182

8283
def stash(
83-
files: list[str] = typer.Argument(
84+
files: List[str] = typer.Argument(
8485
default=None,
8586
help="The name of the file to stash changes for",
8687
)

0 commit comments

Comments
 (0)