File tree Expand file tree Collapse file tree
find-project-root/src/find_project_root Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33from .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
Original file line number Diff line number Diff line change 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
63import 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 ):
You can’t perform that action at this time.
0 commit comments