aboutsummaryrefslogtreecommitdiffstats
path: root/fuzzycat/utils.py
diff options
context:
space:
mode:
authorMartin Czygan <martin.czygan@gmail.com>2020-12-01 23:54:02 +0100
committerMartin Czygan <martin.czygan@gmail.com>2020-12-01 23:54:02 +0100
commit72079139edd2e95a8d9e19dff5590771fee52202 (patch)
treec0793a3bd1b538c693d633aa272a77c20d1b0e50 /fuzzycat/utils.py
parent8183e792ae122ae66b66299da1948697ae296ac7 (diff)
downloadfuzzycat-72079139edd2e95a8d9e19dff5590771fee52202.tar.gz
fuzzycat-72079139edd2e95a8d9e19dff5590771fee52202.zip
verify: bsi undated
Diffstat (limited to 'fuzzycat/utils.py')
-rw-r--r--fuzzycat/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/fuzzycat/utils.py b/fuzzycat/utils.py
index d6beb03..ef3b418 100644
--- a/fuzzycat/utils.py
+++ b/fuzzycat/utils.py
@@ -9,6 +9,15 @@ printable_no_punct = string.digits + string.ascii_letters + string.whitespace
CHEM_FORMULA = re.compile(r"([A-Z]{1,2}[0-9]{1,2})+")
+def has_doi_prefix(v, prefix="10.1234"):
+ """
+ Returns False, if we cannot parse v or prefix does not match.
+ """
+ if not v:
+ return False
+ return v.split("/")[0] == prefix
+
+
def slugify_string(s: str) -> str:
"""
Keeps ascii chars and single whitespace only.