Skip to content

Commit

Permalink
Improve trackability of committer (#148)
Browse files Browse the repository at this point in the history
  • Loading branch information
cthoyt authored Aug 18, 2023
1 parent 8d4bd28 commit e7957b8
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
5 changes: 4 additions & 1 deletion src/biomappings/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
5 changes: 4 additions & 1 deletion src/biomappings/testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import bioregistry

from biomappings.resources import (
CURATORS_PATH,
Mappings,
MappingTuple,
PredictionTuple,
Expand Down Expand Up @@ -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):
Expand Down
7 changes: 4 additions & 3 deletions src/biomappings/wsgi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit e7957b8

Please sign in to comment.