Skip to content

Commit 0cfeef9

Browse files
cleanup
1 parent 084028a commit 0cfeef9

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

PySpice/Tools/PathTools.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,12 @@
1818
#
1919
####################################################################################################
2020

21-
__all__= ["expand_path", "find", "walk"]
21+
__all__ = ['expand_path', 'find', 'walk']
2222

2323
####################################################################################################
2424

25+
from typing import Iterator
26+
2527
import os
2628
from pathlib import Path
2729

@@ -39,13 +41,13 @@ def find(file_name, directories):
3941

4042
####################################################################################################
4143

42-
def expand_path(path):
44+
def expand_path(path) -> Path:
4345
_ = os.path.expandvars(path)
4446
return Path(_).expanduser().absolute()
4547

4648
####################################################################################################
4749

48-
def walk(path, followlinks=False):
49-
for root, _, files in os.walk(path, followlinks=followlinks):
50+
def walk(path: Path | str, followlinks: bool = False) -> Iterator[Path]:
51+
for root, _, files in Path(path).walk(follow_symlinks=followlinks):
5052
for filename in files:
5153
yield Path(root).joinpath(filename)

0 commit comments

Comments
 (0)