@@ -387,7 +387,7 @@ def __init__(self, properties: Properties = EMPTY_DICT):
387387 super ().__init__ (properties = properties )
388388
389389 @staticmethod
390- def parse_location (location : str ) -> Tuple [str , str , str ]:
390+ def parse_location (location : str , properties : Properties = EMPTY_DICT ) -> Tuple [str , str , str ]:
391391 """Return (scheme, netloc, path) for the given location.
392392
393393 Uses environment variables DEFAULT_SCHEME and DEFAULT_NETLOC
@@ -396,8 +396,8 @@ def parse_location(location: str) -> Tuple[str, str, str]:
396396 uri = urlparse (location )
397397
398398 # Load defaults from environment
399- default_scheme = os . getenv ("DEFAULT_SCHEME" , "file" )
400- default_netloc = os . getenv ("DEFAULT_NETLOC" , "" )
399+ default_scheme = properties . get ("DEFAULT_SCHEME" , "file" )
400+ default_netloc = properties . get ("DEFAULT_NETLOC" , "" )
401401
402402 # Apply logic
403403 scheme = uri .scheme or default_scheme
@@ -599,7 +599,7 @@ def new_input(self, location: str) -> PyArrowFile:
599599 Returns:
600600 PyArrowFile: A PyArrowFile instance for the given location.
601601 """
602- scheme , netloc , path = self .parse_location (location )
602+ scheme , netloc , path = self .parse_location (location , self . properties )
603603 return PyArrowFile (
604604 fs = self .fs_by_scheme (scheme , netloc ),
605605 location = location ,
@@ -616,7 +616,7 @@ def new_output(self, location: str) -> PyArrowFile:
616616 Returns:
617617 PyArrowFile: A PyArrowFile instance for the given location.
618618 """
619- scheme , netloc , path = self .parse_location (location )
619+ scheme , netloc , path = self .parse_location (location , self . properties )
620620 return PyArrowFile (
621621 fs = self .fs_by_scheme (scheme , netloc ),
622622 location = location ,
@@ -637,7 +637,7 @@ def delete(self, location: Union[str, InputFile, OutputFile]) -> None:
637637 an AWS error code 15.
638638 """
639639 str_location = location .location if isinstance (location , (InputFile , OutputFile )) else location
640- scheme , netloc , path = self .parse_location (str_location )
640+ scheme , netloc , path = self .parse_location (str_location , self . properties )
641641 fs = self .fs_by_scheme (scheme , netloc )
642642
643643 try :
0 commit comments