projects
/
python_utils.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Reduce import scopes, remove cycles.
[python_utils.git]
/
string_utils.py
diff --git
a/string_utils.py
b/string_utils.py
index 7ad9c42a1e2af3304e18ba6beba021c35acbb086..740a0b960d1da84a4686bf535eb39f006d9d3b77 100644
(file)
--- a/
string_utils.py
+++ b/
string_utils.py
@@
-11,9
+11,6
@@
from typing import Any, List, Optional
import unicodedata
from uuid import uuid4
import unicodedata
from uuid import uuid4
-import dateparse.dateparse_utils as dp
-
-
logger = logging.getLogger(__name__)
NUMBER_RE = re.compile(r"^([+\-]?)((\d+)(\.\d+)?([e|E]\d+)?|\.\d+)$")
logger = logging.getLogger(__name__)
NUMBER_RE = re.compile(r"^([+\-]?)((\d+)(\.\d+)?([e|E]\d+)?|\.\d+)$")
@@
-815,6
+812,7
@@
def to_bool(in_str: str) -> bool:
def to_date(in_str: str) -> Optional[datetime.date]:
def to_date(in_str: str) -> Optional[datetime.date]:
+ import dateparse.dateparse_utils as dp
try:
d = dp.DateParser()
d.parse(in_str)
try:
d = dp.DateParser()
d.parse(in_str)
@@
-825,6
+823,7
@@
def to_date(in_str: str) -> Optional[datetime.date]:
def valid_date(in_str: str) -> bool:
def valid_date(in_str: str) -> bool:
+ import dateparse.dateparse_utils as dp
try:
d = dp.DateParser()
_ = d.parse(in_str)
try:
d = dp.DateParser()
_ = d.parse(in_str)
@@
-835,6
+834,7
@@
def valid_date(in_str: str) -> bool:
def to_datetime(in_str: str) -> Optional[datetime.datetime]:
def to_datetime(in_str: str) -> Optional[datetime.datetime]:
+ import dateparse.dateparse_utils as dp
try:
d = dp.DateParser()
dt = d.parse(in_str)
try:
d = dp.DateParser()
dt = d.parse(in_str)