Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove dependency on deprecated distutils.util.strtobool helper #47

Merged
merged 1 commit into from
Jul 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion pbincli/cli.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
import os, sys, argparse
from distutils.util import strtobool

import argcomplete

Expand All @@ -20,6 +19,16 @@
CONFIG_PATHS.append(os.path.join(os.getenv("HOME") or "~", "Library", "Application Support", "pbincli", "pbincli.conf"))


def strtobool(value):
try:
return {
'y': True, 'yes': True, 't': True, 'true': True, 'on': True, '1': True,
'n': False, 'no': False, 'f': False, 'false': False, 'off': False, '0': False,
}[str(value).lower()]
except KeyError:
raise ValueError('"{}" is not a valid bool value'.format(value))


def read_config(filename):
"""Read config variables from a file"""
settings = {}
Expand Down
Loading