File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change 11import json
2- import os
32from pathlib import Path
43
54from .jsonldutils import load_file , validate_data
@@ -63,20 +62,22 @@ def validate_dir(
6362 if http_kwargs is None :
6463 http_kwargs = {}
6564
66- if not os .path .isdir (directory ):
65+ directory = Path (directory )
66+
67+ if not directory .is_dir ():
6768 if stop is not None :
6869 stop_server (stop )
69- raise Exception (f"{ directory } is not a directory" )
70+ raise Exception (f"{ str ( directory ) } is not a directory" )
7071
71- if Path ( directory ) .name in DIR_TO_SKIP :
72+ if directory .name in DIR_TO_SKIP :
7273 lgr .info (f"Skipping directory { directory } " )
7374 return True
7475
7576 lgr .info (f"Validating directory { directory } " )
7677
7778 files_to_validate = [
7879 str (x )
79- for x in Path ( directory ) .iterdir ()
80+ for x in directory .iterdir ()
8081 if x .is_file ()
8182 and x .name not in FILES_TO_SKIP
8283 and x .suffix in SUPPORTED_EXTENSIONS
@@ -104,7 +105,7 @@ def validate_dir(
104105
105106 dirs_to_validate = [
106107 str (x )
107- for x in Path ( directory ) .iterdir ()
108+ for x in directory .iterdir ()
108109 if x .is_dir () and x .name not in DIR_TO_SKIP
109110 ]
110111
@@ -131,7 +132,7 @@ def validate(path):
131132 exception.
132133
133134 """
134- if os . path . isdir ( path ):
135+ if Path ( path ). is_dir ( ):
135136
136137 lgr .info (f"Validating directory { path } " )
137138
You can’t perform that action at this time.
0 commit comments