Skip to content

Commit

Permalink
refactor: replace distutils.util.strtobool with custom implementation
Browse files Browse the repository at this point in the history
- Remove dependency on distutils which is deprecated in Python 3.10 and removed in 3.12
- Add custom strtobool implementation with identical functionality

Co-Authored-By: [email protected] <[email protected]>
  • Loading branch information
devin-ai-integration[bot] and natikgadzhi committed Jan 30, 2025
1 parent 17dd71f commit 3f6786d
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion airbyte_cdk/sources/utils/transform.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,22 @@
#

import logging
from distutils.util import strtobool
from enum import Flag, auto


def strtobool(val: str) -> bool:
"""Convert a string representation of truth to True or False.
True values are 'y', 'yes', 't', 'true', 'on', and '1';
False values are 'n', 'no', 'f', 'false', 'off', and '0'.
Raises ValueError if 'val' is anything else.
"""
val = val.lower()
if val in ('y', 'yes', 't', 'true', 'on', '1'):
return True
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return False
else:
raise ValueError(f"Invalid truth value {val}")
from typing import Any, Callable, Dict, Generator, Mapping, Optional, cast

from jsonschema import Draft7Validator, RefResolver, ValidationError, Validator, validators
Expand Down

0 comments on commit 3f6786d

Please sign in to comment.