mirror of
https://github.com/r4sas/PBinCLI
synced 2025-01-24 21:44:27 +00:00
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
This commit is contained in:
parent
01d3d881b1
commit
063ec9d881
@ -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":
|
||||
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…
x
Reference in New Issue
Block a user