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

pull/2305/head
dgtlmoon 2024-04-03 16:17:15 +02:00 zatwierdzone przez GitHub
rodzic 21f4ba2208
commit 9449c59fbb
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: B5690EEEBB952194
11 zmienionych plików z 33 dodań i 10 usunięć

Wyświetl plik

@ -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'

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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

Wyświetl plik

@ -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,

Wyświetl plik

@ -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

Wyświetl plik

@ -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():

Wyświetl plik

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

Wyświetl plik

@ -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))