Skip to content

Commit 2c68ec7

Browse files
authored
Merge pull request #6 from DACCS-Climate/rebranding
Changing DACCS name to Marble
2 parents 5ac2769 + 4e013da commit 2c68ec7

File tree

9 files changed

+49
-49
lines changed

9 files changed

+49
-49
lines changed

daccs_client/__init__.py

Lines changed: 0 additions & 4 deletions
This file was deleted.

daccs_client/exceptions.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

marble_client/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
from .client import MarbleClient
2+
from .exceptions import MarbleBaseError, ServiceNotAvailableError, UnknownNodeError
3+
from .node import MarbleNode
4+
from .services import MarbleService
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@
99
import dateutil.parser
1010
import requests
1111

12-
from daccs_client.constants import CACHE_FNAME, CACHE_META_FNAME, NODE_REGISTRY_URL
13-
from daccs_client.exceptions import UnknownNodeError
14-
from daccs_client.node import DACCSNode
12+
from marble_client.constants import CACHE_FNAME, CACHE_META_FNAME, NODE_REGISTRY_URL
13+
from marble_client.exceptions import UnknownNodeError
14+
from marble_client.node import MarbleNode
1515

16-
__all__ = ["DACCSClient"]
16+
__all__ = ["MarbleClient"]
1717

1818

19-
class DACCSClient:
19+
class MarbleClient:
2020
def __init__(self, fallback: Optional[bool] = True) -> None:
2121
"""Constructor method
2222
@@ -30,7 +30,7 @@ def __init__(self, fallback: Optional[bool] = True) -> None:
3030
:raise RuntimeError: If cached registry needs to be read but there is no cache
3131
"""
3232
self._fallback = fallback
33-
self._nodes: dict[str, DACCSNode] = {}
33+
self._nodes: dict[str, MarbleNode] = {}
3434
self._registry: dict = {}
3535
try:
3636
registry = requests.get(NODE_REGISTRY_URL)
@@ -45,17 +45,17 @@ def __init__(self, fallback: Optional[bool] = True) -> None:
4545
self._load_registry_from_cloud(registry)
4646

4747
for node, node_details in self._registry.items():
48-
self._nodes[node] = DACCSNode(node, node_details)
48+
self._nodes[node] = MarbleNode(node, node_details)
4949

5050
@property
51-
def nodes(self) -> dict[str, DACCSNode]:
51+
def nodes(self) -> dict[str, MarbleNode]:
5252
return self._nodes
5353

54-
def __getitem__(self, node: str) -> DACCSNode:
54+
def __getitem__(self, node: str) -> MarbleNode:
5555
try:
5656
return self.nodes[node]
5757
except KeyError:
58-
raise UnknownNodeError(f"No node named '{node}' in the DACCS network.") from None
58+
raise UnknownNodeError(f"No node named '{node}' in the Marble network.") from None
5959

6060
def _load_registry_from_cloud(self, registry_response: requests.Response) -> None:
6161
try:
@@ -122,5 +122,5 @@ def _save_registry_as_cache(self):
122122

123123

124124
if __name__ == "__main__":
125-
d = DACCSClient()
125+
d = MarbleClient()
126126
print(d.nodes)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
__all__ = ("NODE_REGISTRY_URL", "CACHE_FNAME", "CACHE_META_FNAME")
66

7-
# DACCS node registry URL
7+
# Marble node registry URL
88
NODE_REGISTRY_URL: str = os.getenv(
9-
"DACCS_NODE_REGISTRY_URL",
9+
"MARBLE_NODE_REGISTRY_URL",
1010
"https://raw.githubusercontent.com/DACCS-Climate/DACCS-node-registry/current-registry/node_registry.json",
1111
)
1212

13-
_CACHE_DIR: str = os.getenv("DACCS_CACHE_DIR", user_cache_dir("daccs_client_python"))
13+
_CACHE_DIR: str = os.getenv("MARBLE_CACHE_DIR", user_cache_dir("marble_client_python"))
1414

1515
# location to write registry cache
1616
CACHE_FNAME: str = os.path.join(_CACHE_DIR, "registry.cached.json")

marble_client/exceptions.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class MarbleBaseError(Exception):
2+
pass
3+
4+
5+
class ServiceNotAvailableError(MarbleBaseError):
6+
pass
7+
8+
9+
class UnknownNodeError(MarbleBaseError):
10+
pass
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44
import dateutil.parser
55
import requests
66

