diff options
author | Bryan Newbold <bnewbold@archive.org> | 2021-10-27 14:49:58 -0700 |
---|---|---|
committer | Bryan Newbold <bnewbold@archive.org> | 2021-10-27 18:25:58 -0700 |
commit | eb0c866d4e226606fe86e0f90af10c776e664a5c (patch) | |
tree | 732be3b53c9947ae8b416e4aaf0b8bb25b3998b9 /fatcat_scholar/identifiers.py | |
parent | 4362e60383bef09d5989830b19ae2d5dec506620 (diff) | |
download | fatcat-scholar-eb0c866d4e226606fe86e0f90af10c776e664a5c.tar.gz fatcat-scholar-eb0c866d4e226606fe86e0f90af10c776e664a5c.zip |
lint: small cleanups, mostly E711 and E713
Diffstat (limited to 'fatcat_scholar/identifiers.py')
-rw-r--r-- | fatcat_scholar/identifiers.py | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/fatcat_scholar/identifiers.py b/fatcat_scholar/identifiers.py index 9a64de8..d1a1197 100644 --- a/fatcat_scholar/identifiers.py +++ b/fatcat_scholar/identifiers.py @@ -24,7 +24,7 @@ def clean_doi(raw: Optional[str]) -> Optional[str]: return None if len(raw.split()) != 1: return None - if not "10." in raw: + if "10." not in raw: return None if not raw.startswith("10."): raw = raw[raw.find("10.") :] @@ -51,23 +51,23 @@ def clean_doi(raw: Optional[str]) -> Optional[str]: def test_clean_doi() -> None: - assert clean_doi(None) == None - assert clean_doi("") == None - assert clean_doi("asdf") == None - assert clean_doi("10.123") == None + assert clean_doi(None) is None + assert clean_doi("") is None + assert clean_doi("asdf") is None + assert clean_doi("10.123") is None assert clean_doi("10.1234/asdf ") == "10.1234/asdf" assert clean_doi("10.1234/ASdf ") == "10.1234/asdf" assert clean_doi("10.1037//0002-9432.72.1.50") == "10.1037/0002-9432.72.1.50" assert clean_doi("10.1037/0002-9432.72.1.50") == "10.1037/0002-9432.72.1.50" - assert clean_doi("10.23750/abm.v88i2 -s.6506") == None - assert clean_doi("10.17167/mksz.2017.2.129–155") == None + assert clean_doi("10.23750/abm.v88i2 -s.6506") is None + assert clean_doi("10.17167/mksz.2017.2.129–155") is None assert clean_doi("http://doi.org/10.1234/asdf ") == "10.1234/asdf" assert clean_doi("https://dx.doi.org/10.1234/asdf ") == "10.1234/asdf" assert clean_doi("doi:10.1234/asdf ") == "10.1234/asdf" - assert clean_doi("doi:10.1234/ asdf ") == None - assert clean_doi("10.4149/gpb¬_2017042") == None # "logical negation" character + assert clean_doi("doi:10.1234/ asdf ") is None + assert clean_doi("10.4149/gpb¬_2017042") is None # "logical negation" character assert ( - clean_doi("10.6002/ect.2020.häyry") == None + clean_doi("10.6002/ect.2020.häyry") is None ) # this example via pubmed (pmid:32519616) # GROBID mangled DOI assert clean_doi("21924DOI10.1234/asdf ") == "10.1234/asdf" @@ -85,9 +85,9 @@ def clean_pmcid(raw: Optional[str]) -> Optional[str]: def test_clean_pmcid() -> None: - assert clean_pmcid("10.1234/asdf ") == None - assert clean_pmcid("") == None - assert clean_pmcid("1 2") == None - assert clean_pmcid(None) == None + assert clean_pmcid("10.1234/asdf ") is None + assert clean_pmcid("") is None + assert clean_pmcid("1 2") is None + assert clean_pmcid(None) is None assert clean_pmcid("PMC123") == "PMC123" assert clean_pmcid("pmc123") == "PMC123" |