Code - Getting ready for newer python versions - packing our own strtobool (#2291)

pull/2305/head
dgtlmoon 9 months ago committed by GitHub
parent 21f4ba2208
commit 9449c59fbb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -4,7 +4,7 @@
__version__ = '0.45.17'
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from json.decoder import JSONDecodeError
import os
#os.environ['EVENTLET_NO_GREENDNS'] = 'yes'

@ -1,5 +1,5 @@
import os
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from flask_expects_json import expects_json
from changedetectionio import queuedWatchMetaData

@ -12,7 +12,7 @@
#
#
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from flask import Blueprint, request, make_response
import os

@ -1,5 +1,5 @@
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from flask import Blueprint, flash, redirect, url_for
from flask_login import login_required
from changedetectionio.store import ChangeDetectionStore

@ -1,5 +1,5 @@
import sys
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from loguru import logger
from changedetectionio.content_fetchers.exceptions import BrowserStepsStepException
import os

@ -6,7 +6,7 @@ import queue
import threading
import time
from copy import deepcopy
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from functools import wraps
from threading import Event

@ -1,6 +1,6 @@
import os
import re
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from wtforms import (
BooleanField,

@ -1,4 +1,4 @@
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
import os
import re
import time

@ -3,7 +3,7 @@ import os
import hashlib
import re
from copy import deepcopy
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from loguru import logger
class difference_detection_processor():

@ -1,4 +1,4 @@
from distutils.util import strtobool
from changedetectionio.strtobool import strtobool
from flask import (
flash

@ -0,0 +1,23 @@
# Because strtobool was removed in python 3.12 distutils
_MAP = {
'y': True,
'yes': True,
't': True,
'true': True,
'on': True,
'1': True,
'n': False,
'no': False,
'f': False,
'false': False,
'off': False,
'0': False
}
def strtobool(value):
try:
return _MAP[str(value).lower()]
except KeyError:
raise ValueError('"{}" is not a valid bool value'.format(value))
Loading…
Cancel
Save