~javiljoen/yatte

7396b3435a82f42a7d3ec385cd293449ced943c5 — JA Viljoen 9 months ago 4e22507
Make compatible with Python 3.7

Specifying the types of elements of `dict` and `set`
is only supported since Python 3.9.
This changeset allows `yatte` to be run on Python >= 3.7.
(It might work on older versions too, but I haven't tested it,
since 3.7 is the oldest officially supported version.)
3 files changed, 5 insertions(+), 4 deletions(-)

M docs/doctasks.py
M pyproject.toml
M yatte/tasklist.py
M docs/doctasks.py => docs/doctasks.py +2 -1
@@ 3,6 3,7 @@ import xml.etree.ElementTree as xml
from datetime import date
from logging import error
from pathlib import Path
from typing import Set

import chevron  # type: ignore



@@ 102,7 103,7 @@ def cp(src: Path, dest: Path):
        run(f"cp -p {src} {dest}")


def uptodate(f: Path, deps: set[Path]) -> bool:
def uptodate(f: Path, deps: Set[Path]) -> bool:
    # like is_newer() but takes multiple files as 2nd arg.
    return f.is_file() and all(f.stat().st_mtime > d.stat().st_mtime for d in deps)


M pyproject.toml => pyproject.toml +1 -1
@@ 4,7 4,7 @@ authors = [
    { name = "JA Viljoen", email = "javiljoen@javiljoen.net" },
]
readme = "README.md"
requires-python = "~=3.5"
requires-python = "~=3.7"
license = { file =  "LICENSE" }
dynamic = ["description", "version"]
classifiers = [ "Private :: Do Not Upload" ]

M yatte/tasklist.py => yatte/tasklist.py +2 -2
@@ 2,7 2,7 @@
from __future__ import annotations

from inspect import getdoc, getfile, signature
from typing import Callable
from typing import Callable, Dict

from .taskfile import load_taskfile



@@ 59,7 59,7 @@ class ArgCountError(TypeError):
    pass


class TaskList(dict[str, Task]):
class TaskList(Dict[str, Task]):
    """A mapping of Tasks indexed on task name

    When instantiating this class,