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' __version__ = '0.45.17'
from distutils.util import strtobool from changedetectionio.strtobool import strtobool
from json.decoder import JSONDecodeError from json.decoder import JSONDecodeError
import os import os
#os.environ['EVENTLET_NO_GREENDNS'] = 'yes' #os.environ['EVENTLET_NO_GREENDNS'] = 'yes'

@ -1,5 +1,5 @@
import os import os
from distutils.util import strtobool from changedetectionio.strtobool import strtobool
from flask_expects_json import expects_json from flask_expects_json import expects_json
from changedetectionio import queuedWatchMetaData 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 from flask import Blueprint, request, make_response
import os 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 import Blueprint, flash, redirect, url_for
from flask_login import login_required from flask_login import login_required
from changedetectionio.store import ChangeDetectionStore from changedetectionio.store import ChangeDetectionStore

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

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

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

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

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

@ -1,4 +1,4 @@
from distutils.util import strtobool from changedetectionio.strtobool import strtobool
from flask import ( from flask import (
flash 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