5353from schema_salad .exceptions import ValidationException
5454from schema_salad .ref_resolver import Loader
5555
56+ if sys .version_info >= (3 , 9 ):
57+ from importlib .resources import as_file , files
58+ else :
59+ from importlib_resources import as_file , files
60+
5661if TYPE_CHECKING :
5762 from .command_line_tool import CallbackJob , ExpressionJob
5863 from .job import CommandLineJob , JobBase
5964 from .stdfsaccess import StdFsAccess
6065 from .workflow_job import WorkflowJob
6166
67+ __all__ = ["files" , "as_file" ]
68+
6269__random_outdir : Optional [str ] = None
6370
6471CONTENT_LIMIT = 64 * 1024
@@ -368,8 +375,8 @@ def add_writable_flag(p: str) -> None:
368375 if os .path .isdir (path ):
369376 if include_root :
370377 add_writable_flag (path )
371- for root , dirs , files in os .walk (path ):
372- for name in files :
378+ for root , dirs , files_ in os .walk (path ):
379+ for name in files_ :
373380 add_writable_flag (os .path .join (root , name ))
374381 for name in dirs :
375382 add_writable_flag (os .path .join (root , name ))
@@ -380,8 +387,8 @@ def add_writable_flag(p: str) -> None:
380387def ensure_non_writable (path : str ) -> None :
381388 """Attempt to change permissions to ensure that a path is not writable."""
382389 if os .path .isdir (path ):
383- for root , dirs , files in os .walk (path ):
384- for name in files :
390+ for root , dirs , files_ in os .walk (path ):
391+ for name in files_ :
385392 j = os .path .join (root , name )
386393 st = os .stat (j )
387394 mode = stat .S_IMODE (st .st_mode )
0 commit comments