From ab6849b5e02d83e48316809c2522210b1f2977f8 Mon Sep 17 00:00:00 2001 From: Davte Date: Tue, 11 Feb 2020 14:43:15 +0100 Subject: [PATCH] Replace multiple whitespace in strings to be parsed --- davtelepot/__init__.py | 2 +- davtelepot/utilities.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/davtelepot/__init__.py b/davtelepot/__init__.py index 1d22f9f..14a6ffe 100644 --- a/davtelepot/__init__.py +++ b/davtelepot/__init__.py @@ -14,7 +14,7 @@ __author__ = "Davide Testa" __email__ = "davide@davte.it" __credits__ = ["Marco Origlia", "Nick Lee @Nickoala"] __license__ = "GNU General Public License v3.0" -__version__ = "2.3.23" +__version__ = "2.3.24" __maintainer__ = "Davide Testa" __contact__ = "t.me/davte" diff --git a/davtelepot/utilities.py b/davtelepot/utilities.py index 0f3526b..3f84475 100644 --- a/davtelepot/utilities.py +++ b/davtelepot/utilities.py @@ -5,16 +5,18 @@ import asyncio import collections import csv import datetime -from difflib import SequenceMatcher import inspect import io import json import logging import os import random +import re import string import time +from difflib import SequenceMatcher + # Third party modules import aiohttp from aiohttp import web @@ -1152,6 +1154,7 @@ def parse_datetime_interval_string(text): parsers = [] result_text, result_datetime, result_timedelta = [], None, None is_quoted_text = False + text = re.sub('\s\s+', ' ', text) # Replace multiple spaces with single space character for word in text.split(' '): if word.count('"') % 2: is_quoted_text = not is_quoted_text