diff options
author | Bryan Newbold <bnewbold@robocracy.org> | 2020-04-15 21:35:48 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@robocracy.org> | 2020-04-17 10:56:17 -0700 |
commit | 116a26f072e8628cc4cfabb2e55c6661b6b94605 (patch) | |
tree | b1a38a3c26eef2da3312daa72557e81694600031 /python/fatcat_tools | |
parent | 2c0a6c23eb4edf2941a1c106ce556ed505e778b1 (diff) | |
download | fatcat-116a26f072e8628cc4cfabb2e55c6661b6b94605.tar.gz fatcat-116a26f072e8628cc4cfabb2e55c6661b6b94605.zip |
consistently use raw string prefix for regex
Diffstat (limited to 'python/fatcat_tools')
-rw-r--r-- | python/fatcat_tools/importers/common.py | 2 | ||||
-rw-r--r-- | python/fatcat_tools/normal.py | 10 |
2 files changed, 6 insertions, 6 deletions
diff --git a/python/fatcat_tools/importers/common.py b/python/fatcat_tools/importers/common.py index da611ecb..99c330a6 100644 --- a/python/fatcat_tools/importers/common.py +++ b/python/fatcat_tools/importers/common.py @@ -306,7 +306,7 @@ class EntityImporter: self._issnl_id_map = dict() self._orcid_id_map = dict() - self._orcid_regex = re.compile("^\\d{4}-\\d{4}-\\d{4}-\\d{3}[\\dX]$") + self._orcid_regex = re.compile(r"^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$") self._doi_id_map = dict() self._pmid_id_map = dict() diff --git a/python/fatcat_tools/normal.py b/python/fatcat_tools/normal.py index 7a2b5fd9..528a822e 100644 --- a/python/fatcat_tools/normal.py +++ b/python/fatcat_tools/normal.py @@ -6,7 +6,7 @@ free-form input, titles, etc. import re -DOI_REGEX = re.compile("^10.\d{3,6}/\S+$") +DOI_REGEX = re.compile(r"^10.\d{3,6}/\S+$") def clean_doi(raw): """ @@ -66,7 +66,7 @@ def test_clean_doi(): assert clean_doi("doi:10.1234/ asdf ") == None assert clean_doi("10.4149/gpb¬_2017042") == None # "logical negation" character -ARXIV_ID_REGEX = re.compile("^(\d{4}.\d{4,5}|[a-z\-]+(\.[A-Z]{2})?/\d{7})(v\d+)?$") +ARXIV_ID_REGEX = re.compile(r"^(\d{4}.\d{4,5}|[a-z\-]+(\.[A-Z]{2})?/\d{7})(v\d+)?$") def clean_arxiv_id(raw): """ @@ -175,7 +175,7 @@ def test_clean_sha256(): assert clean_sha256("6cc853f2ae75696b2e45f476c76b946b0fc2df7c52bb38287cb074aceb77bc7f") == "6cc853f2ae75696b2e45f476c76b946b0fc2df7c52bb38287cb074aceb77bc7f" assert clean_sha256("0fba3fba0e1937aa0297de3836b768b5dfb23d7b") == None -ISSN_REGEX = re.compile("^\d{4}-\d{3}[0-9X]$") +ISSN_REGEX = re.compile(r"^\d{4}-\d{3}[0-9X]$") def clean_issn(raw): if not raw: @@ -193,7 +193,7 @@ def test_clean_issn(): assert clean_issn("134-4567") == None assert clean_issn("123X-4567") == None -ISBN13_REGEX = re.compile("^97(?:8|9)-\d{1,5}-\d{1,7}-\d{1,6}-\d$") +ISBN13_REGEX = re.compile(r"^97(?:8|9)-\d{1,5}-\d{1,7}-\d{1,6}-\d$") def clean_isbn13(raw): if not raw: @@ -209,7 +209,7 @@ def test_clean_isbn13(): assert clean_isbn13("978-1-56619-909-4 ") == "978-1-56619-909-4" assert clean_isbn13("9781566199094") == None -ORCID_REGEX = re.compile("^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$") +ORCID_REGEX = re.compile(r"^\d{4}-\d{4}-\d{4}-\d{3}[\dX]$") def clean_orcid(raw): if not raw: |