Browse Source

Remove dependency on deprecated distutils.util.strtobool helper

According to PEP 632 recomendations, reimplementing our own:
https://www.python.org/dev/peps/pep-0632/#migration-advice
master
Benjamin Renard 5 months ago committed by R4SAS
parent
commit
063ec9d881
  1. 11
      pbincli/cli.py

11
pbincli/cli.py

@ -1,7 +1,6 @@ @@ -1,7 +1,6 @@
#!/usr/bin/env python
# PYTHON_ARGCOMPLETE_OK
import os, sys, argparse
from distutils.util import strtobool
import argcomplete
@ -20,6 +19,16 @@ elif sys.platform == "darwin": @@ -20,6 +19,16 @@ elif sys.platform == "darwin":
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 = {}

Loading…
Cancel
Save