Skip to content

Commit

Permalink
removed dependency of strtobool from distutils.util
Browse files Browse the repository at this point in the history
  • Loading branch information
idimov-keeper committed Dec 13, 2023
1 parent 9b19035 commit 1c89373
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 6 deletions.
3 changes: 1 addition & 2 deletions sdk/python/core/keeper_secrets_manager_core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import requests
import sys
from base64 import urlsafe_b64decode
from distutils.util import strtobool
from http import HTTPStatus
from typing import List, Tuple, Optional

Expand All @@ -35,7 +34,7 @@
from keeper_secrets_manager_core.storage import FileKeyValueStorage, KeyValueStorage, InMemoryKeyValueStorage
from keeper_secrets_manager_core.utils import base64_to_bytes, dict_to_json, \
url_safe_str_to_bytes, bytes_to_base64, generate_random_bytes, now_milliseconds, string_to_bytes, json_to_dict, \
bytes_to_string
bytes_to_string, strtobool


def find_secrets_by_title(record_title, records):
Expand Down
19 changes: 17 additions & 2 deletions sdk/python/core/keeper_secrets_manager_core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@
import time
from json import JSONDecodeError
from sys import platform as _platform
from typing import Optional, Tuple
from typing import Optional
from urllib import parse
import subprocess
import stat
from distutils.util import strtobool

from keeper_secrets_manager_core.keeper_globals import logger_name

Expand All @@ -36,6 +35,22 @@
DEFAULT_PASSWORD_LENGTH = 32


def strtobool(val):
"""Convert a string representation of truth to true (1) or false (0).
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 1
elif val in ('n', 'no', 'f', 'false', 'off', '0'):
return 0
else:
raise ValueError("invalid truth value {!r}".format(val))


def get_os():
if _platform.lower().startswith("linux"):
return "linux"
Expand Down
2 changes: 1 addition & 1 deletion sdk/python/core/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[metadata]
description-file = README.md
description_file = README.md
3 changes: 3 additions & 0 deletions sdk/python/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
],
)
3 changes: 3 additions & 0 deletions sdk/python/helper/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
]
)
2 changes: 1 addition & 1 deletion sdk/python/storage/setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[metadata]
description-file = README.md
description_file = README.md
3 changes: 3 additions & 0 deletions sdk/python/storage/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Topic :: Security",
]
)

0 comments on commit 1c89373

Please sign in to comment.