@@ -392,7 +392,7 @@ def __init__(self, properties: Properties = EMPTY_DICT):
392392 super ().__init__ (properties = properties )
393393
394394 @staticmethod
395- def parse_location (location : str ) -> Tuple [str , str , str ]:
395+ def parse_location (location : str , properties : Properties = EMPTY_DICT ) -> Tuple [str , str , str ]:
396396 """Return (scheme, netloc, path) for the given location.
397397
398398 Uses environment variables DEFAULT_SCHEME and DEFAULT_NETLOC
@@ -401,8 +401,8 @@ def parse_location(location: str) -> Tuple[str, str, str]:
401401 uri = urlparse (location )
402402
403403 # Load defaults from environment
404- default_scheme = os . getenv ("DEFAULT_SCHEME" , "file" )
405- default_netloc = os . getenv ("DEFAULT_NETLOC" , "" )
404+ default_scheme = properties . get ("DEFAULT_SCHEME" , "file" )
405+ default_netloc = properties . get ("DEFAULT_NETLOC" , "" )
406406
407407 # Apply logic
408408 scheme = uri .scheme or default_scheme
@@ -629,7 +629,7 @@ def new_input(self, location: str) -> PyArrowFile:
629629 Returns:
630630 PyArrowFile: A PyArrowFile instance for the given location.
631631 """
632- scheme , netloc , path = self .parse_location (location )
632+ scheme , netloc , path = self .parse_location (location , self . properties )
633633 return PyArrowFile (
634634 fs = self .fs_by_scheme (scheme , netloc ),
635635 location = location ,
@@ -646,7 +646,7 @@ def new_output(self, location: str) -> PyArrowFile:
646646 Returns:
647647 PyArrowFile: A PyArrowFile instance for the given location.
648648 """
649- scheme , netloc , path = self .parse_location (location )
649+ scheme , netloc , path = self .parse_location (location , self . properties )
650650 return PyArrowFile (
651651 fs = self .fs_by_scheme (scheme , netloc ),
652652 location = location ,
@@ -667,7 +667,7 @@ def delete(self, location: Union[str, InputFile, OutputFile]) -> None:
667667 an AWS error code 15.
668668 """
669669 str_location = location .location if isinstance (location , (InputFile , OutputFile )) else location
670- scheme , netloc , path = self .parse_location (str_location )
670+ scheme , netloc , path = self .parse_location (str_location , self . properties )
671671 fs = self .fs_by_scheme (scheme , netloc )
672672
673673 try :
0 commit comments