diff --git a/src/biomappings/resources/__init__.py b/src/biomappings/resources/__init__.py index 24208a16..47665fc2 100644 --- a/src/biomappings/resources/__init__.py +++ b/src/biomappings/resources/__init__.py @@ -477,9 +477,12 @@ def _standardize_mapping(mapping): return mapping +CURATORS_PATH = get_resource_file_path("curators.tsv") + + def load_curators(): """Load the curators table.""" - return _load_table(get_resource_file_path("curators.tsv")) + return _load_table(CURATORS_PATH) def filter_predictions(custom_filter: Mapping[str, Mapping[str, Mapping[str, str]]]) -> None: diff --git a/src/biomappings/testing.py b/src/biomappings/testing.py index 42d08cad..6e86550d 100644 --- a/src/biomappings/testing.py +++ b/src/biomappings/testing.py @@ -9,6 +9,7 @@ import bioregistry from biomappings.resources import ( + CURATORS_PATH, Mappings, MappingTuple, PredictionTuple, @@ -126,7 +127,9 @@ def test_contributors(self): for mapping in itt.chain(self.mappings, self.incorrect, self.unsure): source = mapping["source"] if not source.startswith("orcid:"): - continue + self.assertTrue(source.startswith("web-")) + ss = source[len("web-") :] + self.fail(msg=f'Add an entry with "{ss}" and your ORCID to {CURATORS_PATH}') self.assertIn(source[len("orcid:") :], contributor_orcids) def test_cross_redundancy(self): diff --git a/src/biomappings/wsgi.py b/src/biomappings/wsgi.py index 306e409f..6e44fa65 100644 --- a/src/biomappings/wsgi.py +++ b/src/biomappings/wsgi.py @@ -132,11 +132,12 @@ def get_app( KNOWN_USERS = {record["user"]: record["orcid"] for record in load_curators()} -def _manual_source(): - known_user = KNOWN_USERS.get(getpass.getuser()) +def _manual_source() -> str: + usr = getpass.getuser() + known_user = KNOWN_USERS.get(usr) if known_user: return f"orcid:{known_user}" - return "web" + return f"web-{usr}" class Controller: