Skip to content

Commit b2c931e

Browse files
committed
improve type hints
1 parent 4946a63 commit b2c931e

File tree

4 files changed

+10
-10
lines changed

4 files changed

+10
-10
lines changed

src/gitutils/find.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
from pathlib import Path
2-
import typing as T
2+
from collections.abc import Iterator
33
import shutil
44

55

6-
def find_matching_file(path: Path, fn: str) -> T.Iterator[Path]:
6+
def find_matching_file(path: Path, fn: str) -> Iterator[Path]:
77
"""
88
if full path file is found, return that filename
99
@@ -29,7 +29,7 @@ def find_matching_file(path: Path, fn: str) -> T.Iterator[Path]:
2929
yield d
3030

3131

32-
def find_dir_missing_file(path: Path, fn: str, copyfile: Path | None = None) -> T.Iterator[Path]:
32+
def find_dir_missing_file(path: Path, fn: str, copyfile: Path | None = None) -> Iterator[Path]:
3333
"""
3434
if directory is missing a file, copy the file to that directory
3535

src/gitutils/git.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from pathlib import Path
66
import subprocess
7-
import typing
7+
from collections.abc import Iterator
88
import shutil
99
import functools
1010
import os
@@ -45,7 +45,7 @@ def git_exe() -> str:
4545
return exe
4646

4747

48-
def gitdirs(path: Path) -> typing.Iterator[Path]:
48+
def gitdirs(path: Path) -> Iterator[Path]:
4949
"""
5050
Generator for Git directories
5151

src/gitutils/git_email.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
from pathlib import Path
6-
import typing as T
6+
from collections.abc import Iterator, Iterable
77
import collections
88
import logging
99
import subprocess
@@ -15,7 +15,7 @@
1515

1616
def gitemail(
1717
path: Path, exclude: str | None = None, timeout=TIMEOUT["local"]
18-
) -> T.Iterator[tuple[Path, list[tuple[str, int]]]]:
18+
) -> Iterator[tuple[Path, list[tuple[str, int]]]]:
1919
"""
2020
returns email addresses of everyone who ever made a Git commit in this repo.
2121
@@ -46,7 +46,7 @@ def gitemail(
4646
logging.error(f"{path} {e}")
4747
continue
4848

49-
addrs: T.Iterable[str] = filter(None, ret.replace('"', "").split("\n"))
49+
addrs: Iterable[str] = filter(None, ret.replace('"', "").split("\n"))
5050
# remove blanks
5151
if exclude:
5252
addrs = (n for n in addrs if not n.startswith(exclude))

src/gitutils/status.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"""
44

55
import argparse
6-
import typing
6+
from collections.abc import Iterator
77
from pathlib import Path
88
import asyncio
99
from pprint import pprint
@@ -15,7 +15,7 @@
1515
from .status_cmd import git_status_serial, git_status_async
1616

1717

18-
def git_status(path: Path, verbose: bool) -> typing.Iterator[tuple[Path, dict]]:
18+
def git_status(path: Path, verbose: bool) -> Iterator[tuple[Path, dict]]:
1919

2020
for d in gitdirs(path):
2121
repo = pygit2.Repository(d)

0 commit comments

Comments
 (0)