Skip to content

Commit db0aaff

Browse files
committed
Remove references to legacy JupyterHub
1 parent 970d990 commit db0aaff

File tree

4 files changed

+4
-44
lines changed

4 files changed

+4
-44
lines changed

src/dapla_metadata/_shared/config.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,6 @@ def get_config_item(item: str, *, raising: bool = False) -> str | None:
6767
return value
6868

6969

70-
def get_jupyterhub_user() -> str | None:
71-
"""Get the JupyterHub user name."""
72-
return get_config_item(JUPYTERHUB_USER)
73-
74-
7570
def get_statistical_subject_source_url() -> str | None:
7671
"""Get the URL to the statistical subject source."""
7772
return (

src/dapla_metadata/_shared/enums.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ class DaplaRegion(str, Enum):
55
"""Dapla platforms/regions."""
66

77
DAPLA_LAB = "DAPLA_LAB"
8-
BIP = "BIP"
98
ON_PREM = "ON_PREM"
109
CLOUD_RUN = "CLOUD_RUN"
1110

src/dapla_metadata/dapla/user_info.py

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
from dapla_metadata._shared import config
1010
from dapla_metadata._shared.enums import DaplaRegion
11-
from dapla_metadata._shared.enums import DaplaService
1211

1312
logger = logging.getLogger(__name__)
1413

@@ -110,36 +109,14 @@ def current_team(self) -> str:
110109
return parse_team_name(self.current_group)
111110

112111

113-
class JupyterHubUserInfo:
114-
"""Information about the current user when running on JupyterHub."""
115-
116-
@property
117-
def short_email(self) -> str | None:
118-
"""Get the short email address."""
119-
return config.get_jupyterhub_user()
120-
121-
@property
122-
def current_group(self) -> str:
123-
"""Get the group which the user is currently representing."""
124-
raise NotImplementedError
125-
126-
@property
127-
def current_team(self) -> str:
128-
"""Get the team which the user is currently representing."""
129-
raise NotImplementedError
130-
131-
132112
def get_user_info_for_current_platform() -> UserInfo:
133113
"""Return the correct implementation of UserInfo for the current platform."""
134114
if config.get_dapla_region() == DaplaRegion.DAPLA_LAB:
135115
return DaplaLabUserInfo()
136-
elif config.get_dapla_service() == DaplaService.JUPYTERLAB: # noqa: RET505
137-
return JupyterHubUserInfo()
138-
else:
139-
logger.warning(
140-
"Was not possible to retrieve user information! Some fields may not be set.",
141-
)
142-
return UnknownUserInfo()
116+
logger.warning(
117+
"Was not possible to retrieve user information! Some fields may not be set.",
118+
)
119+
return UnknownUserInfo()
143120

144121

145122
def parse_team_name(group: str) -> str:

tests/dapla/test_user_info.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,17 @@
22

33
from dapla_metadata._shared.config import DAPLA_GROUP_CONTEXT
44
from dapla_metadata._shared.config import DAPLA_REGION
5-
from dapla_metadata._shared.config import DAPLA_SERVICE
6-
from dapla_metadata._shared.config import JUPYTERHUB_USER
75
from dapla_metadata._shared.config import OIDC_TOKEN
86
from dapla_metadata._shared.enums import DaplaRegion
9-
from dapla_metadata._shared.enums import DaplaService
107
from dapla_metadata.dapla import user_info
118
from dapla_metadata.dapla.user_info import DaplaLabUserInfo
12-
from dapla_metadata.dapla.user_info import JupyterHubUserInfo
13-
from dapla_metadata.dapla.user_info import TestUserInfo
149
from dapla_metadata.dapla.user_info import UnknownUserInfo
1510
from dapla_metadata.dapla.user_info import UserInfo
1611

1712

1813
@pytest.mark.parametrize(
1914
("environment_variable_name", "environment_variable_value", "expected_class"),
2015
[
21-
(DAPLA_SERVICE, DaplaService.JUPYTERLAB.value, JupyterHubUserInfo),
2216
(DAPLA_REGION, DaplaRegion.DAPLA_LAB.value, DaplaLabUserInfo),
2317
(None, None, UnknownUserInfo),
2418
],
@@ -34,11 +28,6 @@ def test_get_user_info_for_current_platform(
3428
assert isinstance(user_info.get_user_info_for_current_platform(), expected_class)
3529

3630

37-
def test_jupyterhub_user_info_short_email(monkeypatch: pytest.MonkeyPatch):
38-
monkeypatch.setenv(JUPYTERHUB_USER, TestUserInfo.PLACEHOLDER_EMAIL_ADDRESS)
39-
assert JupyterHubUserInfo().short_email == TestUserInfo.PLACEHOLDER_EMAIL_ADDRESS
40-
41-
4231
def test_dapla_lab_user_info_short_email(
4332
fake_jwt: str,
4433
raw_jwt_payload: dict[str, object],

0 commit comments

Comments
 (0)