From acc3f96b105e7ec1f62f0f07eddbd06566fc1902 Mon Sep 17 00:00:00 2001 From: Eugene Triguba Date: Sat, 22 Apr 2023 21:55:57 -0400 Subject: Fix type hints --- taskipy/cli.py | 4 ++-- taskipy/list.py | 6 +++--- taskipy/task_runner.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/taskipy/cli.py b/taskipy/cli.py index e4a57fd..a050146 100755 --- a/taskipy/cli.py +++ b/taskipy/cli.py @@ -2,7 +2,7 @@ import argparse import sys from pathlib import Path -from typing import List, Type, Union +from typing import List, Union from taskipy.io import AbstractIO, AppIO from taskipy.exceptions import TaskipyError, InvalidUsageError @@ -16,7 +16,7 @@ def main(): def run( args: List[str], - io: Type[AbstractIO] = AppIO(), # pylint: disable=C0103 + io: AbstractIO = AppIO(), # pylint: disable=C0103 cwd: Union[str, Path, None] = None ) -> int: """Run the taskipy CLI programmatically. diff --git a/taskipy/list.py b/taskipy/list.py index 52cdca2..2978fb0 100644 --- a/taskipy/list.py +++ b/taskipy/list.py @@ -1,7 +1,7 @@ import shutil import textwrap import colorama # type: ignore -from typing import List, Type, Optional +from typing import Iterable, Optional from taskipy.io import AbstractIO from taskipy.task import Task @@ -9,14 +9,14 @@ from taskipy.exceptions import EmptyTasksSectionError class TasksListFormatter: - def __init__(self, tasks: List[Task]): + def __init__(self, tasks: Iterable[Task]): if not tasks: raise EmptyTasksSectionError() self.__tasks = tasks colorama.init() - def print(self, io: Type[AbstractIO], line_width: Optional[int] = None): # pylint: disable=C0103 + def print(self, io: AbstractIO, line_width: Optional[int] = None): # pylint: disable=C0103 if not line_width: line_width = shutil.get_terminal_size().columns diff --git a/taskipy/task_runner.py b/taskipy/task_runner.py index 07872d4..d115dd7 100644 --- a/taskipy/task_runner.py +++ b/taskipy/task_runner.py @@ -4,7 +4,7 @@ import signal import subprocess from pathlib import Path from types import FrameType -from typing import Callable, Dict, List, Tuple, Type, Union, Optional +from typing import Callable, Dict, List, Tuple, Union, Optional import psutil # type: ignore @@ -27,7 +27,7 @@ class TaskRunner: self.__working_dir = working_dir self.__project = PyProject(working_dir) - def list(self, io: Type[AbstractIO]): # pylint: disable=C0103 + def list(self, io: AbstractIO): # pylint: disable=C0103 """lists tasks to stdout""" formatter = TasksListFormatter(self.__project.tasks.values()) formatter.print(io) -- cgit v1.2.3