Skip to content

Commit

Permalink
Remove dependency on deprecated distutils.util.strtobool helper
Browse files Browse the repository at this point in the history
According to PEP 632 recomendations, reimplementing our own:
https://www.python.org/dev/peps/pep-0632/#migration-advice
  • Loading branch information
brenard authored and r4sas committed Jul 26, 2024
1 parent 01d3d88 commit 063ec9d
Showing 1 changed file with 10 additions and 1 deletion.
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

0 comments on commit 063ec9d

Please sign in to comment.