Skip to content

Commit be8582c

Browse files
committed
Deleted Py 3 syntax/feats to ensure 2.6 compatibility
1 parent 6a53511 commit be8582c

2 files changed

Lines changed: 5 additions & 12 deletions

File tree

find-project-root/src/find_project_root/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
from .api import find_project_root
44

5-
sys.modules[__name__] = find_project_root # type: ignore[assignment]
5+
sys.modules[__name__] = find_project_root # type: ignore

find-project-root/src/find_project_root/api.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,12 @@
1-
import os, sys
2-
from typing import Optional, Union, List
3-
if sys.version_info >= (3, 4) : from pathlib import Path
4-
else : Path = str
1+
import os
52

63
import project_markers
74

8-
def find_project_root(
9-
path: Optional[Union[str, Path]] = None,
10-
max_depth: int = 9,
11-
markers: Optional[List[str]] = None
12-
) -> Optional[str]:
5+
def find_project_root(path= None, max_depth= 9, markers= None):
136
current_dir = os.getcwd() if path is None else str(path)
147
if not os.path.exists(current_dir):
15-
raise ValueError(f'Path does not exist: {os.path.abspath(current_dir)}')
16-
if not markers : markers = project_markers # type: ignore
8+
raise ValueError('Path does not exist: %s' % os.path.abspath(current_dir))
9+
if not markers : markers = project_markers
1710
for _ in range(max_depth):
1811
try : dir_files = os.listdir(current_dir)
1912
except (OSError, IOError, PermissionError):

0 commit comments

Comments
 (0)