177177 TimeType ,
178178 UnknownType ,
179179 UUIDType ,
180- strtobool ,
181180)
182181from pyiceberg .utils .concurrent import ExecutorFactory
183182from pyiceberg .utils .config import Config
184183from pyiceberg .utils .datetime import millis_to_datetime
185184from pyiceberg .utils .decimal import unscaled_to_decimal
186185from pyiceberg .utils .deprecated import deprecation_message
187186from pyiceberg .utils .properties import (
187+ convert_str_to_bool ,
188188 filter_properties ,
189189 get_first_property_value_with_tracking ,
190190 properties_with_prefix ,
@@ -428,12 +428,6 @@ def _initialize_fs(self, scheme: str, netloc: Optional[str] = None) -> FileSyste
428428 else :
429429 raise ValueError (f"Unrecognized filesystem type in URI: { scheme } " )
430430
431- def _convert_str_to_bool (self , value : Any ) -> bool :
432- """Convert string or other value to boolean, handling string representations properly."""
433- if isinstance (value , str ):
434- return strtobool (value )
435- return bool (value )
436-
437431 def _resolve_s3_region (
438432 self , provided_region : Optional [str ], resolve_region_override : Any , bucket : Optional [str ]
439433 ) -> Optional [str ]:
@@ -451,7 +445,7 @@ def _resolve_s3_region(
451445 # Handle resolve_region_override conversion
452446 should_resolve_region = False
453447 if resolve_region_override is not None :
454- should_resolve_region = self . _convert_str_to_bool (resolve_region_override )
448+ should_resolve_region = convert_str_to_bool (resolve_region_override )
455449
456450 # If no region provided or explicit resolve requested, try to resolve from bucket
457451 if provided_region is None or should_resolve_region :
@@ -493,7 +487,7 @@ def get(*keys: str) -> str | None:
493487 S3_RESOLVE_REGION
494488 ) # this feature is only available for S3. Use `get` here so it does not get passed down to the S3FileSystem constructor
495489 if force_virtual_addressing := get (S3_FORCE_VIRTUAL_ADDRESSING , "s3.force_virtual_addressing" ):
496- client_kwargs ["force_virtual_addressing" ] = self . _convert_str_to_bool (force_virtual_addressing )
490+ client_kwargs ["force_virtual_addressing" ] = convert_str_to_bool (force_virtual_addressing )
497491 else :
498492 # For Alibaba OSS protocol, default to True
499493 client_kwargs ["force_virtual_addressing" ] = True
@@ -549,7 +543,7 @@ def get(*keys: str) -> str | None:
549543 client_kwargs ["session_name" ] = session_name
550544
551545 if force_virtual_addressing := get (S3_FORCE_VIRTUAL_ADDRESSING , "s3.force_virtual_addressing" ):
552- client_kwargs ["force_virtual_addressing" ] = self . _convert_str_to_bool (force_virtual_addressing )
546+ client_kwargs ["force_virtual_addressing" ] = convert_str_to_bool (force_virtual_addressing )
553547 # Handle retry strategy special case
554548 if retry_strategy_impl := get (S3_RETRY_STRATEGY_IMPL , "s3.retry_strategy" ):
555549 if retry_instance := _import_retry_strategy (retry_strategy_impl ):
0 commit comments