7-
from daccs_client.exceptions import ServiceNotAvailableError
8-
from daccs_client.services import DACCSService
7+
from marble_client.exceptions import ServiceNotAvailableError
8+
from marble_client.services import MarbleService
99

10-
__all__ = ["DACCSNode"]
10+
__all__ = ["MarbleNode"]
1111

1212

13-
class DACCSNode:
13+
class MarbleNode:
1414
def __init__(self, nodename: str, jsondata: dict[str]) -> None:
1515
self._nodedata = jsondata
1616
self._name = nodename
@@ -21,7 +21,7 @@ def __init__(self, nodename: str, jsondata: dict[str]) -> None:
2121
self._services: list[str] = []
2222

2323
for service in jsondata["services"]:
24-
s = DACCSService(service)
24+
s = MarbleService(service)
2525
setattr(self, s.name, s)
2626
self._services.append(s.name)
2727

@@ -74,21 +74,21 @@ def last_updated(self) -> datetime:
7474
return dateutil.parser.isoparse(self._nodedata["last_updated"])
7575

7676
@property
77-
def daccs_version(self) -> str:
77+
def marble_version(self) -> str:
7878
return self._nodedata["version"]
7979

8080
@property
8181
def services(self) -> list[str]:
8282
return self._services
8383

84-
def __getitem__(self, service: str) -> DACCSService:
84+
def __getitem__(self, service: str) -> MarbleService:
8585
"""Get a service at a node by specifying its name.
8686
87-
:param service: Name of the DACCS service
87+
:param service: Name of the Marble service
8888
:type service: str
8989
:raises ServiceNotAvailable: This exception is raised if the service is not available at the node
9090
:return: _description_
91-
:rtype: DACCSservice
91+
:rtype: Marbleservice
9292
"""
9393
try:
9494
s = getattr(self, service)
@@ -99,7 +99,7 @@ def __getitem__(self, service: str) -> DACCSService:
9999
def __contains__(self, service: str) -> bool:
100100
"""Check if a service is available at a node
101101
102-
:param service: Name of the DACCS service
102+
:param service: Name of the Marble service
103103
:type service: str
104104
:return: True if the service is available, False otherwise
105105
:rtype: bool
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from typing import Any
22

3-
__all__ = ["DACCSService"]
3+
__all__ = ["MarbleService"]
44

55

6-
class DACCSService:
6+
class MarbleService:
77
def __init__(self, servicejson: dict[str, Any]) -> None:
88
"""Constructor method
99
10-
:param servicejson: A JSON representing the service according to the schema defined for the DACCS node registry
10+
:param servicejson: A JSON representing the service according to the schema defined for the Marble node registry
1111
:type servicejson: dict[str, Any]
1212
"""
1313
self._name = servicejson["name"]
@@ -50,11 +50,11 @@ def description(self) -> str:
5050
@property
5151
def url(self) -> str:
5252
"""Access the URL for the service itself. Note: the preferred approach to access the service
53-
URL is via just using the name of the DACCSService object.
53+
URL is via just using the name of the MarbleService object.
5454
5555
E.g.::
5656
57-
s = DACCSService(jsondata)
57+
s = MarbleService(jsondata)
5858
s # this prints http://url-of-service
5959
6060
:return: Service URL
@@ -67,7 +67,7 @@ def doc_url(self) -> str:
6767
return self._service_doc
6868

6969
def __str__(self) -> str:
70-
return f"DACCS service: {self.name}\n"
70+
return f"Marble service: {self.name}\n"
7171

7272
def __repr__(self) -> str:
7373
return self._service

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
11
[build-system]
2-
requires = ["setuptools>=61.0"]
32
build-backend = "setuptools.build_meta"
3+
requires = ["setuptools>=61.0"]
44

55
[project]
6-
name = "daccs_client"
76
authors = [{name = "Deepak Chandan", email = "[email protected]"}]
8-
description = "A python client to access information about the DACCS network"
9-
version = "0.0.1"
7+
description = "A python client to access information about the Marble climate infomatics network"
8+
name = "marble_client"
109
requires-python = ">=3.9"
10+
version = "0.0.1"
1111

1212
[tool.setuptools]
13-
packages = ["daccs_client"]
13+
packages = ["marble_client"]
1414

1515
[tool.black]
1616
line-length = 120

0 commit comments

Comments
 (0)