Skip to content

Commit c2d3f9b

Browse files
committed
update known github users
1 parent 0f98a4a commit c2d3f9b

File tree

7 files changed

+44
-38
lines changed

7 files changed

+44
-38
lines changed

bioimageio/spec/_internal/constants.py

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,28 +57,30 @@ class _DtypeLimit(NamedTuple):
5757
)
5858

5959
# TODO: cache/store known gh users in file
60-
KNOWN_GH_USERS: Set[str] = {
61-
"clementcaporal",
62-
"donglaiw",
63-
"jansanrom",
64-
"pedgomgal1",
60+
KNOWN_GITHUB_USERS: Set[str] = {
6561
"aaitorg",
62+
"anwai98",
6663
"bioimageiobot",
6764
"carlosuc3m",
6865
"cfusterbarcelo",
66+
"clementcaporal",
6967
"constantinpape",
7068
"ctr26",
7169
"danifranco",
70+
"donglaiw",
7271
"esgomezm",
7372
"fynnbe",
7473
"githubuser2",
7574
"iarganda",
75+
"ilastik",
7676
"ivanhcenalmor",
7777
"jansanrom",
7878
"k-dominik",
7979
"lenkaback",
8080
"oeway",
81+
"pedgomgal1",
8182
}
82-
N_KNOWN_GH_USERS = len(KNOWN_GH_USERS)
83-
KNOWN_INVALID_GH_USERS: Set[str] = {"arratemunoz", "lmescu"}
84-
N_KNOWN_INVALID_GH_USERS = len(KNOWN_INVALID_GH_USERS)
83+
84+
N_KNOWN_GITHUB_USERS = len(KNOWN_GITHUB_USERS)
85+
KNOWN_INVALID_GITHUB_USERS: Set[str] = {"arratemunoz", "lmescu"}
86+
N_KNOWN_INVALID_GITHUB_USERS = len(KNOWN_INVALID_GITHUB_USERS)

bioimageio/spec/_internal/field_validation.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
import httpx
1313

1414
from ._settings import settings
15-
from .constants import KNOWN_GH_USERS, KNOWN_INVALID_GH_USERS
15+
from .constants import KNOWN_GITHUB_USERS, KNOWN_INVALID_GITHUB_USERS
1616
from .field_warning import issue_warning
1717
from .type_guards import is_mapping, is_sequence, is_tuple
1818
from .validation_context import get_validation_context
@@ -57,18 +57,20 @@ def validate_unique_entries(seq: Sequence[Hashable]):
5757
return seq
5858

5959

60-
def validate_gh_user(username: str, hotfix_known_errorenous_names: bool = True) -> str:
60+
def validate_github_user(
61+
username: str, hotfix_known_errorenous_names: bool = True
62+
) -> str:
6163
if hotfix_known_errorenous_names:
6264
if username == "Constantin Pape":
6365
return "constantinpape"
6466

6567
if (
66-
username.lower() in KNOWN_GH_USERS
68+
username.lower() in KNOWN_GITHUB_USERS
6769
or not get_validation_context().perform_io_checks
6870
):
6971
return username
7072

71-
if username.lower() in KNOWN_INVALID_GH_USERS:
73+
if username.lower() in KNOWN_INVALID_GITHUB_USERS:
7274
raise ValueError(f"Known invalid GitHub user '{username}'")
7375

7476
try:
@@ -89,9 +91,9 @@ def validate_gh_user(username: str, hotfix_known_errorenous_names: bool = True)
8991
value=username,
9092
)
9193
elif r.status_code != 200:
92-
KNOWN_INVALID_GH_USERS.add(username.lower())
94+
KNOWN_INVALID_GITHUB_USERS.add(username.lower())
9395
raise ValueError(f"Could not find GitHub user '{username}'")
9496

95-
KNOWN_GH_USERS.add(username.lower())
97+
KNOWN_GITHUB_USERS.add(username.lower())
9698

9799
return username

bioimageio/spec/generic/v0_3.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727

