Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve trackability of committer #148

Merged
merged 2 commits into from
Aug 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading