@@ -387,7 +387,7 @@ def __init__(self, properties: Properties = EMPTY_DICT):
387
387
super ().__init__ (properties = properties )
388
388
389
389
@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 ]:
391
391
"""Return (scheme, netloc, path) for the given location.
392
392
393
393
Uses environment variables DEFAULT_SCHEME and DEFAULT_NETLOC
@@ -396,8 +396,8 @@ def parse_location(location: str) -> Tuple[str, str, str]:
396
396
uri = urlparse (location )
397
397
398
398
# 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" , "" )
401
401
402
402
# Apply logic
403
403
scheme = uri .scheme or default_scheme
@@ -599,7 +599,7 @@ def new_input(self, location: str) -> PyArrowFile:
599
599
Returns:
600
600
PyArrowFile: A PyArrowFile instance for the given location.
601
601
"""
602
- scheme , netloc , path = self .parse_location (location )
602
+ scheme , netloc , path = self .parse_location (location , self . properties )
603
603
return PyArrowFile (
604
604
fs = self .fs_by_scheme (scheme , netloc ),
605
605
location = location ,
@@ -616,7 +616,7 @@ def new_output(self, location: str) -> PyArrowFile:
616
616
Returns:
617
617
PyArrowFile: A PyArrowFile instance for the given location.
618
618
"""
619
- scheme , netloc , path = self .parse_location (location )
619
+ scheme , netloc , path = self .parse_location (location , self . properties )
620
620
return PyArrowFile (
621
621
fs = self .fs_by_scheme (scheme , netloc ),
622
622
location = location ,
@@ -637,7 +637,7 @@ def delete(self, location: Union[str, InputFile, OutputFile]) -> None:
637
637
an AWS error code 15.
638
638
"""
639
639
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 )
641
641
fs = self .fs_by_scheme (scheme , netloc )
642
642
643
643
try :
0 commit comments