2828
from .._internal.common_nodes import Node, ResourceDescrBase
2929
from .._internal.constants import TAG_CATEGORIES
30-
from .._internal.field_validation import validate_gh_user
30+
from .._internal.field_validation import validate_github_user
3131
from .._internal.field_warning import as_warning, warn
3232
from .._internal.io import (
3333
BioimageioYamlContent,
@@ -112,11 +112,11 @@ class Author(_Author_v0_2):
112112
github_user: Optional[str] = None
113113

114114
@field_validator("github_user", mode="after")
115-
def _validate_gh_user(cls, value: Optional[str]):
115+
def _validate_github_user(cls, value: Optional[str]):
116116
if value is None:
117117
return None
118118
else:
119-
return validate_gh_user(value)
119+
return validate_github_user(value)
120120

121121

122122
class _AuthorConv(Converter[_Author_v0_2, Author]):
@@ -140,8 +140,8 @@ class Maintainer(_Maintainer_v0_2):
140140
github_user: str
141141

142142
@field_validator("github_user", mode="after")
143-
def validate_gh_user(cls, value: str):
144-
return validate_gh_user(value)
143+
def validate_github_user(cls, value: str):
144+
return validate_github_user(value)
145145

146146

147147
class _MaintainerConv(Converter[_Maintainer_v0_2, Maintainer]):

tests/conftest.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
from dotenv import load_dotenv
99

1010
from bioimageio.spec._internal.constants import (
11-
KNOWN_GH_USERS,
12-
KNOWN_INVALID_GH_USERS,
13-
N_KNOWN_GH_USERS,
14-
N_KNOWN_INVALID_GH_USERS,
11+
KNOWN_GITHUB_USERS,
12+
KNOWN_INVALID_GITHUB_USERS,
13+
N_KNOWN_GITHUB_USERS,
14+
N_KNOWN_INVALID_GITHUB_USERS,
1515
)
1616
from bioimageio.spec._internal.io_utils import read_yaml
1717
from bioimageio.spec._internal.type_guards import is_dict, is_kwargs
@@ -81,10 +81,10 @@ def unet2d_data(unet2d_path: Path):
8181

8282

8383
def pytest_sessionfinish(session: Any, exitstatus: Any):
84-
if len(KNOWN_GH_USERS) > N_KNOWN_GH_USERS:
84+
if len(KNOWN_GITHUB_USERS) > N_KNOWN_GITHUB_USERS:
8585
print("updated known gh users:")
86-
pprint(KNOWN_GH_USERS)
86+
pprint(KNOWN_GITHUB_USERS)
8787

88-
if len(KNOWN_INVALID_GH_USERS) > N_KNOWN_INVALID_GH_USERS:
88+
if len(KNOWN_INVALID_GITHUB_USERS) > N_KNOWN_INVALID_GITHUB_USERS:
8989
print("updated known invalid gh users:")
90-
pprint(KNOWN_INVALID_GH_USERS)
90+
pprint(KNOWN_INVALID_GITHUB_USERS)

tests/test_internal/test_constants.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,13 @@ def test_warning_levels():
2828
assert INFO == logging.INFO
2929

3030

31-
def test_known_gh_users_are_lowercase():
31+
def test_known_github_users_are_lowercase():
3232
from bioimageio.spec._internal.constants import (
33-
KNOWN_GH_USERS,
34-
KNOWN_INVALID_GH_USERS,
33+
KNOWN_GITHUB_USERS,
34+
KNOWN_INVALID_GITHUB_USERS,
3535
)
3636

37-
assert KNOWN_GH_USERS == {user.lower() for user in KNOWN_GH_USERS}
38-
assert KNOWN_INVALID_GH_USERS == {user.lower() for user in KNOWN_INVALID_GH_USERS}
37+
assert KNOWN_GITHUB_USERS == {user.lower() for user in KNOWN_GITHUB_USERS}
38+
assert KNOWN_INVALID_GITHUB_USERS == {
39+
user.lower() for user in KNOWN_INVALID_GITHUB_USERS
40+
}

tests/test_internal/test_field_validation.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,14 @@ def test_validate_unique_entries():
2929
assert ret == ["a", "b"]
3030

3131

32-
def test_validate_gh_user():
33-
from bioimageio.spec._internal.field_validation import validate_gh_user
32+
def test_validate_github_user():
33+
from bioimageio.spec._internal.field_validation import validate_github_user
3434

3535
with pytest.raises(ValueError), ValidationContext(perform_io_checks=True):
36-
_ = validate_gh_user("arratemunoz")
36+
_ = validate_github_user("arratemunoz")
3737

38-
cpape = validate_gh_user("Constantin Pape", hotfix_known_errorenous_names=True)
38+
cpape = validate_github_user("Constantin Pape", hotfix_known_errorenous_names=True)
3939
assert cpape == "constantinpape"
4040

41-
fynnbe = validate_gh_user("fynnbe")
41+
fynnbe = validate_github_user("fynnbe")
4242
assert fynnbe == "fynnbe"

tests/test_specific_reexports_generics.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
"v0_3",
8181
"v0_4",
8282
"v0_5",
83-
"validate_gh_user",
83+
"validate_github_user",
8484
"validate_suffix",
8585
"ValidatedString",
8686
"ValidationInfo",

0 commit comments

Comments
 (0)